fix: force sv usage in docker container to avoid cases where systemd is used instead
On newer Ubuntu Noble, cron (among other things) has a transitory dependency on systemd, forcing our systemd/runit detection to fail. This change allows overriding the detected init on Ubuntu systems, ensuring we always do the right thing when interacting with init.
This commit is contained in:
@@ -82,7 +82,9 @@ trigger-nginx-vhosts-install() {
|
||||
;;
|
||||
|
||||
ubuntu)
|
||||
if [[ -x "$systemctl_path" ]]; then
|
||||
if [[ "$DOKKU_INIT_SYSTEM" == "sv" ]]; then
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/sv enable $NGINX_INIT_NAME, /usr/bin/sv disable $NGINX_INIT_NAME, /usr/bin/sv reload $NGINX_INIT_NAME, /usr/bin/sv start $NGINX_INIT_NAME, /usr/bin/sv stop $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
|
||||
elif [[ -x "$systemctl_path" ]]; then
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:$systemctl_path enable $NGINX_INIT_NAME, $systemctl_path disable $NGINX_INIT_NAME, $systemctl_path reload $NGINX_INIT_NAME, $systemctl_path start $NGINX_INIT_NAME, $systemctl_path stop $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
|
||||
elif [[ -x /usr/bin/sv ]]; then
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/sv enable $NGINX_INIT_NAME, /usr/bin/sv disable $NGINX_INIT_NAME, /usr/bin/sv reload $NGINX_INIT_NAME, /usr/bin/sv start $NGINX_INIT_NAME, /usr/bin/sv stop $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
|
||||
|
||||
@@ -549,7 +549,9 @@ fn-nginx-vhosts-nginx-init-cmd() {
|
||||
|
||||
ubuntu)
|
||||
# support docker-based installations
|
||||
if [[ -x "$systemctl_path" ]]; then
|
||||
if [[ "$DOKKU_INIT_SYSTEM" == "sv" ]]; then
|
||||
sudo /usr/bin/sv "$CMD" "$NGINX_INIT_NAME"
|
||||
elif [[ -x "$systemctl_path" ]]; then
|
||||
sudo "$systemctl_path" "$CMD" "$NGINX_INIT_NAME"
|
||||
elif [[ -x /usr/bin/sv ]]; then
|
||||
sudo /usr/bin/sv "$CMD" "$NGINX_INIT_NAME"
|
||||
|
||||
Reference in New Issue
Block a user