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
|
|
|
|
|
|
|
# execute update script
|
2024-12-10 09:16:00 +01:00
|
|
|
if [[ "$(id -u)" -eq 0 ]] || [[ "$distro" == "arch" ]]; then
|
2024-12-10 09:39:19 +01:00
|
|
|
"$script" $@
|
2024-09-26 11:05:50 +02:00
|
|
|
else
|
2024-12-10 09:39:19 +01:00
|
|
|
sudo "$script" $@
|
2024-09-26 11:05:50 +02:00
|
|
|
fi
|