Skip to content

Commit

Permalink
--init=runit: create dbus service if missing.
Browse files Browse the repository at this point in the history
docker commit: Throw error if running a recursive image created from x11docker container #146
  • Loading branch information
mviereck committed Apr 10, 2019
1 parent e56592d commit acfe7a4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
41 changes: 33 additions & 8 deletions x11docker
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
;;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit acfe7a4

Please sign in to comment.