diff --git a/cmd/updater/systemd-setup-user.sh b/cmd/updater/systemd-setup-user.sh index fa17a1db2b..c5b145eff7 100755 --- a/cmd/updater/systemd-setup-user.sh +++ b/cmd/updater/systemd-setup-user.sh @@ -21,9 +21,27 @@ setup_user() { sed -e s,@@BINDIR@@,"$bindir", "${SCRIPTPATH}/algorand@.service.template-user" \ > "$homedir/.config/systemd/user/algorand@.service" + if [[ ${HOSTMODE} == true ]]; then + echo "[INFO] Hosted mode - replacing algod with algoh" + sed -i 's/algod/algoh/g' "$homedir/.config/systemd/user/algorand@.service" + fi + systemctl --user daemon-reload } +HOSTMODE=false +while getopts H opt; do + case $opt in + H) + HOSTMODE=true + ;; + ?) + echo "Invalid option: -${OPTARG}" + exit 1 + ;; + esac +done +shift $((OPTIND-1)) if [ "$#" != 1 ]; then echo "Usage: $0 username" diff --git a/cmd/updater/systemd-setup.sh b/cmd/updater/systemd-setup.sh index bad8745137..fc27fd209c 100755 --- a/cmd/updater/systemd-setup.sh +++ b/cmd/updater/systemd-setup.sh @@ -14,9 +14,28 @@ setup_root() { sed ${sedargs} "${SCRIPTPATH}/algorand@.service.template" \ > /lib/systemd/system/algorand@.service + if [[ ${HOSTMODE} == true ]]; then + echo "[INFO] Hosted mode - replacing algod with algoh" + sed -i 's/algod/algoh/g' /lib/systemd/system/algorand@.service + fi + systemctl daemon-reload } +HOSTMODE=false +while getopts H opt; do + case $opt in + H) + HOSTMODE=true + ;; + ?) + echo "Invalid option: -${OPTARG}" + exit 1 + ;; + esac +done +shift $((OPTIND-1)) + if [ "$#" != 2 ] && [ "$#" != 3 ]; then echo "Usage: $0 username group [bindir]" exit 1