summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-04-13 04:08:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-04-13 04:09:05 +0000
commitd1c64a4910a6e7639da362d0a0d7991c211c1b68 (patch)
tree517cac514adcfbb441f7bb4cf4a06af063c837e3 /share
parentReleasing debian version 20190319-1. (diff)
downloadopen-infrastructure-compute-tools-d1c64a4910a6e7639da362d0a0d7991c211c1b68.tar.xz
open-infrastructure-compute-tools-d1c64a4910a6e7639da362d0a0d7991c211c1b68.zip
Merging upstream version 20190413.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'share')
-rw-r--r--share/bash-completion/container1
-rwxr-xr-xshare/scripts/debconf231
2 files changed, 128 insertions, 104 deletions
diff --git a/share/bash-completion/container b/share/bash-completion/container
index e130710..d791ff6 100644
--- a/share/bash-completion/container
+++ b/share/bash-completion/container
@@ -102,6 +102,7 @@ _container()
opts="-a --add -l --list -r --remove"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
+ ;;
limit)
case "${prev}" in
diff --git a/share/scripts/debconf b/share/scripts/debconf
index 46f0381..b4b5e18 100755
--- a/share/scripts/debconf
+++ b/share/scripts/debconf
@@ -126,6 +126,124 @@ then
exit 1
fi
+Start ()
+{
+ # Mounting rw bind mounts
+ if [ -n "${BIND}" ]
+ then
+ BINDS="$(echo ${BIND} | sed -e 's|;| |g')"
+
+ for ENTRY in ${BINDS}
+ do
+ SOURCE="$(echo ${ENTRY} | awk -F: '{ print $1 }')"
+ TARGET="$(echo ${ENTRY} | awk -F: '{ print $2 }')"
+
+ mkdir -p "${SOURCE}"
+ mkdir -p "${MACHINES}/${NAME}/${TARGET}"
+
+ mount -o bind "${SOURCE}" "${MACHINES}/${NAME}/${TARGET}"
+ done
+ fi
+
+ # Mounting ro bind mounts
+ if [ -n "${BIND_RO}" ]
+ then
+ BINDS_RO="$(echo ${BIND_RO} | sed -e 's|;| |g')"
+
+ for ENTRY in ${BINDS_RO}
+ do
+ SOURCE="$(echo ${ENTRY} | awk -F: '{ print $1 }')"
+ TARGET="$(echo ${ENTRY} | awk -F: '{ print $2 }')"
+
+ mkdir -p "${SOURCE}"
+ mkdir -p "${MACHINES}/${NAME}/${TARGET}"
+
+ mount -o rbind "${SOURCE}" "${MACHINES}/${NAME}/${TARGET}"
+ done
+ fi
+
+ # Mounting overlay mounts
+ if [ -n "${CNT_OVERLAY}" ]
+ then
+ CNT_OVERLAYS="$(echo ${CNT_OVERLAY} | sed -e 's|;| |g')"
+
+ for CNT_OVERLAY in ${CNT_OVERLAYS}
+ do
+ DIRECTORY_LOWER="$(echo ${CNT_OVERLAY} | awk -F: '{ print $1 }')"
+ DIRECTORY_UPPER="$(echo ${CNT_OVERLAY} | awk -F: '{ print $2 }')"
+ DIRECTORY_WORK="$(echo ${CNT_OVERLAY} | awk -F: '{ print $3 }')"
+ DIRECTORY_MERGED="$(echo ${CNT_OVERLAY} | awk -F: '{ print $4 }')"
+
+ for DIRECTORY in "${DIRECTORY_LOWER}" "${DIRECTORY_UPPER}" "${DIRECTORY_WORK}" "${DIRECTORY_MERGED}"
+ do
+ mkdir -p "${DIRECTORY}"
+ done
+
+ mount -t overlay overlay-${NAME} -olowerdir="${DIRECTORY_LOWER}",upperdir="${DIRECTORY_UPPER}",workdir="${DIRECTORY_WORK}" "${DIRECTORY_MERGED}"
+ done
+ fi
+
+ # Trap function
+ trap 'Stop' EXIT HUP INT QUIT TERM
+}
+
+Stop ()
+{
+ # Unmounting overlay mounts
+ if [ -n "${CNT_OVERLAY}" ]
+ then
+ CNT_OVERLAYS="$(echo ${CNT_OVERLAY} | sed -e 's|;| |g')"
+
+ for CNT_OVERLAY in ${CNT_OVERLAYS}
+ do
+ DIRECTORY_LOWER="$(echo ${CNT_OVERLAY} | awk -F: '{ print $1 }')"
+ DIRECTORY_UPPER="$(echo ${CNT_OVERLAY} | awk -F: '{ print $2 }')"
+ DIRECTORY_WORK="$(echo ${CNT_OVERLAY} | awk -F: '{ print $3 }')"
+ DIRECTORY_MERGED="$(echo ${CNT_OVERLAY} | awk -F: '{ print $4 }')"
+
+ umount -f "${DIRECTORY_MERGED}" > /dev/null 2>&1 || true
+
+ for DIRECTORY in "${DIRECTORY_LOWER}" "${DIRECTORY_UPPER}" "${DIRECTORY_WORK}" "${DIRECTORY_MERGED}"
+ do
+ rmdir --ignore-fail-on-non-empty --parents ${DIRECTORY} > /dev/null 2>&1 || true
+ done
+ done
+ fi
+
+ # Unmounting ro bind mounts
+ if [ -n "${BIND_RO}" ]
+ then
+ # unmount in reverse order to allow nested bind mounts
+ BINDS_RO="$(echo ${BIND_RO} | sed -e 's|;| |g' | awk '{ for (i=NF; i>=1; i--) printf "%s ", $i; print ""}')"
+
+ for ENTRY in ${BINDS_RO}
+ do
+ TARGET="$(echo ${ENTRY} | awk -F: '{ print $2 }')"
+
+ umount -f "${MACHINES}/${NAME}/${TARGET}" > /dev/null 2>&1 || true
+ done
+ fi
+
+ # Unmounting rw bind mounts
+ if [ -n "${BIND}" ]
+ then
+ # unmount in reverse order to allow nested bind mounts
+ BINDS="$(echo ${BIND} | sed -e 's|;| |g' | awk '{ for (i=NF; i>=1; i--) printf "%s ", $i; print ""}')"
+
+ for ENTRY in ${BINDS}
+ do
+ TARGET="$(echo ${ENTRY} | awk -F: '{ print $2 }')"
+
+ umount -f "${MACHINES}/${NAME}/${TARGET}" > /dev/null 2>&1 || true
+ done
+ fi
+
+ # Unmounting pseudo-filesystems
+ umount -f "${DIRECTORY}/dev/pts" > /dev/null 2>&1 || true
+ umount -f "${DIRECTORY}/proc" > /dev/null 2>&1 || true
+ umount -f "${DIRECTORY}/sys" > /dev/null 2>&1 || true
+}
+
Chroot ()
{
CHROOT="${1}"
@@ -187,9 +305,9 @@ Cleanup_system ()
rm -f "${DIRECTORY}/usr/sbin/policy-rc.d"
# Unmount pseudo-filesystems
- umount "${DIRECTORY}/dev/pts"
- umount "${DIRECTORY}/proc"
- umount "${DIRECTORY}/sys"
+ umount -f "${DIRECTORY}/dev/pts" > /dev/null 2>&1 || true
+ umount -f "${DIRECTORY}/proc" > /dev/null 2>&1 || true
+ umount -f "${DIRECTORY}/sys" > /dev/null 2>&1 || true
}
Debconf ()
@@ -240,6 +358,9 @@ Debootstrap ()
EXCLUDE="ifupdown"
INCLUDE="dbus"
+ # apt repositories
+ INCLUDE="${INCLUDE} gnupg"
+
if ( echo "${MIRROR}" | grep -qs '^https' ) || \
( echo "${PARENT_MIRROR}" | grep -qs '^https' )
then
@@ -824,7 +945,7 @@ EOF
cat >> "${DIRECTORY}/etc/systemd/network/eno${NUMBER}.network" << EOF
DHCP=no
-Ipv6AcceptRA=no
+IPv6AcceptRA=no
Address=${IPV6_ADDRESS}/${IPV6_NETMASK}
EOF
@@ -1008,60 +1129,7 @@ Cleanup_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}"
mkdir -p "${MACHINES}"
cp -a "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" "${MACHINES}/${NAME}"
-# Mounting rw bind mounts
-if [ -n "${BIND}" ]
-then
- BINDS="$(echo ${BIND} | sed -e 's|;| |g')"
-
- for ENTRY in ${BINDS}
- do
- SOURCE="$(echo ${ENTRY} | awk -F: '{ print $1 }')"
- TARGET="$(echo ${ENTRY} | awk -F: '{ print $2 }')"
-
- mkdir -p "${SOURCE}"
- mkdir -p "${MACHINES}/${NAME}/${TARGET}"
-
- mount -o bind "${SOURCE}" "${MACHINES}/${NAME}/${TARGET}"
- done
-fi
-
-# Mounting ro bind mounts
-if [ -n "${BIND_RO}" ]
-then
- BINDS_RO="$(echo ${BIND_RO} | sed -e 's|;| |g')"
-
- for ENTRY in ${BINDS_RO}
- do
- SOURCE="$(echo ${ENTRY} | awk -F: '{ print $1 }')"
- TARGET="$(echo ${ENTRY} | awk -F: '{ print $2 }')"
-
- mkdir -p "${SOURCE}"
- mkdir -p "${MACHINES}/${NAME}/${TARGET}"
-
- mount -o rbind "${SOURCE}" "${MACHINES}/${NAME}/${TARGET}"
- done
-fi
-
-# Mounting overlay mounts
-if [ -n "${CNT_OVERLAY}" ]
-then
- CNT_OVERLAYS="$(echo ${CNT_OVERLAY} | sed -e 's|;| |g')"
-
- for CNT_OVERLAY in ${CNT_OVERLAYS}
- do
- DIRECTORY_LOWER="$(echo ${CNT_OVERLAY} | awk -F: '{ print $1 }')"
- DIRECTORY_UPPER="$(echo ${CNT_OVERLAY} | awk -F: '{ print $2 }')"
- DIRECTORY_WORK="$(echo ${CNT_OVERLAY} | awk -F: '{ print $3 }')"
- DIRECTORY_MERGED="$(echo ${CNT_OVERLAY} | awk -F: '{ print $4 }')"
-
- for DIRECTORY in "${DIRECTORY_LOWER}" "${DIRECTORY_UPPER}" "${DIRECTORY_WORK}" "${DIRECTORY_MERGED}"
- do
- mkdir -p "${DIRECTORY}"
- done
-
- mount -t overlay overlay-${NAME} -olowerdir="${DIRECTORY_LOWER}",upperdir="${DIRECTORY_UPPER}",workdir="${DIRECTORY_WORK}" "${DIRECTORY_MERGED}"
- done
-fi
+Start
Configure_system "${MACHINES}/${NAME}"
Configure_network "${MACHINES}/${NAME}"
@@ -1070,52 +1138,7 @@ Cleanup_system "${MACHINES}/${NAME}"
Commands "${MACHINES}/${NAME}"
-# Unmounting overlay mounts
-if [ -n "${CNT_OVERLAY}" ]
-then
- CNT_OVERLAYS="$(echo ${CNT_OVERLAY} | sed -e 's|;| |g')"
-
- for CNT_OVERLAY in ${CNT_OVERLAYS}
- do
- DIRECTORY_LOWER="$(echo ${CNT_OVERLAY} | awk -F: '{ print $1 }')"
- DIRECTORY_UPPER="$(echo ${CNT_OVERLAY} | awk -F: '{ print $2 }')"
- DIRECTORY_WORK="$(echo ${CNT_OVERLAY} | awk -F: '{ print $3 }')"
- DIRECTORY_MERGED="$(echo ${CNT_OVERLAY} | awk -F: '{ print $4 }')"
-
- umount -f "${DIRECTORY_MERGED}"
-
- for DIRECTORY in "${DIRECTORY_LOWER}" "${DIRECTORY_UPPER}" "${DIRECTORY_WORK}" "${DIRECTORY_MERGED}"
- do
- rmdir --ignore-fail-on-non-empty --parents ${DIRECTORY} > /dev/null 2>&1 || true
- done
- done
-fi
-
-# Unmounting ro bind mounts
-if [ -n "${BIND_RO}" ]
-then
- BINDS_RO="$(echo ${BIND_RO} | sed -e 's|;| |g')"
-
- for ENTRY in ${BINDS_RO}
- do
- TARGET="$(echo ${ENTRY} | awk -F: '{ print $2 }')"
-
- umount "${MACHINES}/${NAME}/${TARGET}"
- done
-fi
-
-# Unmounting rw bind mounts
-if [ -n "${BIND}" ]
-then
- BINDS="$(echo ${BIND} | sed -e 's|;| |g')"
-
- for ENTRY in ${BINDS}
- do
- TARGET="$(echo ${ENTRY} | awk -F: '{ print $2 }')"
-
- umount "${MACHINES}/${NAME}/${TARGET}"
- done
-fi
+Stop
# remove debconf temporary files
rm --preserve-root --one-file-system -rf "${DEBCONF_TMPDIR}"