Skip to content

Commit

Permalink
Merge pull request #618 from makinacorpus/master
Browse files Browse the repository at this point in the history
stable
  • Loading branch information
kiorky committed Jun 24, 2015
2 parents 0fbb481 + 6c2237c commit 103928e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
19 changes: 12 additions & 7 deletions docker/stage1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# THIS SCRIPT CAN BE OVERRIDEN IN ANY MAKINA-STATES BASED IMAGES
# Copy/Edit it inside the overrides directory either:
# - inside you image data directory, inside the image_roots/bootstrap_scripts
# - inside your corpus based repository, inside the .salt folder
# - inside your corpus based repository, inside the .salt folder

RED='\e[31;01m'
PURPLE='\e[33;01m'
Expand Down Expand Up @@ -91,13 +91,15 @@ if [ "x${MS_OS}" = "xubuntu" ];then
etc/systemd/system/lxc-setup.service\
etc/apt/apt.conf.d/99clean\
usr/bin/ms-lxc-setup.sh\
sbin/lxc-cleanup.sh
sbin/lxc-cleanup.sh\
sbin/makinastates-snapshot.sh
die_in_error "${MS_IMAGE}: cant tar aptconf"
add="${add} ubuntufiles.tar"
fi
if [ "x${add}" != "x" ];then a_d "ADD ${add} /";fi
# install core pkgs & be sure to have up to date systemd on ubuntu systemd enabled
a_d "RUN \
a_d "RUN \\
set -x &&\\
echo DOCKERFILE_ID=3\\
&& if which apt-get >/dev/null 2>&1;then\\
sed -i -re\
Expand All @@ -113,20 +115,23 @@ a_d "RUN \
then apt-get install -y --force-yes\\
systemd libpam-systemd systemd-sysv libsystemd0;fi;\\
fi\\
&& /docker/injected_volumes/bootstrap_scripts/lxc-cleanup.sh\\
&& /docker/injected_volumes/bootstrap_scripts/makinastates-snapshot.sh\\
&& chmod 755 /sbin/lxc-cleanup.sh /usr/bin/ms-lxc-setup.sh\
/sbin/makinastates-snapshot.sh\\
&& sleep 0.4\\
&& /sbin/lxc-cleanup.sh\\
&& sed -i -re \"s/PrivDropToUser.*/PrivDropToUser root/g\"\
/etc/rsyslog.conf\\
&& sed -i -re \"s/PrivDropToGroup*/PrivDropToGroup root/g\"\
/etc/rsyslog.conf\\
&& chmod 755 /sbin/lxc-cleanup.sh /usr/bin/ms-lxc-setup.sh\\
&& if test -e /lib/systemd/systemd;then\\
if ! test -e /etc/systemd/system/network-online.target.wants;then\\
mkdir -pv /etc/systemd/system/network-online.target.wants;\\
fi;\\
ln -sf /etc/systemd/system/lxc-setup.service\\
/etc/systemd/system/network-online.target.wants/lxc-setup.service;\\
fi"
fi\
&& /sbin/makinastates-snapshot.sh
"
a_d "CMD /docker/injected_volumes/bootstrap_scripts/stage2.sh"
BUILDKEY=""
BUILDKEY="${BUILDKEY}_$(md5sum\
Expand Down
29 changes: 27 additions & 2 deletions docker/stage2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# THIS SCRIPT CAN BE OVERRIDEN IN ANY MAKINA-STATES BASED IMAGES
# Copy/Edit it inside the overrides directory either:
# - inside you image data directory, inside the image_roots/bootstrap_scripts
# - inside your corpus based repository, inside the .salt folder
# - inside your corpus based repository, inside the .salt folder

RED='\e[31;01m'
CYAN='\e[36;01m'
Expand Down Expand Up @@ -62,7 +62,32 @@ if [ -e /lib/lsb/init-functions.d/40-systemd ];then
fi
fi
if echo "${MS_COMMAND}" | grep -q "systemd";then
# dbus will need the directory to start
if [ ! -d /run/systemd/system/ ];then
mkdir /run/systemd/system/
fi
systemdstarted=""
( systemd --system& )
for i in $(seq 240);do
state=$(systemctl is-system-running)
if [ "x${state}" = "xdegraded" ] || [ "x${state}" = "xrunning" ];then
systemdstarted=""
break
else
if [ $i -gt 5 ];then
# dbus is flaky on trusty host / vivid container, this is an ugly workaround
systemctl stop dbus
sleep 0.5
ps aux|grep dbus|awk '{print $2}'|xargs kill -9
systemctl start dbus
sleep 2
fi
fi
sleep 1
done
if [ "x${systemdstarted}" = "x" ];then
die_in_error "${MS_IMAGE}: systemd failed starting up"
fi
fi
export DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -107,7 +132,7 @@ else
${bs} -C -b "${MS_GIT_BRANCH}" --mastersalt 127.0.0.1 -n dockercontainer\
--local-mastersalt-mode masterless --local-salt-mode masterless
# when debugging installation boot, this make a breakpoint here.
# for i in $(seq 30000);do echo $i;sleep 60;done
for i in $(seq 30000);do echo $i;sleep 60;done
die_in_error "${MS_IMAGE}: failed installing makina-states"
fi
# if image root is a corpus based project, we push the code inside the image and
Expand Down
1 change: 1 addition & 0 deletions files/sbin/lxc-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ if [ "x${is_docker}" != "x" ];then
done
fi
for s in\
tmp.mount\
sys-kernel-config.mount\
multi-user.target.wants/systemd-ask-password-wall.path\
systemd-journald-audit.socket\
Expand Down

0 comments on commit 103928e

Please sign in to comment.