18 lines
507 B
Bash
Executable file
18 lines
507 B
Bash
Executable file
#!/usr/bin/env zsh
|
|
|
|
# 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
|
|
[[ ! -x "$script" ]] && printf "error: update script '"$script"' does not exist or is not executable!\n" >&2 && exit 1
|
|
|
|
# execute update script
|
|
if [[ "$(id -u)" -eq 0 ]] || [[ "$distro" == "arch" ]]; then
|
|
"$script" $@
|
|
else
|
|
sudo "$script" $@
|
|
fi
|