diff --git a/install.sh b/install.sh index 0e77767..aedbaa9 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,5 @@ -#!/bin/bash -set -euo pipefail +#!/bin/sh +case "$(readlink /proc/$$/exe)" in */bash) set -euo pipefail ;; *) set -eu ;; esac # pve-nag-buster (v03) https://github.com/foundObjects/pve-nag-buster # Copyright (C) 2019 /u/seaQueue (reddit.com/u/seaQueue) @@ -22,12 +22,12 @@ set -euo pipefail # ensure a predictable environment PATH=/usr/sbin:/usr/bin:/sbin:/bin -unalias -a +\unalias -a # installer main body: _main() { # ensure $1 exists so 'set -u' doesn't error out - (("$#" == 0)) && { set -- ""; } >&/dev/null + [ "$#" -eq "0" ] && { set -- ""; } > /dev/null 2>&1 case "$1" in "--emit") @@ -62,7 +62,6 @@ _uninstall() { rm -f "/usr/share/pve-nag-buster.sh" echo "Script and dpkg hooks removed, please manually remove /etc/apt/sources.list.d/pve-no-subscription.list if desired" - exit 0 } _install() { @@ -95,7 +94,7 @@ _install() { echo "Installing script to /usr/share/pve-nag-buster.sh" temp='' - if [[ "$1" == "--offline" ]]; then + if [ "$1" = "--offline" ]; then # offline mode, emit stored script temp="$(mktemp)" && trap "rm -f $temp" EXIT emit_script > "$temp" @@ -126,29 +125,28 @@ _install() { emit_script() { base64 -d << 'YEET' | unxz -/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4AX4A41dABGIQkY99Bhqpmevep/kIs9shoiNvzAP074w -LI3FnbhLtpij4weS6SyCQK59Kz5tjbWnQyPF33jFXvJXaoUNWDu1jNCPGEbx8L/Xao1oj9pvY3Kg -1uiwbnqeFY3T0BVw3vH9v/mVM6jVs0gGace5y1ki7lhS3HB4q9iVjJX5r/YVESrEAGySvuExVL23 -Z0oXeFJgOvXO004IZYFS2oBqhv5RAgZ8/CXFodJxQF4RPUltfoDJ+ZtX7kh94C/s1Ke/Sx+X/OGr -UXzrTQMRYBtjbDv0bpHly5aADIveLB+OXCPWu9Ad+r07/DQjX+jPTuwrlKeE+t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AM5/Fxu3snKRlYeLwKC7uq9uTFR/L64HzG0TPfjmkH24hNsuhe7 +JtcdlRcbL5rHN9C5PNOpCqcEeRDmVsS0sgAAAMwFRS7YkAXGAAGmB/cLAADBO9SpscRn+wIAAAAA +BFla YEET } -assert_root() { [ $(id -u) -eq '0' ] || { echo "This action requires root." && exit 0; }; } -err() { echo "Err '${FUNCNAME[1]}': $*" >&2; } +assert_root() { [ "$(id -u)" -eq '0' ] || { echo "This action requires root." && exit 1; }; } _usage() { echo "Usage: $(basename "$0") (--emit|--offline|--uninstall)"; } _main "$@" diff --git a/pve-nag-buster.sh b/pve-nag-buster.sh index 24ca0c5..5dc290d 100755 --- a/pve-nag-buster.sh +++ b/pve-nag-buster.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # pve-nag-buster.sh (v03) https://github.com/foundObjects/pve-nag-buster # Copyright (C) 2019 /u/seaQueue (reddit.com/u/seaQueue)