Skip to content

Commit

Permalink
We now store /etc/systemd/system and /etc/tmpfiles.d in /usr in build…
Browse files Browse the repository at this point in the history
… time.

Bumping up version to catch attempts to use the new style
(without /etc content) data volumes with older images. The migration
(purging of /etc) happens via the volume-data-autoupdate mechanism.
  • Loading branch information
adelton committed Dec 4, 2015
1 parent a3b473e commit 91b47bd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ ADD systemctl /usr/bin/systemctl
ADD systemctl-socket-daemon /usr/bin/systemctl-socket-daemon

ADD ipa-server-configure-first /usr/sbin/ipa-server-configure-first
ADD ipa-volume-upgrade-0.5-0.6 /usr/sbin/ipa-volume-upgrade-0.5-0.6

RUN chmod -v +x /usr/bin/systemctl /usr/bin/systemctl-socket-daemon /usr/sbin/ipa-server-configure-first
RUN chmod -v +x /usr/bin/systemctl /usr/bin/systemctl-socket-daemon /usr/sbin/ipa-server-configure-first /usr/sbin/ipa-volume-upgrade-0.5-0.6

RUN groupadd -g 389 dirsrv ; useradd -u 389 -g 389 -c 'DS System User' -d '/var/lib/dirsrv' --no-create-home -s '/sbin/nologin' dirsrv
RUN groupadd -g 288 kdcproxy ; useradd -u 288 -g 288 -c 'IPA KDC Proxy User' -d '/var/lib/kdcproxy' -s '/sbin/nologin' kdcproxy
Expand All @@ -32,7 +33,7 @@ RUN sed -i 's!^d /var/log.*!L /var/log - - - - /data/var/log!' /usr/lib/tmpfiles
# Workaround 1286602
RUN mv /usr/lib/tmpfiles.d/journal-nocow.conf /usr/lib/tmpfiles.d/journal-nocow.conf.disabled
RUN mv /data-template/etc/dirsrv/schema /usr/share/dirsrv/schema && ln -s /usr/share/dirsrv/schema /data-template/etc/dirsrv/schema
RUN echo 0.5 > /etc/volume-version
RUN echo 0.6 > /etc/volume-version
RUN uuidgen > /data-template/build-id

EXPOSE 53/udp 53 80 443 389 636 88 464 88/udp 464/udp 123/udp 7389 9443 9444 9445
Expand Down
16 changes: 16 additions & 0 deletions ipa-server-configure-first
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,22 @@ if [ -f /etc/ipa/ca.crt ] ; then
fi
done
fi
if [ -f "/data/volume-version" ] ; then
DATA_VERSION=$(cat /data/volume-version)
IMAGE_VERSION=$(cat /etc/volume-version)
if ! [ "$DATA_VERSION" == "$IMAGE_VERSION" ] ; then
if [ -x /usr/sbin/ipa-volume-upgrade-$DATA_VERSION-$IMAGE_VERSION ] ; then
echo "Migrating data volume version $DATA_VERSION to $IMAGE_VERSION."
if /usr/sbin/ipa-volume-upgrade-$DATA_VERSION-$IMAGE_VERSION ; then
cat /etc/volume-version > /data/volume-version
else
echo "Migration of data volume to version $IMAGE_VERSION failed."
exit 13
fi
fi
fi
fi

systemd-tmpfiles --remove --create

find /run ! -type d | xargs rm -f
Expand Down
6 changes: 6 additions & 0 deletions ipa-volume-upgrade-0.5-0.6
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# The 0.6 image is able to work with 0.5 and it purges
# original /etc contents via volume-data-autoupdate.

exit 0

0 comments on commit 91b47bd

Please sign in to comment.