diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index fcd144b..f3767b5 --- a/install.sh +++ b/install.sh @@ -5,5 +5,23 @@ # FUNCTIONS +function halt_on_error { + >&2 echo "ERROR: $1" + exit ${2:-1} +} + +function assert_root { + [ "$(id -u)" -ne 0 ] && halt_on_error 'root privilege required!' +} + +function assert_proxmox { + grep -q ^ID=debian /etc/os-release || halt_on_error 'distro debian required!' 2 + command -v pct >/dev/null || halt_on_error 'command `pct` not found!' 3 +} + # MAIN +set Eue +assert_root +assert_proxmox +echo OK