Skip to content

Commit

Permalink
--init=runit: fix for alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
mviereck committed Apr 6, 2019
1 parent 2e91abc commit 0314603
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions x11docker
Original file line number Diff line number Diff line change
Expand Up @@ -4616,12 +4616,15 @@ create_containerrootrc() { # create container root setup script: This scrip
# Additionally, su triggers logind and elogind.
# Issue: shell has no job control in --interactive mode.
chmod +x $Cshare/container.CMD.sh
exec su - --shell /bin/sh \$Containeruser $Cshare/container.CMD.sh
exec su - -s /bin/sh \$Containeruser $Cshare/container.CMD.sh
\" >/usr/local/bin/x11docker-login"
echo "chmod +x /usr/local/bin/x11docker-login"

echo "echo \"#! /bin/sh
exec setsid agetty -a \$Containeruser -l /usr/local/bin/x11docker-login console
[ -e /sbin/agetty ] && exec setsid agetty -a \$Containeruser -l /usr/local/bin/x11docker-login console
#getty 0 -l /usr/local/bin/x11docker-login console
echo 'x11docker WARNING: /sbin/agetty not found. --interactive not possible.'
/usr/local/bin/x11docker-login
\" >/usr/local/bin/x11docker-agetty"
echo "chmod +x /usr/local/bin/x11docker-agetty"
}
Expand Down Expand Up @@ -4650,7 +4653,8 @@ exec setsid agetty -a \$Containeruser -l /usr/local/bin/x11docker-login console
echo "# create and enable x11docker service containing image command"
#echo "echo 'FAKE_SHELL /bin/bash' >> /etc/login.defs"
echo "mkdir -p /etc/sv/x11docker"

echo "mkdir -p /etc/runit/runsvdir/default"
echo "mkdir -p /service"
echo "echo \"#! /bin/sh
waitforservice() {
Service=\\\$1
Expand Down Expand Up @@ -4681,9 +4685,11 @@ shutdown -h 0
halt
\" > /etc/sv/x11docker/finish"
echo "chmod +x /etc/sv/x11docker/finish"
echo "ln -s /etc/sv/x11docker /etc/runit/runsvdir/default"
echo "ln -s /etc/sv/x11docker /etc/runit/runsvdir/default" #void
echo "ln -s /etc/sv/x11docker /service" #alpine
echo "verbose 'DBus: enabling dbus service'"
echo "ln -s /etc/sv/dbus /etc/runit/runsvdir/default"
echo "ln -s /etc/sv/dbus /service"
;;
openrc)
echo "# create and enable x11docker service containing image command"
Expand Down Expand Up @@ -4922,7 +4928,7 @@ exit 0\" >> /etc/rc.local"
[ "$Sharecgroup" = "yes" ] && echo '[ "$Loginservice" ] && Exec='
echo "\$Exec /bin/su - -s /bin/sh \$Containeruser $Cshare/container.CMD.sh"
;;
runit|openrc|sysvinit)
openrc|sysvinit)
echo "{
read Dummy <$Cshare/timetosaygoodbye.fifo
echo timetosaygoodbye >$Cshare/timetosaygoodbye.fifo
Expand All @@ -4932,6 +4938,16 @@ exit 0\" >> /etc/rc.local"
} &"
echo "exec /sbin/init"
;;
runit)
echo "{
read Dummy <$Cshare/timetosaygoodbye.fifo
echo timetosaygoodbye >$Cshare/timetosaygoodbye.fifo
echo 'x11docker: $Initsystem shutdown now'
shutdown now
halt
} &"
echo "[ -e /sbin/runit-init ] && exec runit-init || exec /sbin/init"
;;
s6-overlay)
echo "exec /init /usr/local/bin/x11docker-login"
;;
Expand Down Expand Up @@ -7078,7 +7094,8 @@ todo() {
# BUG: x11docker/xwayland in a nested setup: where is the X socket ??

# FIXME: myrealpath()
# FIXME: check docker version. 1.16.2 does not support --rm --detach
# FIXME: check docker version. 1.16.2 does not support --rm --detach
# FIXME: --interactive+--init on alpine fails, no agetty

# --init
# autodetect init system if possible, give a note.
Expand Down

0 comments on commit 0314603

Please sign in to comment.