fix syntax and change shebang to 'zsh'

This commit is contained in:
Daniel Sommer 2024-12-10 09:16:00 +01:00
parent 3ca7eea87d
commit 3ea5eee6bc

View file

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de> # author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT # license: MIT
@ -8,19 +8,16 @@ distro="$(grep "^ID" /etc/*release | cut -d "=" -f2)"
script="$(dirname $(realpath $0))/$distro.sh" 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="" args=""
for arg in "$@"; do for arg in "$@"; do
[ -n "$args" ] && args="$args " [[ -n "$args" ]] && args="$args "
args="$args$arg" args="$args$arg"
done done
# execute update script # execute update script
#if [ "$distro" == "arch" ]; then if [[ "$(id -u)" -eq 0 ]] || [[ "$distro" == "arch" ]]; then
# "$script" $args
if [ "$(id -u)" -eq 0 ] || [ "$distro" == "arch" ]; then
#elif [ "$(id -u)" -eq 0 ]; then
"$script" $args "$script" $args
else else
sudo "$script" $args sudo "$script" $args