diff --git a/util/functions.sh b/util/functions.sh index 526465d..1509682 100755 --- a/util/functions.sh +++ b/util/functions.sh @@ -57,3 +57,11 @@ warn_not_root() { echo -e "${YELLOW}WARNING:${NC} This should not be executed as root!" fi } + +poweroff() { + if command -v systemctl 2>/dev/null; then + systemctl poweroff + else + shutdown -P now + fi +} diff --git a/x230/x230_heads.sh b/x230/x230_heads.sh index 7c06b38..aa99bd3 100755 --- a/x230/x230_heads.sh +++ b/x230/x230_heads.sh @@ -155,8 +155,8 @@ rm -rf ${OUTPUT_PATH} while true; do read -r -p "Power off now? (please do!) Y/n: " yn case $yn in - [Yy]* ) systemctl poweroff ;; + [Yy]* ) poweroff ;; [Nn]* ) exit;; - * ) systemctl poweroff ;; + * ) poweroff ;; esac done diff --git a/x230/x230_skulls.sh b/x230/x230_skulls.sh index 8f76ef1..40ee1df 100755 --- a/x230/x230_skulls.sh +++ b/x230/x230_skulls.sh @@ -217,8 +217,8 @@ rm -rf ${OUTPUT_PATH} while true; do read -r -p "Power off now? (please do!) Y/n: " yn case $yn in - [Yy]* ) systemctl poweroff ;; + [Yy]* ) poweroff ;; [Nn]* ) exit;; - * ) systemctl poweroff ;; + * ) poweroff ;; esac done