Skip to content

Commit

Permalink
--init=runit: fixes for debian runit container
Browse files Browse the repository at this point in the history
  • Loading branch information
mviereck committed Apr 6, 2019
1 parent a47e4f8 commit 2e91abc
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions x11docker
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ $(pspid $Pid)"
# backup of logfile in $Cachebasedir
[ -e "$Logfile" ] && {
[ "$Verbose" = "yes" ] && sleep 1
rmcr $Logfile
$Mksu "cp '$Logfile' '$Logbackup'"
$Mksu "rmcr '$Logbackup'"
}

# close additional file descriptors
Expand Down Expand Up @@ -4177,7 +4177,7 @@ create_dockerrc() { # create dockerrc: This script runs as root (or
echo "while read -r Line; do"
echo " echo export \$(escapestring \"\$Line\") >> $Imagecommandscript"
echo "done < <($Dockerexe run --rm --entrypoint env $Imagename env 2>>$Containerlogfile| rmcr)"
echo "rmcr '$Containerlogfile'"
#echo "rmcr '$Containerlogfile'"
echo "IFS=$' \t\n'"
echo ""
}
Expand Down Expand Up @@ -4346,7 +4346,7 @@ create_dockerrc() { # create dockerrc: This script runs as root (or
echo ""
echo "verbose -d \"Container ID: \$Containerid\""
echo "[ \"\$Containerid\" ] || {
rmcr '$Containerlogfile'
#rmcr '$Containerlogfile'
error \"Startup of docker failed. Did not receive a container ID.
Last lines of container log:
Expand Down Expand Up @@ -4622,7 +4622,6 @@ exec su - --shell /bin/sh \$Containeruser $Cshare/container.CMD.sh

echo "echo \"#! /bin/sh
exec setsid agetty -a \$Containeruser -l /usr/local/bin/x11docker-login console
#agetty console ### no job control in shell even with /bin/login? WTF?
\" >/usr/local/bin/x11docker-agetty"
echo "chmod +x /usr/local/bin/x11docker-agetty"
}
Expand Down Expand Up @@ -4651,6 +4650,7 @@ 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 "echo \"#! /bin/sh
waitforservice() {
Service=\\\$1
Expand All @@ -4664,15 +4664,21 @@ waitforservice() {
# make stderr visible
exec 2>&1
# wait for all other services
echo 'Content of /etc/runit/runsvdir/default:'
ls -la /etc/runit/runsvdir/default/*
for Service in /etc/runit/runsvdir/default/* ; do waitforservice \\\$Service ;done
echo 'Current status of runit services:'
for Service in /etc/runit/runsvdir/default/* ; do sv status \\\$Service ;done
/usr/local/bin/x11docker-agetty
\" > /etc/sv/x11docker/run"
echo "chmod +x /etc/sv/x11docker/run"

echo "echo \"#! /bin/sh
sv down x11docker
runit-init 0
init 0
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"
Expand Down Expand Up @@ -6925,7 +6931,7 @@ main() {
x11docker version: $Version
docker version: $($Dockerexe --version 2>&1)
Host system: $(source /etc/os-release 2>/dev/null; echo "${PRETTY_NAME:-$Hostsystem}")
Command: $0 $(for Line in "$@"; do echo -n "'$Line' " ; done)
Command: '$0' $(for Line in "$@"; do echo -n "'$Line' " ; done)
Parsed options: $Parsedoptions"

# check host, create cache
Expand Down

0 comments on commit 2e91abc

Please sign in to comment.