diff --git a/x11docker b/x11docker index e7dfb898..a90cffe2 100755 --- a/x11docker +++ b/x11docker @@ -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" } @@ -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 @@ -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" @@ -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 @@ -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" ;; @@ -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.