Update 19 files

- /system/usr/local/share/run_onchange_after_setup-share-folder
- /system/var/log/user/run_onchange_after-symlink-user-logs
- /system/usr/share/run_onchange_after_setup-share-folder
- /system/etc/default/modify_grub
- /system/boot/efi/EFI/qubes/modify_grubenv
- /home/.chezmoiscripts/universal/run_onchange_after_14_install-aqua-packages.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_21-import-dconf-settings.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_20-apply-settings.mjs.tmpl
- /system/usr/local/bin/executable_squash-symlink
- /system/etc/modify_environment
- /home/.chezmoiscripts/universal/run_onchange_after_19-theme-files.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_14_install-aqua-packages.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_21-dconf-settings.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_20-misc-settings.mjs.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_5-log-config.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_4-environment-profile.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_60-grub-settings.tmpl
- /home/dot_local/bin/executable_rclone-mount
- /home/.chezmoidata.yaml
This commit is contained in:
Brian Zalewski 2023-01-10 07:09:18 +00:00
parent 6d2194d0ba
commit 2d743be3bb
14 changed files with 184 additions and 122 deletions

View file

@ -23,6 +23,9 @@ config:
gpg: https://raw.githubusercontent.com/drduh/config/master/gpg.conf
fonts:
main: Montserrat Bold
grub:
shiftToSee: false
timeout: 9
removeLinuxPackages:
- aisleriot
- gnome-mahjongg
@ -35,6 +38,7 @@ removeLinuxShortcuts:
- flutter_openurl.desktop
- htop.desktop
- scvim.desktop
theme: Betelgeuse
softwareGroups:
Android: &Android
- scrcpy

View file

@ -0,0 +1,37 @@
{{- if (eq .host.distro.family "linux") -}}
#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Clean up system theme settings
for ITEM_TO_BE_REMOVED of "/usr/share/backgrounds/images" "/usr/share/backgrounds/f32" "/usr/share/backgrounds/qubes" "/usr/share/wallpapers"; do
if [ -d "$ITEM_TO_BE_REMOVED" ] || [ -f "$ITEM_TO_BE_REMOVED" ]; then
sudo rm -rf "$ITEM_TO_BE_REMOVED"
logg success "Removed $ITEM_TO_BE_REMOVED"
fi
fi
### Ensure /usr/local/share exists
if [ ! -d /usr/local/share ]; then
sudo mkdir -p /usr/local/share
logg success 'Created /usr/local/share'
fi
### Copy theme files over to /usr/local/share
if [ -d "$HOME/.local/src/{{ .theme | lower }}/share" ]; then
logg info 'Copying ~/.local/src/{{ .theme | lower }}/share to /usr/local/share'
sudo cp -rf ~/.local/src/{{ .theme | lower }}/share/ /usr/local/share
else
logg warn '~/.local/src/betelgeuse/share is missing'
fi
### Flatten theme files (i.e. convert symlinks to regular files)
if command -v squash-symlink > /dev/null; then
logg info 'Converting all theme symlinks to equivalent regular files'
sudo find /usr/local/share -type l -exec squash-symlink {} +
else
logg warn '`squash-symlink` is not a script in the PATH'
fi
{{ end -}}

View file

@ -1,3 +1,4 @@
{{- if (eq .host.distro.family "linux") -}}
#!/usr/bin/env bash
### Ensure QT_STYLE_OVERRIDE is set in /etc/environment
@ -7,3 +8,5 @@ if cat /etc/environment | grep QT_STYLE_OVERRIDE; then
else
echo 'export QT_STYLE_OVERRIDE=kvantum-dark' | sudo tee -a /etc/environment
fi
{{ end -}}

View file

@ -0,0 +1,140 @@
{{- if (eq .host.distro.family "linux") -}}
#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Fix Qubes issue
if command -v qubesctl > /dev/null && [ -f /boot/grub2/grubenv ] && [ -d /boot/efi/EFI/qubes ]; then
sudo cp -f /boot/grub2/grubenv /boot/efi/EFI/qubes/grubenv
logg success 'Copied /boot/grub2/grubenv to /boot/efi/EFI/qubes/grubenv'
fi
### Ensure /boot/grub2/themes is directory
if [ ! -d /boot/grub2/themes ]; then
sudo mkdir -p /boot/grub2/themes
logg success 'Created /boot/grub2/themes'
fi
### Copy GRUB theme to /boot/grub2/themes
if [ -d /usr/local/share/grub/themes ]; then
sudo cp -rf /usr/local/share/grub/themes/ /boot/grub2/themes
logg success 'Copied GRUB themes in /usr/local/share/grub/themes to /boot/grub2/themes'
else
logg warn '`/usr/local/share/grub/themes` is missing'
fi
### Set default GRUB screen resolution variables
SCREEN_RATIO_ULTRAWIDE="2100"
GRUB_RESOLUTION_TYPE="1080p"
### Determine screen size ratio (used for picking GRUB2 theme resolution)
if command -v xrandr && command -v uniq; then
SCREEN_WIDTH="$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1)"
SCREEN_HEIGHT="$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2)"
SCREEN_RATIO="$(awk -v height="$SCREEN_HEIGHT" -v width="$SCREEN_WIDTH" 'BEGIN { print ((height / width) * 1000) }')"
SCREEN_RATIO="${SCREEN_RATIO%.*}"
logg success "Screen detected as $SCREEN_WIDTH x $SCREEN_HEIGHT (ratio of $SCREEN_RATIO)"
if (( $(echo "$SCREEN_RATIO $SCREEN_RATIO_ULTRAWIDE" | awk '{print ($1 > $2)}') )); then
GRUB_RESOLUTION_TYPE="ultrawide"
logg info 'GRUB resolution registered as `ultrawide`'
fi
else
logg warn 'Missing either `xrandr` or `uniq` (required for calculating screen size ratio)'
fi
### Optimize the GRUB resolution
if [ -f /etc/default/grub ]; then
### GRUB_GFXMODE
logg info 'Setting GRUB_GFXMODE=auto in /etc/default/grub'
if cat /etc/default/grub | grep GRUB_GFX_MODE; then
sudo sed -i '/.*GRUB_GFXMODE.*/GRUB_GFXMODE=auto/' /etc/default/grub
else
echo "GRUB_GFXMODE=auto" | sudo tee -a /etc/default/grub
fi
### GRUB_GFXPAYLOAD_LINUX
logg info 'Setting GRUB_GFXPAYLOAD_LINUX=keep in /etc/default/grub'
if cat /etc/default/grub | grep GRUB_GFXPAYLOAD_LINUX; then
sudo sed -i '/.*GRUB_GFXPAYLOAD_LINUX.*/GRUB_GFXPAYLOAD_LINUX="keep"/' /etc/default/grub
else
echo 'GRUB_GFXPAYLOAD_LINUX="keep"' | sudo tee -a /etc/default/grub
fi
### GRUB_THEME
logg info 'Setting GRUB_THEME={{ .theme }} in /etc/default/grub'
if cat /etc/default/grub | grep GRUB_THEME; then
sudo sed -i '/.*GRUB_THEME.*/GRUB_THEME="{{ .theme }}-'"$GRUB_RESOLUTION_TYPE"'"/' /etc/default/grub
else
echo 'GRUB_THEME="{{ .theme }}-'"$GRUB_RESOLUTION_TYPE"'"' | sudo tee -a /etc/default/grub
fi
### GRUB_BACKGROUND
logg info 'Setting GRUB_BACKGROUND=/usr/local/share/grub/{{ .theme }}-blue.png in /etc/default/grub'
if cat /etc/default/grub | grep GRUB_BACKGROUND; then
sudo sed -i '/.*GRUB_BACKGROUND.*/GRUB_BACKGROUND="/usr/local/share/grub/{{ .theme }}-blue.png"/' /etc/default/grub
else
echo 'GRUB_BACKGROUND="/usr/local/share/grub/{{ .theme }}-blue.png"' | sudo tee -a /etc/default/grub
fi
### GRUB_TIMEOUT
logg info 'Setting GRUB_TIMEOUT={{ .grub.timeout }} in /etc/default/grub'
if cat /etc/default/grub | grep GRUB_TIMEOUT; then
sudo sed -i '/.*GRUB_TIMEOUT.*/GRUB_TIMEOUT="{{ .grub.timeout }}"/' /etc/default/grub
else
echo 'GRUB_TIMEOUT="{{ .grub.timeout }}"' | sudo tee -a /etc/default/grub
fi
### GRUB_FORCE_HIDDEN_MENU
logg info 'Setting GRUB_FORCE_HIDDEN_MENU={{ .grub.shiftToSee }} in /etc/default/grub'
sed -i '/GRUB_FORCE_HIDDEN_MENU/d' /etc/default/grub
echo "GRUB_FORCE_HIDDEN_MENU={{ .grub.shiftToSee }}" > /etc/default/grub
### Remove duplicate lines in /etc/default/grub
logg info 'Ensuring there are no duplicate entries in /etc/default/grub'
cat /etc/default/grub | uniq -u | sudo tee /etc/default/grub
else
logg warn '/etc/default/grub is missing'
fi
### Determine platform-specific icon to use
if command -v qubesctl > /dev/null; then
GRUB_ICON='qubes'
elif [ -f "/boot/grub2/themes/{{ .theme }}-$GRUB_RESOLUTION_TYPE/icons/{{ .host.distro.id }}.png" ]; then
GRUB_ICON='{{ .host.distro.id }}'
elif [ -f "/boot/grub2/themes/{{ .theme }}-$GRUB_RESOLUTION_TYPE/icons/{{ .host.distro.family }}.png" ]; then
GRUB_ICON='{{ .host.distro.family }}'
else
GRUB_ICON='linux'
fi
### Copy icon to GRUB2 theme folder
if [ -f "/boot/grub2/themes/{{ .theme }}-$GRUB_RESOLUTION_TYPE/icons/$GRUB_ICON.png" ]; then
cp -f /boot/grub2/themes/{{ .theme }}-$GRUB_RESOLUTION_TYPE/icons/$GRUB_ICON.png /boot/grub2/themes/{{ .theme }}-$GRUB_RESOLUTION_TYPE/icon.png
logg success 'Copied platform-specific icon to GRUB2 theme folder'
else
logg warn "/boot/grub2/themes/{{ .theme }}-$GRUB_RESOLUTION_TYPE/icons/$GRUB_ICON.png is missing"
fi
### Apply GRUB2 theme
if [ -d /sys/firmware/efi ]; then
logg info 'Assuming system is UEFI-enabled since /sys/firmware/efi is present'
if [ -f /boot/efi/EFI/qubes/grub.cfg ]; then
logg info 'Running `sudo grub2-mkconfig -o /boot/efi/EFI/qubes/grub.cfg`'
sudo grub2-mkconfig -o /boot/efi/EFI/qubes/grub.cfg
logg success 'Applied GRUB2 theme'
elif [ -f /boot/efi/EFI/grub.cfg ]
logg info 'Running `sudo grub2-mkconfig -o /boot/efi/EFI/grub.cfg`'
sudo grub2-mkconfig -o /boot/efi/EFI/grub.cfg
logg success 'Applied GRUB2 theme'
else
logg warn 'Unknown GRUB2 configuration - not applying GRUB2 theme'
fi
else
logg info 'Assuming system is non-UEFI since /sys/firmware/efi is not present'
logg info 'Running `sudo grub2-mkconfig -o /boot/grub2/grub.cfg`'
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
logg success 'Applied GRUB2 theme'
fi
{{ end -}}

View file

@ -1,4 +0,0 @@
#!/usr/bin/env bash
logg info 'Copying /boot/grub2/grubenv to /boot/efi/EFI/qubes/grubenv'
sudo cp -f /boot/grub2/grubenv /boot/efi/EFI/qubes/grubenv

View file

@ -1,57 +0,0 @@
#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
SCREEN_WIDTH="$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1)"
SCREEN_HEIGHT="$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2)"
SCREEN_RATIO="$(awk -v height={{ screen_height.stdout }} -v width={{ screen_width.stdout }} 'BEGIN { print ((height / width) * 1000) }')"
SCREEN_RATIO="${SCREEN_RATIO%.*}"
SCREEN_RATIO_ULTRAWIDE="2100"
GRUB_RESOLUTION_TYPE="1080p"
### Determine if screen is ultrawide
if (( $(echo "$SCREEN_RATIO $SCREEN_RATIO_ULTRAWIDE" | awk '{print ($1 > $2)}') )); then
GRUB_RESOLUTION_TYPE="ultrawide"
fi
### Optimize the GRUB resolution
logg info 'Optimizing the GRUB resolution'
if cat /etc/default/grub | grep GRUB_GFX_MODE; then
sudo sed -i '/.*GRUB_GFXMODE.*/GRUB_GFXMODE=auto/' /etc/default/grub
else
echo "GRUB_GFXMODE=auto" | sudo tee -a /etc/default/grub
fi
### Add GRUB_GFXPAYLOAD_LINUX=keep
logg info 'Ensuring GRUB_GFXPAYLOAD_LINUX is set to keep'
if cat /etc/default/grub | grep GRUB_GFXPAYLOAD_LINUX; then
sudo sed -i '/.*GRUB_GFXPAYLOAD_LINUX.*/GRUB_GFXPAYLOAD_LINUX="keep"/' /etc/default/grub
else
echo 'GRUB_GFXPAYLOAD_LINUX="keep"' | sudo tee -a /etc/default/grub
fi
### Set GRUB theme
logg info "Setting GRUB2 theme to {{ .theme }}-$GRUB_RESOLUTION_TYPE"
if cat /etc/default/grub | grep GRUB_THEME; then
sudo sed -i '/.*GRUB_THEME.*/GRUB_THEME="{{ .theme }}-'"$GRUB_RESOLUTION_TYPE"'"/' /etc/default/grub
else
echo 'GRUB_THEME="{{ .theme }}-'"$GRUB_RESOLUTION_TYPE"'"' | sudo tee -a /etc/default/grub
fi
### Set GRUB background
logg info 'Set GRUB background to prevent FOUC'
if cat /etc/default/grub | grep GRUB_BACKGROUND; then
sudo sed -i '/.*GRUB_BACKGROUND.*/GRUB_BACKGROUND="/usr/local/share/grub/{{ .theme }}-blue.png"/' /etc/default/grub
else
echo 'GRUB_BACKGROUND="/usr/local/share/grub/{{ .theme }}-blue.png"' | sudo tee -a /etc/default/grub
fi
### Configure Shift to see menu feature
logg info 'Configuring Shift to see GRUB2 menu feature'
sed -i '/GRUB_FORCE_HIDDEN_MENU/d' /etc/default/grub
echo "GRUB_FORCE_HIDDEN_MENU={{ .grub.shiftToSeeMenu }}" > /etc/default/grub
### Remove duplicate lines
logg info 'Ensuring there are no duplicate entries in /etc/default/grub'
cat /etc/default/grub | uniq -u | sudo tee /etc/default/grub

View file

@ -1,18 +0,0 @@
#!/usr/bin/env bash
set -e
for link; do
test -h "$link" || continue
dir=$(dirname "$link")
reltarget=$(readlink "$link")
case $reltarget in
/*) abstarget=$reltarget;;
*) abstarget=$dir/$reltarget;;
esac
rm -fv "$link"
cp -afv "$abstarget" "$link" || {
# Restore link on failure
rm -rfv "$link"
ln -sfv "$reltarget" "$link"
}
done

View file

@ -1,27 +0,0 @@
#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
logg info 'Ensure /usr/local/share is a directory'
sudo mkdir -p /usr/local/share
logg info 'Clean up old theme files'
for ITEM_TO_BE_REMOVED of "/usr/share/backgrounds/images" "/usr/share/backgrounds/f32" "/usr/share/backgrounds/qubes" "/usr/share/wallpapers"; do
if [ -d "$ITEM_TO_BE_REMOVED" ] || [ -f "$ITEM_TO_BE_REMOVED" ]; then
logg info "Removing $ITEM_TO_BE_REMOVED"
sudo rm -rf "$ITEM_TO_BE_REMOVED"
fi
fi
logg info 'Copy /usr/local/src/{{ .theme }}/share to /usr/local/share'
sudo cp -rf /usr/local/src/{{ .theme }}/share/ /usr/local/share
logg info 'Converting all symlinks to equivalent regular files'
sudo find /usr/local/src -type l -exec squash-symlink {} +
logg info 'Ensure /boot/grub2/themes is a directory'
sudo mkdir -p /boot/grub2/themes
logg info 'Copy GRUB themes to /boot/grub2/themes'
sudo cp -rf /usr/local/share/grub/themes/ /boot/grub2/themes

View file

@ -1,16 +0,0 @@
#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
logg info 'Ensure /usr/local/share/grub/themes is a directory'
sudo mkdir -p /usr/local/share/grub/themes
logg info 'Copy GRUB theme to /usr/local/share/grub/themes'
cp -rf /usr/local/src/{{ .theme }}/share/grub/themes/ /usr/local/share/grub/themes
logg info 'Ensure /boot/grub2/themes is a directory'
sudo mkdir -p /boot/grub2/themes
logg info 'Copy GRUB themes to /boot/grub2/themes'
sudo cp -rf /usr/local/share/grub/themes/ /boot/grub2/themes