2024-12-10 09:16:00 +01:00
|
|
|
#!/usr/bin/env zsh
|
2024-09-26 11:05:50 +02:00
|
|
|
|
|
|
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
|
|
|
# license: MIT
|
|
|
|
|
|
|
|
# get distro and update script path
|
|
|
|
distro="$(grep "^ID" /etc/*release | cut -d "=" -f2)"
|
|
|
|
script="$(dirname $(realpath $0))/$distro.sh"
|
|
|
|
|
|
|
|
# check if update script exists
|
2024-12-10 09:16:00 +01:00
|
|
|
[[ ! -x "$script" ]] && printf "error: update script '"$script"' does not exist or is not executable!\n" >&2 && exit 1
|
2024-09-26 11:05:50 +02:00
|
|
|
|
|
|
|
args=""
|
|
|
|
for arg in "$@"; do
|
2024-12-10 09:16:00 +01:00
|
|
|
[[ -n "$args" ]] && args="$args "
|
2024-09-26 11:05:50 +02:00
|
|
|
args="$args$arg"
|
|
|
|
done
|
|
|
|
|
|
|
|
# execute update script
|
2024-12-10 09:16:00 +01:00
|
|
|
if [[ "$(id -u)" -eq 0 ]] || [[ "$distro" == "arch" ]]; then
|
2024-11-05 15:43:50 +01:00
|
|
|
"$script" $args
|
2024-09-26 11:05:50 +02:00
|
|
|
else
|
|
|
|
sudo "$script" $args
|
|
|
|
fi
|