Compare commits

..

3 commits

2 changed files with 7 additions and 16 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# 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"
[[ ! "$reboot" ]] && exit 0
[[ -z "$reboot" ]] && exit 0
timeout="5"
printf ""$font_colored"> rebooting system in "

View file

@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
@ -8,20 +8,11 @@ distro="$(grep "^ID" /etc/*release | cut -d "=" -f2)"
script="$(dirname $(realpath $0))/$distro.sh"
# check if update script exists
[ ! -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
[[ ! -x "$script" ]] && printf "error: update script '"$script"' does not exist or is not executable!\n" >&2 && exit 1
# execute update script
#if [ "$distro" == "arch" ]; then
# "$script" $args
if [ "$(id -u)" -eq 0 ] || [ "$distro" == "arch" ]; then
#elif [ "$(id -u)" -eq 0 ]; then
"$script" $args
if [[ "$(id -u)" -eq 0 ]] || [[ "$distro" == "arch" ]]; then
"$script" $@
else
sudo "$script" $args
sudo "$script" $@
fi