From acfe7a4900322cbf92b3a4920fd22ac23e039c43 Mon Sep 17 00:00:00 2001 From: mviereck Date: Wed, 10 Apr 2019 20:35:14 +0200 Subject: [PATCH] --init=runit: create dbus service if missing. docker commit: Throw error if running a recursive image created from x11docker container #146 --- CHANGELOG.md | 7 +++++++ x11docker | 41 +++++++++++++++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13673588..593ef3bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Project website: https://github.com/mviereck/x11docker +## [Unreleased] +### Fixed + - `--init=runit`: Create DBus service files if missing. + - `docker commit`: Throw error if running a recursive image created from + an x11docker container with `docker commit`. + [(#146)](https://github.com/mviereck/x11docker/issues/146) + ## [5.5.2](https://github.com/mviereck/x11docker/releases/tag/v5.5.2) - 2019-04-08 ### Added - `--init=s6-overlay`: Support of init system `s6` as given by `s6-overlay`. diff --git a/x11docker b/x11docker index 6a3252d7..5b2cd8d5 100755 --- a/x11docker +++ b/x11docker @@ -4064,6 +4064,9 @@ create_dockerrc() { # create dockerrc: This script runs as root (or echo " Imagecommand=\"\${Imagecommand#[}\"" echo " Imagecommand=\"\${Imagecommand%]}\"" echo " Imagecommand=\"\${Imagecommand#/bin/sh -c }\"" + echo " echo \"\$Imagecommand\" | grep -q /x11docker/container.CMD.sh && error 'Recursion error: Found CMD /x11docker/container.CMD.sh in image. + Did you use docker commit with an x11docker container? + Please build new images instead of using docker commit.'" echo "}" echo "# check USER" @@ -4637,8 +4640,8 @@ echo 'x11docker WARNING: /sbin/agetty not found. --interactive not possible.' echo "systemctl enable console-getty.service" echo "systemctl enable x11docker-journal.service" - echo "# to be sure, allow/unmask most important services" - echo "systemctl unmask systemd-logind dbus" + echo "systemctl unmask systemd-logind" + echo "systemctl enable systemd-logind" echo "# disable cgproxy.service, can cause failing startup." echo "systemctl mask cgproxy" echo "# disable useless plymouth" @@ -4650,7 +4653,6 @@ echo 'x11docker WARNING: /sbin/agetty not found. --interactive not possible.' ;; runit) 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 /etc/runit/1.d" @@ -4688,9 +4690,6 @@ halt 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" echo "[ -e /etc/runit/1 ] || echo '#!/usr/bin/env sh set -eu @@ -4738,8 +4737,6 @@ start() { \" > /etc/init.d/x11docker.service" echo "chmod +x /etc/init.d/x11docker.service" echo "rc-update add x11docker.service default" - echo "verbose 'DBus: enabling dbus service'" - echo "rc-update add dbus default" echo "# tell openrc that it runs in docker" echo "sed -e 's/#rc_sys=\"\"/rc_sys=\"docker\"/g' -i /etc/rc.conf" ;; @@ -4890,6 +4887,34 @@ exit 0\" >> /etc/rc.local" /org/freedesktop/DBus \ org.freedesktop.DBus.ListNames)\"" ;; + systemd) + echo "systemctl unmask dbus" + echo "systemctl enable dbus" + ;; + openrc) + echo "verbose 'DBus: enabling dbus service'" + echo "rc-update add dbus default" + echo "[ -e /etc/init.d/dbus ] || note 'Did not find service file /etc/init.d/dbus'" + ;; + sysvinit) + echo "[ -e /etc/init.d/dbus ] || note 'Did not find service file /etc/init.d/dbus'" + ;; + runit) + echo "command -v dbus-daemon && {" + echo " [ -e /etc/sv/dbus ] || {" + echo " mkdir -p /etc/sv/dbus" + echo " echo '#!/bin/sh +[ ! -d /run/dbus ] && install -m755 -g 22 -o 22 -d /run/dbus +exec dbus-daemon --system --nofork --nopidfile' >/etc/sv/dbus/run" + echo " echo '#!/bin/sh +exec dbus-send --system / org.freedesktop.DBus.Peer.Ping > /dev/null 2> /dev/null' >/etc/sv/dbus/check" + echo " chmod +x /etc/sv/dbus/run /etc/sv/dbus/check" + echo " }" + echo " verbose 'DBus: enabling dbus service'" + echo " ln -s /etc/sv/dbus /etc/runit/runsvdir/default" # void + echo " ln -s /etc/sv/dbus /service" # alpine + echo "}" + ;; esac # --lang: language locale