diff options
Diffstat (limited to 'bin/udt-grub')
| -rwxr-xr-x | bin/udt-grub | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/bin/udt-grub b/bin/udt-grub index 20fd296..273389c 100755 --- a/bin/udt-grub +++ b/bin/udt-grub @@ -10,8 +10,8 @@ # and a scheme switch leave the copy stale. # # udt-accent starts this detached on every run; install.sh runs it in the -# foreground. A notification goes out only when an installed theme is stale: -# a machine that never installed it has nothing to refresh. +# foreground. The root steps go to the steps window through udt-steps, and +# the tab clears itself once /boot matches the build. repo="$(dirname "$(readlink -f "$0")")/.." grub_repo="$(realpath -m "$repo/../grub-theme-udt")" @@ -28,23 +28,33 @@ flock 9 theme=/boot/grub/themes/udt copy="rm -rf $theme && cp -r \"$grub_repo/dist/udt\" /boot/grub/themes/" -if diff -rq "$grub_repo/dist/udt" "$theme" >/dev/null 2>&1; then - echo "grub theme: up to date" -elif [ -d "$theme" ]; then - echo "grub theme: refresh as root" +steps() { + if diff -rq "$grub_repo/dist/udt" "$theme" >/dev/null 2>&1; then + return + elif [ -d "$theme" ]; then + echo "The GRUB theme was rebuilt. Refresh the copy in /boot as root:" + else + echo "The GRUB theme is built but not installed. As root:" + fi echo " $copy" - command -v notify-send >/dev/null 2>&1 && - notify-send -a udt "grub: theme rebuilt" "As root: -$copy" -else - echo "grub theme: run these as root to install it" - echo " $copy" -fi -grep -q "^GRUB_THEME=\"$theme/theme.txt\"" /etc/default/grub 2>/dev/null || { - echo " # once: GRUB_THEME=\"$theme/theme.txt\" in /etc/default/grub, then" - echo " grub-mkconfig -o /boot/grub/grub.cfg" + grep -q "^GRUB_THEME=\"$theme/theme.txt\"" /etc/default/grub 2>/dev/null || { + echo + echo "Once, set GRUB_THEME=\"$theme/theme.txt\" in /etc/default/grub, then:" + echo " grub-mkconfig -o /boot/grub/grub.cfg" + } + # The panel title falls back to the OS name until one is set. + [ -n "$("$repo/bin/udt-machine-name")" ] || { + echo + echo "Optional, the panel title:" + echo " \"$repo/bin/udt-machine-name\" \"My Machine\"" + } } -# The panel title falls back to the OS name until one is set. -[ -n "$("$repo/bin/udt-machine-name")" ] || - echo " # optional, the panel title: sudo \"$repo/bin/udt-machine-name\" \"My Machine\"" + +out="$(steps)" +echo "grub theme: ${out:-up to date}" +# A theme that was never installed stays out of the steps window: a wallpaper +# change would otherwise keep asking for an install nobody wanted. +if [ -d "$theme" ] || [ -z "$out" ]; then + printf '%s' "$out" | "$repo/bin/udt-steps" grub +fi exit 0 |
