From fdd9ec1568f7a456e559ca707e9e7e571703bfe9 Mon Sep 17 00:00:00 2001 From: caem Date: Sun, 12 Jan 2025 03:44:23 +0100 Subject: [PATCH] good night --- install.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index b6a1907..85ce6bd 100755 --- a/install.sh +++ b/install.sh @@ -17,6 +17,7 @@ args_ensure_extra_arg() { args_ensure_is_set() { if [ -z "$2" ]; then >&2 echo "Argument '$1' is required to be set. Please consult the README or run again with --help." + exit 1 fi } @@ -51,7 +52,7 @@ args() { "-o" | "--host") args_ensure_extra_arg "$@" - if [ ! -f "./hosts/$2" ]; then + if [ ! -d "./hosts/$2" ]; then >&2 echo "Invalid hostname '$2'. Make sure it exists in ./hosts" exit 1 fi @@ -71,8 +72,19 @@ args() { args_ensure_is_set "--host" "$DOTNIX_HOSTNAME" } +update_managed_values() { + echo "piss" +} + main () { args "$@" + + update_managed_values + + if [ "$(id -u)" != "0" ]; then + >&2 echo "The installation script must be run as root to work." + exit 1 + fi } set -e