diff --git a/dist/etc/systemd/system/goldilocks.service b/dist/etc/systemd/system/goldilocks.service index c48ba4e..41cd441 100644 --- a/dist/etc/systemd/system/goldilocks.service +++ b/dist/etc/systemd/system/goldilocks.service @@ -19,8 +19,8 @@ StartLimitBurst=3 # User and group the process will run as # (www-data is the de facto standard on most systems) -User=www-data -Group=www-data +User=MY_USER +Group=MY_GROUP # If we need to pass environment variables in the future Environment=GOLDILOCKS_PATH=/srv/www NODE_PATH=/opt/goldilocks/lib/node_modules NPM_CONFIG_PREFIX=/opt/goldilocks diff --git a/installer/install-for-systemd.sh b/installer/install-for-systemd.sh index e8b600e..e2c5028 100644 --- a/installer/install-for-systemd.sh +++ b/installer/install-for-systemd.sh @@ -7,6 +7,9 @@ echo "" echo "Installing as systemd service" echo "" +sed "s/MY_USER/$my_user/g" "$my_app_dist/$my_app_systemd_service" > "$my_app_dist/$my_app_systemd_service.2" +sed "s/MY_GROUP/$my_group/g" "$my_app_dist/$my_app_systemd_service.2" > "$my_app_dist/$my_app_systemd_service" +rm "$my_app_dist/$my_app_systemd_service.2" safe_copy_config "$my_app_dist/$my_app_systemd_service" "$my_root/$my_app_systemd_service" safe_copy_config "$my_app_dist/$my_app_systemd_tmpfiles" "$my_root/$my_app_systemd_tmpfiles" diff --git a/installer/sudo-cmd.sh b/installer/sudo-cmd.sh index 7849e92..9340092 100644 --- a/installer/sudo-cmd.sh +++ b/installer/sudo-cmd.sh @@ -1,5 +1,5 @@ # Not every platform has or needs sudo, gotta save them O(1)s... sudo_cmd="" -if [ type -p sudo ]; then +if type -p sudo >/dev/null 2>/dev/null; then ((EUID)) && [[ -z "${ANDROID_ROOT-}" ]] && sudo_cmd="sudo" fi