Commit dc21287c by dlezcano

Complete use of autoconf prefix in lxc-debian

From: Matt Helsley <matthltc@us.ibm.com> The lxc-debian script does not consistently address the lxc lock as @LOCALSTATEDIR@/lock/subsys/lxc. Make consistent use of the autotools substitution to completely enable configure --prefixes. I also added a comment explaining why some of the paths didn't need autoconf substitutions for anyone who wants to understand the script. Also, to separate it from the container contents proper, I moved the CACHE variable initialization above the container-internal path variables. Signed-off-by: 's avatarMatt Helsley <matthltc@us.ibm.com> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 79cf945c
#!/bin/bash #!/bin/bash
# set -ex # set -ex
CACHE="@LOCALSTATEDIR@/cache/lxc/debian"
NAME="debian" NAME="debian"
CONFFILE="lxc.conf" CONFFILE="lxc.conf"
MNTFILE="mount.conf" MNTFILE="mount.conf"
UTSNAME= UTSNAME=
IPV4="172.20.0.21" IPV4="172.20.0.21"
GATEWAY="172.20.0.1" GATEWAY="172.20.0.1"
# These paths are within the container so do not need to obey configure prefixes
INTERFACES="/etc/network/interfaces" INTERFACES="/etc/network/interfaces"
INITTAB="/etc/inittab" INITTAB="/etc/inittab"
HOSTNAME="/etc/hostname" HOSTNAME="/etc/hostname"
FSTAB="/etc/fstab" FSTAB="/etc/fstab"
SSHD_CONFIG="/etc/ssh/sshd_config" SSHD_CONFIG="/etc/ssh/sshd_config"
CACHE="@LOCALSTATEDIR@/cache/lxc/debian"
################################################################################ ################################################################################
# debian custom configuration files # debian custom configuration files
...@@ -186,9 +189,11 @@ create() { ...@@ -186,9 +189,11 @@ create() {
# check if the rootfs does already exist # check if the rootfs does already exist
if [ ! -e "$ROOTFS" ]; then if [ ! -e "$ROOTFS" ]; then
mkdir -p @LOCALSTATEDIR@/lock/subsys/
( (
flock -n -x 200 flock -n -x 200
RES=$? RES=$?
if [ "$RES" != "0" ]; then if [ "$RES" != "0" ]; then
echo "Cache repository is busy." echo "Cache repository is busy."
...@@ -228,7 +233,7 @@ create() { ...@@ -228,7 +233,7 @@ create() {
# make a local copy of the minidebian # make a local copy of the minidebian
echo -n "Copying rootfs ..." echo -n "Copying rootfs ..."
cp -a $CACHE/rootfs-$ARCH $ROOTFS && echo "Done." || exit cp -a $CACHE/rootfs-$ARCH $ROOTFS && echo "Done." || exit
) 200>/var/lock/subsys/lxc ) 200> "@LOCALSTATEDIR@/lock/subsys/lxc"
fi fi
write_lxc_mounts write_lxc_mounts
...@@ -340,7 +345,7 @@ purge() { ...@@ -340,7 +345,7 @@ purge() {
rm --preserve-root --one-file-system -rf $CACHE && echo "Done." || exit 1 rm --preserve-root --one-file-system -rf $CACHE && echo "Done." || exit 1
exit 0 exit 0
) 200>/var/lock/subsys/lxc ) 200> "@LOCALSTATEDIR@/lock/subsys/lxc"
} }
if [ "$(id -u)" != "0" ]; then if [ "$(id -u)" != "0" ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment