diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2016-06-01 13:56:36 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2016-06-01 13:56:36 +0000 |
commit | ac9d7da1d6f69a0a6fbb8e3729a24b9fa775f923 (patch) | |
tree | 38a95003274e9ae485abef49d36501d078fe0bf4 | |
parent | Adding upstream version 20160515. (diff) | |
download | open-infrastructure-compute-tools-ac9d7da1d6f69a0a6fbb8e3729a24b9fa775f923.tar.xz open-infrastructure-compute-tools-ac9d7da1d6f69a0a6fbb8e3729a24b9fa775f923.zip |
Adding upstream version 20160601.upstream/20160601
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
-rw-r--r-- | CHANGELOG.txt | 16 | ||||
-rw-r--r-- | VERSION.txt | 2 | ||||
-rwxr-xr-x | lib/container/create | 31 | ||||
-rwxr-xr-x | lib/container/remove | 2 | ||||
-rwxr-xr-x | lib/container/stop | 17 | ||||
-rw-r--r-- | share/doc/examples/cairon-backports.cfg | 2 | ||||
-rw-r--r-- | share/man/container-auto.1.txt | 4 | ||||
-rw-r--r-- | share/man/container-console.1.txt | 4 | ||||
-rw-r--r-- | share/man/container-create-debconf.1.txt | 4 | ||||
-rw-r--r-- | share/man/container-create-debootstrap.1.txt | 4 | ||||
-rw-r--r-- | share/man/container-create.1.txt | 8 | ||||
-rw-r--r-- | share/man/container-limit.1.txt | 4 | ||||
-rw-r--r-- | share/man/container-list.1.txt | 4 | ||||
-rw-r--r-- | share/man/container-remove.1.txt | 4 | ||||
-rw-r--r-- | share/man/container-restart.1.txt | 4 | ||||
-rw-r--r-- | share/man/container-shell.1.txt | 4 | ||||
-rw-r--r-- | share/man/container-start.1.txt | 4 | ||||
-rw-r--r-- | share/man/container-stop.1.txt | 4 | ||||
-rw-r--r-- | share/man/container-version.1.txt | 4 | ||||
-rw-r--r-- | share/man/container.1.txt | 4 | ||||
-rwxr-xr-x | share/scripts/debconf | 37 | ||||
-rwxr-xr-x | share/scripts/debconf.d/0001-preseed-file | 4 | ||||
-rwxr-xr-x | share/scripts/debconf.d/0003-debconf | 20 |
23 files changed, 150 insertions, 41 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c7b121c..4ff1721 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,19 @@ +2016-06-01 Daniel Baumann <daniel.baumann@open-infrastructure.net> + + * Releasing version 20160601. + * Adding support for auto and bind options to be preseedable in + debconf script. + * Activating bind mounts during container creation time already. + * Adding support for default container create script through + /usr/share/container-tools/scripts/default symlink. + * Correcting cleanup of temporary debconf files in debconf + script. + + * Backward incompatible changes: + - for consistency reasons, instead of any file only files + with .cfg suffix are accepted as preseed files in + /etc/container-tools/debconf. + 2016-05-15 Daniel Baumann <daniel.baumann@open-infrastructure.net> * Releasing version 20160515. diff --git a/VERSION.txt b/VERSION.txt index 232669c..64fa36a 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -20160515 +20160601 diff --git a/lib/container/create b/lib/container/create index 0b0aa3a..dea1e76 100755 --- a/lib/container/create +++ b/lib/container/create @@ -103,11 +103,34 @@ then exit 1 fi -SCRIPT="${SCRIPT:-debian}" - -if [ ! -e "/usr/share/container-tools/scripts/${SCRIPT}" ] +if [ -z "${SCRIPT}" ] then - echo "'${SCRIPT}': no such script" >&2 + if [ -e /usr/share/container-tools/scripts/default ] + then + TARGET="$(basename $(readlink /usr/share/container-tools/scripts/default))" + + case "${TARGET}" in + container-tools_script) + TARGET="$(basename $(readlink /etc/alternatives/container-tools_script))" + ;; + esac + + if [ -e "/usr/share/container-tools/scripts/${TARGET}" ] + then + SCRIPT="${TARGET}" + else + echo "default -> '${TARGET}': no such script" >&2 + exit 1 + fi + else + SCRIPT="debian" + fi +else + if [ ! -e "/usr/share/container-tools/scripts/${SCRIPT}" ] + then + echo "'${SCRIPT}': no such script" >&2 + exit 1 + fi fi CNT_AUTO="${CNT_AUTO:-$(hostname -f)}" diff --git a/lib/container/remove b/lib/container/remove index d171d87..4f26d43 100755 --- a/lib/container/remove +++ b/lib/container/remove @@ -127,5 +127,5 @@ then fi # Run -rm -rf "${MACHINES}/${NAME}" +rm --preserve-root --one-file-system -rf "${MACHINES}/${NAME}" rm -f "${CONFIG}/${NAME}.conf" diff --git a/lib/container/stop b/lib/container/stop index 67cc403..fb470f6 100755 --- a/lib/container/stop +++ b/lib/container/stop @@ -92,9 +92,24 @@ fi STATE="$(machinectl show ${NAME} 2>&1 | awk -F= '/^State=/ { print $2 }')" -# Removing network configuration case "${CLEAN}" in true) + # Removing bind mounts + BIND="$(awk -F= '/^bind=/ { print $2 }' ${CONFIG}/${NAME}.conf)" + + if [ -n "${BIND}" ] + then + BINDS="$(echo ${BIND} | sed -e 's|;| |g')" + + for BIND in ${BINDS} + do + DIRECTORY="$(echo ${BIND} | awk -F: '{ print $1 }')" + + rmdir --ignore-fail-on-non-empty --parents ${DIRECTORY} > /dev/null 2>&1 || true + done + fi + + # Removing network configuration NETWORK_VETH_EXTRA_CONF="$(awk -F= '/^network-veth-extra=/ { print $2 }' ${CONFIG}/${NAME}.conf)" case "${NETWORK_VETH_EXTRA_CONF}" in diff --git a/share/doc/examples/cairon-backports.cfg b/share/doc/examples/cairon-backports.cfg index dd459f2..713d902 100644 --- a/share/doc/examples/cairon-backports.cfg +++ b/share/doc/examples/cairon-backports.cfg @@ -63,3 +63,5 @@ container-tools cnt-debconf/nameserver/options string timeout:1 attempts:1 #container-tools cnt-debconf/debconf-priority string #container-tools cnt-debconf/container-command string #container-tools cnt-debconf/host-command string +container-tools cnt-debconf/auto string FQDN +#container-tools cnt-debconf/bind string diff --git a/share/man/container-auto.1.txt b/share/man/container-auto.1.txt index af2d3c7..cdb9b2c 100644 --- a/share/man/container-auto.1.txt +++ b/share/man/container-auto.1.txt @@ -65,12 +65,12 @@ container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/man/container-console.1.txt b/share/man/container-console.1.txt index abccf63..c898c34 100644 --- a/share/man/container-console.1.txt +++ b/share/man/container-console.1.txt @@ -59,12 +59,12 @@ container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/man/container-create-debconf.1.txt b/share/man/container-create-debconf.1.txt index f882714..beef8b5 100644 --- a/share/man/container-create-debconf.1.txt +++ b/share/man/container-create-debconf.1.txt @@ -138,12 +138,12 @@ container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/man/container-create-debootstrap.1.txt b/share/man/container-create-debootstrap.1.txt index 360d7b6..cc6a109 100644 --- a/share/man/container-create-debootstrap.1.txt +++ b/share/man/container-create-debootstrap.1.txt @@ -80,12 +80,12 @@ container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/man/container-create.1.txt b/share/man/container-create.1.txt index 6646ad1..2553569 100644 --- a/share/man/container-create.1.txt +++ b/share/man/container-create.1.txt @@ -67,6 +67,9 @@ The following container scripts are available: *debconf*:: Advanced script to automatically create Debian based container, see container-create-debconf(1). +*default*:: + Symlink (if existing) to a container script which is used if no script was specified. On Debian based system this can be managed through update-alternatives(1), i.e. 'sudo update-alternatives --config container-tools_script'. + EXAMPLES -------- @@ -76,7 +79,6 @@ EXAMPLES *Create example.net container using debconf script:*:: sudo container create -n example.net -s debconf - SEE ALSO -------- container-tools(7), @@ -85,12 +87,12 @@ container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/man/container-limit.1.txt b/share/man/container-limit.1.txt index 995374e..d7a060f 100644 --- a/share/man/container-limit.1.txt +++ b/share/man/container-limit.1.txt @@ -92,12 +92,12 @@ container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/man/container-list.1.txt b/share/man/container-list.1.txt index e7015b7..4d8bc72 100644 --- a/share/man/container-list.1.txt +++ b/share/man/container-list.1.txt @@ -67,12 +67,12 @@ container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/man/container-remove.1.txt b/share/man/container-remove.1.txt index e5e38bd..cdd1d15 100644 --- a/share/man/container-remove.1.txt +++ b/share/man/container-remove.1.txt @@ -65,12 +65,12 @@ container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/man/container-restart.1.txt b/share/man/container-restart.1.txt index 992bc5b..1de7277 100644 --- a/share/man/container-restart.1.txt +++ b/share/man/container-restart.1.txt @@ -59,12 +59,12 @@ container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/man/container-shell.1.txt b/share/man/container-shell.1.txt index dc60af2..3a8ed05 100644 --- a/share/man/container-shell.1.txt +++ b/share/man/container-shell.1.txt @@ -62,12 +62,12 @@ systemd-nspawn(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/man/container-start.1.txt b/share/man/container-start.1.txt index e74f780..e2405a7 100644 --- a/share/man/container-start.1.txt +++ b/share/man/container-start.1.txt @@ -59,12 +59,12 @@ container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/man/container-stop.1.txt b/share/man/container-stop.1.txt index 5f8356d..cf7ad76 100644 --- a/share/man/container-stop.1.txt +++ b/share/man/container-stop.1.txt @@ -65,12 +65,12 @@ container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/man/container-version.1.txt b/share/man/container-version.1.txt index 4fede67..99548cc 100644 --- a/share/man/container-version.1.txt +++ b/share/man/container-version.1.txt @@ -56,12 +56,12 @@ container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/man/container.1.txt b/share/man/container.1.txt index 93cf309..7ad4f87 100644 --- a/share/man/container.1.txt +++ b/share/man/container.1.txt @@ -108,12 +108,12 @@ systemd-nspawn(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. +More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. BUGS ---- -Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. +Bugs can be reported by opening an issue in the GitHub repository at https://github.com/open-infrastructure/container-tools. AUTHORS diff --git a/share/scripts/debconf b/share/scripts/debconf index 55c2b8b..4f29238 100755 --- a/share/scripts/debconf +++ b/share/scripts/debconf @@ -907,7 +907,9 @@ Commands () HOSTNAME_SHORT="$(echo ${NAME} | cut -c-8)" HOST_INTERFACE_NAME="$(echo ${NETWORK0_VETH:-veth-${HOSTNAME_SHORT}-0})" + sed -i -e "s|^cnt.auto=.*|cnt.auto=${CNT_AUTO}|" "${CONFIG}/${NAME}.conf" sed -i -e "s|^cnt.network-bridge=.*|cnt.network-bridge=${HOST_INTERFACE_NAME}:${NETWORK0_BRIDGE:-br0}|g" "${CONFIG}/${NAME}.conf" + sed -i -e "s|^bind=.*|bind=${BIND}|" "${CONFIG}/${NAME}.conf" sed -i -e "s|^network-veth-extra=.*|network-veth-extra=${HOST_INTERFACE_NAME}:eth0|g" "${CONFIG}/${NAME}.conf" for NUMBER in $(seq 1 ${NETWORK_NUMBER}) @@ -990,13 +992,42 @@ Cleanup_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" ## Specific parts cp -a "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" "${MACHINES}/${NAME}" +# Mounting 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 + Configure_system "${MACHINES}/${NAME}" Configure_network "${MACHINES}/${NAME}" Cleanup_system "${MACHINES}/${NAME}" Commands "${MACHINES}/${NAME}" +# Unmounting 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 + # remove debconf temporary files -#FIXME -#echo rm --preserve-root --one-file-system -rf "${DEBCONF_TMPDIR}" -rmdir --ignore-fail-on-non-empty /tmp/container-tools || true +rm --preserve-root --one-file-system -rf "${DEBCONF_TMPDIR}" +rmdir --ignore-fail-on-non-empty /tmp/container-tools 2>&1 || true diff --git a/share/scripts/debconf.d/0001-preseed-file b/share/scripts/debconf.d/0001-preseed-file index 82d2049..03976d2 100755 --- a/share/scripts/debconf.d/0001-preseed-file +++ b/share/scripts/debconf.d/0001-preseed-file @@ -30,12 +30,12 @@ then # user specified one or more preseed files through commandline option db_set cnt-debconf/preseed-file "${PRESEED_FILE}" db_fset cnt-debconf/preseed-file seen true -elif ls "${CONFIG}"/* > /dev/null 2>&1 +elif ls "${CONFIG}"/*.cfg > /dev/null 2>&1 then # user has not specified preseed files through commandline option, # showing debconf selection dialog for global preseed file. - FILES="$(cd ${CONFIG} && find * -not -type d -and -not -name '*.cfg' -and -not -name '*.in' -and -not -name '*.sh')" + FILES="$(cd ${CONFIG} && find . -type f -name '*.cfg' -printf '%P\n' | sort)" PRESEED_FILES="$(for FILE in ${FILES}; do echo -n "${FILE}, "; done | sed -e 's|, $||')" if [ -n "${PRESEED_FILES}" ] diff --git a/share/scripts/debconf.d/0003-debconf b/share/scripts/debconf.d/0003-debconf index df14ef0..baf6879 100755 --- a/share/scripts/debconf.d/0003-debconf +++ b/share/scripts/debconf.d/0003-debconf @@ -1041,6 +1041,26 @@ Internal_options () fi echo "HOST_COMMAND=\"${HOST_COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default" + + if db_get cnt-debconf/auto + then + CNT_AUTO="${RET:-FQDN}" # string (w/o empty) + + case "${CNT_AUTO}" in + FQDN) + CNT_AUTO="$(hostname -f)" + ;; + esac + fi + + echo "CNT_AUTO=\"${CNT_AUTO}\"" >> "${DEBCONF_TMPDIR}/debconf.default" + + if db_get cnt-debconf/bind + then + BIND="${RET}" # string (w/ empty) + fi + + echo "BIND=\"${BIND}\"" >> "${DEBCONF_TMPDIR}/debconf.default" } Distribution |