From 5f5e894233f2ddcc286213be509bb2115c638a69 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 1 Jul 2017 09:29:16 +0200 Subject: Adding upstream version 20170701. Signed-off-by: Daniel Baumann --- CHANGELOG.txt | 9 +++++++++ VERSION.txt | 2 +- lib/container/move | 2 +- lib/container/remove | 25 +++++++++++++++++++++++-- lib/container/stop | 30 ++++++++++++++++++++++++------ share/scripts/debconf | 2 +- 6 files changed, 59 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 96c6c4e..95b0bf4 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,12 @@ +2017-07-01 Daniel Baumann + + * Releasing version 20170701. + + [ Daniel Baumann ] + * Correcting boolean typo when checking for existence of new container in container move command, thanks to Simon Spöhel . + * Avoid removing top-level directories when cleaning up bind mounts in container remove and stop commands. + * Also removing /etc/localtime before reconfiguring tzdata to workaround broken tzdata preseed handling (see several bug reports in the BTS), thanks to Nik Lutz . + 2017-06-29 Daniel Baumann * Releasing version 20170629. diff --git a/VERSION.txt b/VERSION.txt index dd89bfb..454d1fc 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -20170629 +20170701 diff --git a/lib/container/move b/lib/container/move index 4d64c8a..3cc2e40 100755 --- a/lib/container/move +++ b/lib/container/move @@ -89,7 +89,7 @@ then exit 1 fi -if [ ! -e "${MACHINES}/${NEW}" ] +if [ -e "${MACHINES}/${NEW}" ] then echo "'${NEW}': container already exists" >&2 exit 1 diff --git a/lib/container/remove b/lib/container/remove index 1b1ba7d..c9a45a6 100755 --- a/lib/container/remove +++ b/lib/container/remove @@ -76,6 +76,27 @@ Usage () exit 1 } +Rmdir () +{ + DIRECTORIES="${@}" + + for DIRECTORY in ${DIRECTORIES} + do + PARENT_DIRECTORY="/$(echo ${DIRECTORY} | cut -d / -f 2)" + + if [ "${PARENT_DIRECTORY}" != "${DIRECTORY}" ] + then + # the directory is at least two levels down from / + cd "${PARENT_DIRECTORY}" + + CRUFT="$(echo ${DIRECTORY} | cut -d / -f 3-)" + rmdir --ignore-fail-on-non-empty --parents "${CRUFT}" > /dev/null 2>&1 || true + + cd "${OLDPWD}" + fi + done +} + Parameters "${@}" if [ -z "${NAME}" ] @@ -152,7 +173,7 @@ then do DIRECTORY="$(echo ${BIND} | awk -F: '{ print $1 }')" - rmdir --ignore-fail-on-non-empty --parents ${DIRECTORY} > /dev/null 2>&1 || true + Rmdir "${DIRECTORY}" done fi @@ -167,7 +188,7 @@ then do DIRECTORY="$(echo ${BIND_RO} | awk -F: '{ print $1 }')" - rmdir --ignore-fail-on-non-empty --parents ${DIRECTORY} > /dev/null 2>&1 || true + Rmdir "${DIRECTORY}" done fi fi diff --git a/lib/container/stop b/lib/container/stop index 359a136..12cf7fa 100755 --- a/lib/container/stop +++ b/lib/container/stop @@ -78,6 +78,27 @@ Usage () exit 1 } +Rmdir () +{ + DIRECTORIES="${@}" + + for DIRECTORY in ${DIRECTORIES} + do + PARENT_DIRECTORY="/$(echo ${DIRECTORY} | cut -d / -f 2)" + + if [ "${PARENT_DIRECTORY}" != "${DIRECTORY}" ] + then + # the directory is at least two levels down from / + cd "${PARENT_DIRECTORY}" + + CRUFT="$(echo ${DIRECTORY} | cut -d / -f 3-)" + rmdir --ignore-fail-on-non-empty --parents "${CRUFT}" > /dev/null 2>&1 || true + + cd "${OLDPWD}" + fi + done +} + Parameters "${@}" if [ -z "${NAME}" ] @@ -120,10 +141,7 @@ case "${CLEAN}" in 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 + Rmdir "${DIRECTORY_LOWER}" "${DIRECTORY_UPPER}" "${DIRECTORY_WORK}" "${DIRECTORY_MERGED}" done fi @@ -138,7 +156,7 @@ case "${CLEAN}" in do DIRECTORY="$(echo ${BIND} | awk -F: '{ print $1 }')" - rmdir --ignore-fail-on-non-empty --parents ${DIRECTORY} > /dev/null 2>&1 || true + Rmdir "${DIRECTORY}" done fi @@ -153,7 +171,7 @@ case "${CLEAN}" in do DIRECTORY="$(echo ${BIND_RO} | awk -F: '{ print $1 }')" - rmdir --ignore-fail-on-non-empty --parents ${DIRECTORY} > /dev/null 2>&1 || true + Rmdir "${DIRECTORY}" done fi diff --git a/share/scripts/debconf b/share/scripts/debconf index 5441acc..38bf937 100755 --- a/share/scripts/debconf +++ b/share/scripts/debconf @@ -663,7 +663,7 @@ EOF do if grep -qs tzdata "${FILE}" then - rm -f "${DIRECTORY}/etc/timezone" + rm -f "${DIRECTORY}/etc/localtime" "${DIRECTORY}/etc/timezone" Chroot "${DIRECTORY}" "DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=criticial dpkg-reconfigure tzdata" break -- cgit v1.2.3