fix update script (specifically for debian)

This commit is contained in:
Daniel Sommer 2024-12-10 09:39:19 +01:00
parent 6d0919cb6f
commit 54c7b09524
2 changed files with 4 additions and 10 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de> # author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT # license: MIT
@ -39,7 +39,7 @@ printf ""$font_colored"> removing orphaned packages..."$font_default"\n"
printf ""$font_colored_bold">> system updated finished after "$SECONDS" seconds!"$font_default"\n" printf ""$font_colored_bold">> system updated finished after "$SECONDS" seconds!"$font_default"\n"
[[ ! "$reboot" ]] && exit 0 [[ -z "$reboot" ]] && exit 0
timeout="5" timeout="5"
printf ""$font_colored"> rebooting system in " printf ""$font_colored"> rebooting system in "

View file

@ -10,15 +10,9 @@ script="$(dirname $(realpath $0))/$distro.sh"
# check if update script exists # check if update script exists
[[ ! -x "$script" ]] && printf "error: update script '"$script"' does not exist or is not executable!\n" >&2 && exit 1 [[ ! -x "$script" ]] && printf "error: update script '"$script"' does not exist or is not executable!\n" >&2 && exit 1
args=""
for arg in "$@"; do
[[ -n "$args" ]] && args="$args "
args="$args$arg"
done
# execute update script # execute update script
if [[ "$(id -u)" -eq 0 ]] || [[ "$distro" == "arch" ]]; then if [[ "$(id -u)" -eq 0 ]] || [[ "$distro" == "arch" ]]; then
"$script" $args "$script" $@
else else
sudo "$script" $args sudo "$script" $@
fi fi