diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-02-23 15:36:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-02-23 16:30:59 +0000 |
commit | 93d59c3176876b0990b27375458cf6518459bb07 (patch) | |
tree | 85403b3d9ac7f9df4b91195124b342dee81ec640 | |
parent | Releasing debian version 20180825-3. (diff) | |
download | open-infrastructure-compute-tools-93d59c3176876b0990b27375458cf6518459bb07.tar.xz open-infrastructure-compute-tools-93d59c3176876b0990b27375458cf6518459bb07.zip |
Merging upstream version 20190222.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
68 files changed, 1136 insertions, 811 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f05dd24..a516ba4 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,54 @@ +2019-02-22 Daniel Baumann <daniel.baumann@open-infrastructure.net> + + * Releasing version 2019-02-22. + + * Backward incompatible changes: + - replaced Progress Linux 4 and Progress Linux 4+ support in + container debconf create script in favour of Progress Linux 5 + and Progress Linux 5+ support. + + - renamed upstream from container-tools to compute-tools, + directory names have changed. The only user visible is the + configuration directory: + + old: /etc/container-tools + new: /etc/open-infrastructure/container + + - harmonized field names in container debconf create script: + + old: container-tools cnt-debconf/[...] + new: compute-tools container/[...] + + See updated example files in /usr/share/doc/compute-tools/examples. + + [ Daniel Baumann ] + * Updating year in copyright notices to 2019. + * Updating debian preseed example from stretch to buster. + * Updating progress-linux preseed example from dschinn-backports to engywuck-backports. + * Adding comment about enabling user namespace in procps configuration. + * Adding support for Debian 10 (buster) in debconf container create script. + * Setting default debian distribution to buster in debconf container create script. + * Adding support for Debian testing/bullseye in debconf container create script. + * Replacing Progress Linux 4 with Progress Linux 5 in debconf container create script. + * Setting default debian distribution to buster in debootstrap container create script. + * Adding verbose output when using '-n ALL' options with container commands. + * Updating host-setup documentation for unpriviled containers. + * Adding convenience symlinks for container start and stop commands. + * Correcting (harmless) error in https mirror handling wrt/ installing apt-transport-https. + * Replacing archive signing key handling for progress-linux by install the progress-linux package. + * Using cdn redirector as default sources.list entry. + * Adding st convenience symlink for status command. + * Adding missing convenience symlinks in bash-completion. + * Adding container log command. + * Fixing inconsistent variable usage in makefile. + * Updating container-images.sh example for buster. + * Correcting left-over from old cnt-debconf/auto field in engywuck-backports preseed example. + * Removing manpage symlinks in uninstall target too. + * Renaming container-tools to compute-tools. + * Using get.open-infrastructure.net as default URL to get images from in container create script.ck + * Harmonizing debconf values for container debconf create script. + * Using hostname fallback if FQDN is not set. + 2018-08-25 Daniel Baumann <daniel.baumann@open-infrastructure.net> * Releasing version 20180825. @@ -1,7 +1,4 @@ -# Makefile - -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,7 +17,10 @@ SHELL := sh -e -SOFTWARE = container-tools +PROJECT = open-infrastructure +SOFTWARE = compute-tools +PROGRAM = container + SCRIPTS = bin/* lib/*/* all: build @@ -57,18 +57,19 @@ build: share/man/*.txt sed -n '/^NAME/,$$p' share/man/$(SOFTWARE).7.txt > README.txt install: build - mkdir -p $(DESTDIR)/etc/${SOFTWARE}/config - mkdir -p $(DESTDIR)/etc/${SOFTWARE}/debconf - mkdir -p $(DESTDIR)/etc/${SOFTWARE}/hooks + mkdir -p $(DESTDIR)/etc/$(PROJECT)/$(PROGRAM)/config + mkdir -p $(DESTDIR)/etc/$(PROJECT)/$(PROGRAM)/debconf + mkdir -p $(DESTDIR)/etc/$(PROJECT)/$(PROGRAM)/hooks mkdir -p $(DESTDIR)/usr/bin cp -r bin/* $(DESTDIR)/usr/bin - mkdir -p $(DESTDIR)/usr/lib/$(SOFTWARE) - cp -r lib/* $(DESTDIR)/usr/lib/$(SOFTWARE) + mkdir -p $(DESTDIR)/usr/lib/$(PROJECT) + cp -r lib/* $(DESTDIR)/usr/lib/$(PROJECT) - mkdir -p $(DESTDIR)/usr/share/$(SOFTWARE) - cp -r VERSION.txt share/config share/hooks share/scripts ${DESTDIR}/usr/share/$(SOFTWARE) + mkdir -p $(DESTDIR)/usr/share/$(PROJECT)/$(PROGRAM) + cp -r VERSION.txt $(DESTDIR)/usr/share/$(PROJECT)/${PROGRAM} + cp -r share/config share/hooks share/scripts $(DESTDIR)/usr/share/$(PROJECT)/$(PROGRAM) mkdir -p $(DESTDIR)/usr/share/bash-completion/completions cp -r share/bash-completion/* $(DESTDIR)/usr/share/bash-completion/completions @@ -99,28 +100,31 @@ install: build ln -sf container.1 $(DESTDIR)/usr/share/man/man1/cnt.1 ln -sf container-shell $(DESTDIR)/usr/bin/cntsh ln -sf container-shell.1 $(DESTDIR)/usr/share/man/man1/cntsh.1 - ln -sf container ${DESTDIR}/usr/share/bash-completion/completions/cnt + ln -sf container $(DESTDIR)/usr/share/bash-completion/completions/cnt - ln -sf debconf ${DESTDIR}/usr/share/$(SOFTWARE)/scripts/debian - ln -sf debconf.d ${DESTDIR}/usr/share/$(SOFTWARE)/scripts/debian.d + ln -sf debconf $(DESTDIR)/usr/share/$(PROJECT)/$(PROGRAM)/scripts/debian + ln -sf debconf.d $(DESTDIR)/usr/share/$(PROJECT)/$(PROGRAM)/scripts/debian.d ln -sf container-create-debconf.1 $(DESTDIR)/usr/share/man/man1/container-create-debian.1 - ln -sf debconf ${DESTDIR}/usr/share/$(SOFTWARE)/scripts/progress-linux - ln -sf debconf.d ${DESTDIR}/usr/share/$(SOFTWARE)/scripts/progress-linux.d + ln -sf debconf $(DESTDIR)/usr/share/$(PROJECT)/$(PROGRAM)/scripts/progress-linux + ln -sf debconf.d $(DESTDIR)/usr/share/$(PROJECT)/$(PROGRAM)/scripts/progress-linux.d ln -sf container-create-debconf.1 $(DESTDIR)/usr/share/man/man1/container-create-progress-linux.1 - ln -sf console $(DESTDIR)/usr/lib/$(SOFTWARE)/container/con - ln -sf list $(DESTDIR)/usr/lib/$(SOFTWARE)/container/ls - ln -sf move $(DESTDIR)/usr/lib/$(SOFTWARE)/container/mv - ln -sf remove $(DESTDIR)/usr/lib/$(SOFTWARE)/container/rm - ln -sf version $(DESTDIR)/usr/lib/$(SOFTWARE)/container/ver + ln -sf console $(DESTDIR)/usr/lib/$(PROJECT)/$(PROGRAM)/con + ln -sf list $(DESTDIR)/usr/lib/$(PROJECT)/$(PROGRAM)/ls + ln -sf move $(DESTDIR)/usr/lib/$(PROJECT)/$(PROGRAM)/mv + ln -sf start $(DESTDIR)/usr/lib/$(PROJECT)/$(PROGRAM)/s + ln -sf status $(DESTDIR)/usr/lib/$(PROJECT)/$(PROGRAM)/st + ln -sf stop $(DESTDIR)/usr/lib/$(PROJECT)/$(PROGRAM)/t + ln -sf remove $(DESTDIR)/usr/lib/$(PROJECT)/$(PROGRAM)/rm + ln -sf version $(DESTDIR)/usr/lib/$(PROJECT)/$(PROGRAM)/ver mkdir -p $(DESTDIR)/lib/systemd/system cp -r share/systemd/* $(DESTDIR)/lib/systemd/system - mkdir -p $(DESTDIR)/var/log/$(SOFTWARE) + mkdir -p $(DESTDIR)/var/log/$(PROJECT) uninstall: - rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/var/log/$(SOFTWARE) || true + rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/var/log/$(PROJECT) || true for FILE in share/systemd/*; \ do \ @@ -140,7 +144,9 @@ uninstall: rm -f $(DESTDIR)/usr/share/man/man1/cnt.1 rm -f $(DESTDIR)/usr/bin/cntsh rm -f $(DESTDIR)/usr/share/man/man1/cntsh.1 - rm -f ${DESTDIR}/usr/share/bash-completion/completions/cnt + rm -f $(DESTDIR)/usr/share/bash-completion/completions/cnt + rm -f $(DESTDIR)/usr/share/man/man1/container-create-progress-linux.1 + rm -f $(DESTDIR)/usr/share/man/man1/container-create-debian.1 for FILE in share/sudo/*; \ do \ @@ -165,10 +171,10 @@ uninstall: rm -rf $(DESTDIR)/usr/share/doc/$(SOFTWARE) rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/usr/share/doc || true - rm -rf $(DESTDIR)/usr/share/$(SOFTWARE) + rm -rf $(DESTDIR)/usr/share/$(PROJECT)/$(PROGRAM) rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/usr/share || true - rm -rf $(DESTDIR)/usr/lib/$(SOFTWARE) + rm -rf $(DESTDIR)/usr/lib/$(PROJECT)/$(PROGRAM) rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/usr/lib || true for FILE in bin/*; \ @@ -177,10 +183,11 @@ uninstall: done rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/usr/bin || true - rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/${SOFTWARE}/config || true - rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/${SOFTWARE}/debconf || true - rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/${SOFTWARE}/hooks || true - rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/${SOFTWARE} || true + rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/$(PROJECT)/$(PROGRAM)/config || true + rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/$(PROJECT)/$(PROGRAM)/debconf || true + rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/$(PROJECT)/$(PROGRAM)/hooks || true + rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/$(PROJECT)/$(PROGRAM) || true + rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/$(PROJECT) || true rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc || true rmdir --ignore-fail-on-non-empty --parents $(DESTDIR) || true diff --git a/VERSION.txt b/VERSION.txt index c6c53c0..02c8992 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -20180825 +20190222 diff --git a/bin/container b/bin/container index 849bbec..ac8feff 100755 --- a/bin/container +++ b/bin/container @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,10 +19,10 @@ set -e -SOFTWARE="container-tools" +PROJECT="open-infrastructure" PROGRAM="container" -HOOKS="/etc/${SOFTWARE}/hooks" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" # Parameter PARAMETER="${1}" @@ -44,7 +43,7 @@ OPTIONS="${@}" for COMMAND in $(echo ${COMMANDS} | sed -e 's|,| |g') do - if [ ! -e "/usr/lib/${SOFTWARE}/${PROGRAM}/${COMMAND}" ] + if [ ! -e "/usr/lib/${PROJECT}/${PROGRAM}/${COMMAND}" ] then echo "'${COMMAND}': no such ${PROGRAM} command" >&2 exit 1 @@ -68,15 +67,15 @@ do create|remove|rm|restart|start|stop) USER="${SUDO_USER:-${USER}}" DATE="$(date +%Y-%m-%d\ %H:%M:%S)" - HOST="$(hostname -f)" + HOST="$(hostname -f 2> /dev/null || hostname)" # logfile - echo "${DATE} ${HOST} ${USER} ${PROGRAM} ${COMMAND} ${OPTIONS}" >> "/var/log/${SOFTWARE}/${PROGRAM}.log" + echo "${DATE} ${HOST} ${USER} ${PROGRAM} ${COMMAND} ${OPTIONS}" >> "/var/log/${PROJECT}/${PROGRAM}.log" # irc - if [ -e /usr/bin/irk ] && [ -e "/etc/default/${SOFTWARE}" ] + if [ -e /usr/bin/irk ] && [ -e "/etc/${PROJECT}/${PROGRAM}.conf" ] then - . /etc/default/${SOFTWARE} + . "/etc/${PROJECT}/${PROGRAM}.conf" if [ -n "${IRK_TARGETS}" ] then @@ -91,7 +90,7 @@ do fi # Run - "/usr/lib/${SOFTWARE}/${PROGRAM}/${COMMAND}" "${OPTIONS}" + "/usr/lib/${PROJECT}/${PROGRAM}/${COMMAND}" "${OPTIONS}" # Post hooks for FILE in "${HOOKS}/post-${PROGRAM}".* "${HOOKS}/${NAME}.post-${PROGRAM}" diff --git a/bin/container-shell b/bin/container-shell index 2ca5cd3..fe113d3 100755 --- a/bin/container-shell +++ b/bin/container-shell @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,7 +19,8 @@ set -e -SOFTWARE="container-tools" +PROJECT="open-infrastructure" +SOFTWARE="compute-tools" PROGRAM="container" COMMAND="$(basename ${0})" @@ -64,7 +64,7 @@ Shell () echo "The following ${PROGRAM} commands are available:" echo - cd "/usr/lib/${SOFTWARE}/${PROGRAM}" + cd "/usr/lib/${PROJECT}/${PROGRAM}" find . -type f -printf " %f\n" | sort cd "${OLDPWD}" @@ -97,7 +97,7 @@ Shell () ;; esac - if [ ! -e "/usr/lib/${SOFTWARE}/${PROGRAM}/${COMMAND}" ] + if [ ! -e "/usr/lib/${PROJECT}/${PROGRAM}/${COMMAND}" ] then echo "'${COMMAND}': no such ${PROGRAM} command" >&2 return diff --git a/lib/container/auto b/lib/container/auto index 8477915..83c9a57 100755 --- a/lib/container/auto +++ b/lib/container/auto @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" Parameters () { @@ -73,7 +74,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -f|--force -s|--start -t|--stop" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -f|--force -s|--start -t|--stop" >&2 exit 1 } @@ -84,7 +85,7 @@ then Usage fi -HOST="$(hostname -f)" +HOST="$(hostname -f 2> /dev/null || hostname)" # Pre hooks for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}" diff --git a/lib/container/console b/lib/container/console index dfc9b5c..0b49058 100755 --- a/lib/container/console +++ b/lib/container/console @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,9 +19,11 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -HOOKS="/etc/container-tools/hooks" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -63,7 +64,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME" >&2 exit 1 } diff --git a/lib/container/create b/lib/container/create index 561584c..43cad9b 100755 --- a/lib/container/create +++ b/lib/container/create @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,12 +19,15 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" -SCRIPTS="/usr/share/container-tools/scripts" +SCRIPTS="/usr/share/${PROJECT}/${PROGRAM}/scripts" +CONFIG_TEMPLATE="/usr/share/${PROJECT}/${PROGRAM}/config/container.conf.in" Parameters () { @@ -110,7 +112,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME [--cnt.container-server=true|false|FQDN] [--cnt.overlay=DIRECTORY_LOWER:DIRECTORY_UPPER:DIRECTORY_WORK:DIRECTORY_MERGED] [-b|--bind DIRECTORY:DIRECTORY[:OPTIONS]] [--bind-ro DIRECTORY:DIRECTORY[:OPTIONS]] [-c|--capability CAPABILITY[,CAPABILITY]] [-d|--drop-capability DROP_CAPABILITY[,DROP_CAPABILITY]] [-s|--script SCRIPT] [-v|--verbose] [-- SCRIPT_OPTIONS]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [--cnt.container-server=true|false|FQDN] [--cnt.overlay=DIRECTORY_LOWER:DIRECTORY_UPPER:DIRECTORY_WORK:DIRECTORY_MERGED] [-b|--bind DIRECTORY:DIRECTORY[:OPTIONS]] [--bind-ro DIRECTORY:DIRECTORY[:OPTIONS]] [-c|--capability CAPABILITY[,CAPABILITY]] [-d|--drop-capability DROP_CAPABILITY[,DROP_CAPABILITY]] [-s|--script SCRIPT] [-v|--verbose] [-- SCRIPT_OPTIONS]" >&2 exit 1 } @@ -141,8 +143,8 @@ then TARGET="$(basename $(readlink ${SCRIPTS}/default))" case "${TARGET}" in - container-tools_script) - TARGET="$(basename $(readlink /etc/alternatives/container-tools_script))" + container_script) + TARGET="$(basename $(readlink /etc/alternatives/container_script))" ;; esac @@ -176,7 +178,7 @@ EOF ;; esac -CNT_CONTAINER_SERVER="${CNT_CONTAINER_SERVER:-$(hostname -f)}" +CNT_CONTAINER_SERVER="${CNT_CONTAINER_SERVER:-$(hostname -f 2> /dev/null || hostname)}" # Pre hooks for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}" @@ -251,7 +253,7 @@ sed -e "s|@CNT_AUTO@|${CNT_AUTO}|g" \ -e "s|@NETWORK_VETH_EXTRA@|${NETWORK_VETH_EXTRA}|g" \ -e "s|@PRIVATE_USERS@|no|g" \ -e "s|@REGISTER@|yes|g" \ -/usr/share/container-tools/config/container.conf.in > "${CONFIG}/${NAME}.conf" +"${CONFIG_TEMPLATE}" > "${CONFIG}/${NAME}.conf" # Run "${SCRIPTS}/${SCRIPT}" $(echo "${@}" | sed -e 's| -- | |') diff --git a/lib/container/enter b/lib/container/enter index 72b3b1c..9c9ebfa 100755 --- a/lib/container/enter +++ b/lib/container/enter @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,9 +19,11 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -HOOKS="/etc/container-tools/hooks" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -63,7 +64,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME" >&2 exit 1 } diff --git a/lib/container/key b/lib/container/key index 3f0f57b..1b59555 100755 --- a/lib/container/key +++ b/lib/container/key @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,9 +19,11 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -KEYS="/etc/container-tools/keys" +KEYS="/etc/${PROJECT}/${PROGRAM}/keys" Parameters () { @@ -74,7 +75,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} [-a|--add KEY] [-l|--list] [-r|--remove KEY]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} [-a|--add KEY] [-l|--list] [-r|--remove KEY]" >&2 exit 1 } diff --git a/lib/container/limit b/lib/container/limit index f2d6bfa..b1ec170 100755 --- a/lib/container/limit +++ b/lib/container/limit @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,9 +19,11 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -HOOKS="/etc/container-tools/hooks" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -103,7 +104,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME [--blockio-device-weight \"DEVICE WEIGHT\"] [--blockio-read-bandwidth \"DEVICE BYTES\"] [-b|--blockio-weight WEIGHT] [--blockio-write-bandwidth \"DEVICE BYTES\"] [-c|--cpu-quota QUOTA] [--cpu-shares SHARES] [-m|--memory-limit BYTES] [-t|--tasks-max NUMBER]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [--blockio-device-weight \"DEVICE WEIGHT\"] [--blockio-read-bandwidth \"DEVICE BYTES\"] [-b|--blockio-weight WEIGHT] [--blockio-write-bandwidth \"DEVICE BYTES\"] [-c|--cpu-quota QUOTA] [--cpu-shares SHARES] [-m|--memory-limit BYTES] [-t|--tasks-max NUMBER]" >&2 exit 1 } diff --git a/lib/container/list b/lib/container/list index 816d521..62f6a5b 100755 --- a/lib/container/list +++ b/lib/container/list @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,13 +19,15 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" -VERSION="$(container version)" +VERSION="$(${PROGRAM} version)" Parameters () { @@ -106,7 +107,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} [-a|--all] [--csv-separator SEPARATOR] [--format FORMAT] [-h|--host HOSTNAME] [--nwdiag-color COLOR] [--nwdiag-label LABEL] [-o|--other] [-s|--started] [-t|--stopped]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} [-a|--all] [--csv-separator SEPARATOR] [--format FORMAT] [-h|--host HOSTNAME] [--nwdiag-color COLOR] [--nwdiag-label LABEL] [-o|--other] [-s|--started] [-t|--stopped]" >&2 exit 1 } @@ -114,7 +115,7 @@ Parameters "${@}" LIST="${LIST:-started stopped}" FORMAT="${FORMAT:-cli}" -HOST="${HOST:-$(hostname -f)}" +HOST="${HOST:-$(hostname -f 2> /dev/null || hostname)}" CSV_SEPARATOR="${CSV_SEPARATOR:-,}" @@ -233,7 +234,7 @@ EOF csv) cat << EOF -# container-tools version ${VERSION} +# compute-tools ${VERSION} Host${CSV_SEPARATOR}Container${CSV_SEPARATOR}Status${CSV_SEPARATOR}IPv4-Address EOF @@ -243,7 +244,7 @@ EOF cat << EOF { - "container-tools": { + "compute-tools": { "version": "${VERSION}", }, "host": { @@ -258,7 +259,7 @@ EOF NETWORK="$(echo ${HOST} | sed -e 's|\.|_|g')" cat << EOF -# container-tools ${VERSION} +# compute-tools ${VERSION} nwdiag { external_connector = none; network ${NETWORK} { @@ -294,7 +295,7 @@ EOF cat << EOF --- -container_tools: +compute_tools: version: ${VERSION} host: @@ -308,9 +309,9 @@ EOF xml) cat << EOF -<container-tools> +<compute-tools> <version>${VERSION}</version> -</container-tools> +</compute-tools> <host> <name>${HOST}</name> </host> diff --git a/lib/container/log b/lib/container/log new file mode 100755 index 0000000..200177c --- /dev/null +++ b/lib/container/log @@ -0,0 +1,145 @@ +#!/bin/sh + +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +set -e + +PROJECT="open-infrastructure" +PROGRAM="container" +COMMAND="$(basename ${0})" + +LOG="/var/log/${PROJECT}/${PROGRAM}.log" + +Parameters () +{ + GETOPT_LONGOPTIONS="name:,date:," + GETOPT_OPTIONS="n:,d:," + + PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})" + + if [ "${?}" != "0" ] + then + echo "'${COMMAND}': getopt exit" >&2 + exit 1 + fi + + eval set -- "${PARAMETERS}" + + while true + do + case "${1}" in + -d|--date) + DATE="${2}" + shift 2 + ;; + + -n|--name) + NAME="${2}" + shift 2 + ;; + + -u|--user) + USER="${2}" + shift 2 + ;; + + --) + shift 1 + break + ;; + + *) + echo "'${COMMAND}': getopt error" >&2 + exit 1 + ;; + esac + done +} + +Usage () +{ + echo "Usage: ${PROGRAM} ${COMMAND} [-n|--name NAME] [-d|--date DATE|today|today-N|yesterday] [-u|--user USER]" >&2 + exit 1 +} + +Parameters "${@}" + +case "${DATE}" in + today-*) + DAYS="$(echo ${DATE} | awk -F- '{ print $2 }')" + + START="$(date -d "${DAYS} day ago" '+%Y-%m-%d')" + END="$(date +%Y-%m-%d)" + + DATE="(${START}" + + while true + do + DATE="${DATE}|${START}" + + if [ "${START}" = "${END}" ] + then + break + fi + + START="$(date +%Y-%m-%d --date "${START} +1 day")" + done + + DATE="${DATE})" + ;; + + today) + DATE="$(date +%Y-%m-%d)" + ;; + + yesterday) + DATE="$(date -d '1 day ago' '+%Y-%m-%d')" + ;; +esac + +if ls "${LOG}"-*.gz > /dev/null 2>&1 +then + LOGS="$(ls ${LOG}-*.gz) ${LOG}" +else + LOGS="${LOG}" +fi + +# FIXME: user + +for LOG in ${LOGS} +do + case "${LOG}" in + *.gz) + GREP="zgrep" + ;; + + *) + GREP="grep" + ;; + esac + + case "${NAME}" in + "") + ${GREP} -E "^${DATE}" "${LOG}" || true + ;; + + *) + ${GREP} -E "^${DATE}" "${LOG}" | grep " ${NAME}" || true + ;; + esac +done diff --git a/lib/container/move b/lib/container/move index e533b0e..278f972 100755 --- a/lib/container/move +++ b/lib/container/move @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -74,7 +75,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} [-f|--force] -n|--new NAME -o|--old NAME" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} [-f|--force] -n|--new NAME -o|--old NAME" >&2 exit 1 } @@ -111,7 +112,7 @@ case "${FORCE}" in ;; *) - if container list --other | grep -qs "^${OLD}$" + if ${PROGRAM} list --other | grep -qs "^${OLD}$" then echo -n "'${OLD}': rename container to '${NEW}' [y|N]? " read FORCE diff --git a/lib/container/remove b/lib/container/remove index 275c867..13a9bd8 100755 --- a/lib/container/remove +++ b/lib/container/remove @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -87,7 +88,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME [--allow-stop] [-f|--force] [-v|--verbose]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [--allow-stop] [-f|--force] [-v|--verbose]" >&2 exit 1 } @@ -121,11 +122,17 @@ fi case "${NAME}" in ALL) - NAMES="$(container list --format shell --stopped)" + NAMES="$(${PROGRAM} list --format shell --stopped)" for NAME in ${NAMES} do - container remove --name ${NAME} ${OPTIONS_ALL} || true + case "${VERBOSE}" in + true) + echo "Removing container ${NAME}..." + ;; + esac + + ${PROGRAM} remove --name ${NAME} ${OPTIONS_ALL} || true done exit 0 @@ -145,7 +152,7 @@ case "${STATE}" in case "${ALLOW_STOP}" in true) echo "'${NAME}': container is started, stopping it now" >&2 - container stop -n ${NAME} + ${PROGRAM} stop -n ${NAME} ;; *) diff --git a/lib/container/restart b/lib/container/restart index a22b970..5b78dda 100755 --- a/lib/container/restart +++ b/lib/container/restart @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,9 +19,11 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -HOOKS="/etc/container-tools/hooks" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -65,7 +66,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME" >&2 exit 1 } @@ -78,11 +79,17 @@ fi case "${NAME}" in ALL) - NAMES="$(container list --format shell --started)" + NAMES="$(${PROGRAM} list --format shell --started)" for NAME in ${NAMES} do - container restart --name ${NAME} || true + case "${VERBOSE}" in + true) + echo "Restarting container ${NAME}..." + ;; + esac + + ${PROGRAM} restart --name ${NAME} || true done exit 0 diff --git a/lib/container/start b/lib/container/start index ac0275e..a63c861 100755 --- a/lib/container/start +++ b/lib/container/start @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" START="false" @@ -89,7 +90,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME [-f|--force]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force]" >&2 exit 1 } @@ -102,11 +103,17 @@ fi case "${NAME}" in ALL) - NAMES="$(container list --format shell --stopped)" + NAMES="$(${PROGRAM} list --format shell --stopped)" for NAME in ${NAMES} do - container start --name ${NAME} ${OPTIONS_ALL} || true + case "${VERBOSE}" in + true) + echo "Starting container ${NAME}..." + ;; + esac + + ${PROGRAM} start --name ${NAME} ${OPTIONS_ALL} || true done exit 0 @@ -459,7 +466,7 @@ fi case "${SYSTEMCTL}" in true) - systemctl start container@${NAME}.service + systemctl start ${PROGRAM}@${NAME}.service # FIXME start console .. after sleep? + configuration option exit 0 ;; diff --git a/lib/container/status b/lib/container/status index 9c5ab20..a4b49e1 100755 --- a/lib/container/status +++ b/lib/container/status @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2016 Simon Spöehel <simon.spoehel@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -64,7 +65,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME" >&2 exit 1 } @@ -91,7 +92,7 @@ do done # Run -systemctl status container@${NAME}.service --full +systemctl status ${PROGRAM}@${NAME}.service --full # Post hooks for FILE in "${HOOKS}/post-${COMMAND}".* "${HOOKS}/${NAME}.post-${COMMAND}" diff --git a/lib/container/stop b/lib/container/stop index d996282..3a0de2a 100755 --- a/lib/container/stop +++ b/lib/container/stop @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" CLEAN="false" @@ -83,7 +84,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME [-f|--force]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force]" >&2 exit 1 } @@ -117,11 +118,17 @@ fi case "${NAME}" in ALL) - NAMES="$(container list --format shell --started)" + NAMES="$(${PROGRAM} list --format shell --started)" for NAME in ${NAMES} do - container stop --name ${NAME} ${OPTIONS_ALL} || true + case "${VERBOSE}" in + true) + echo "Stopping container ${NAME}..." + ;; + esac + + ${PROGRAM} stop --name ${NAME} ${OPTIONS_ALL} || true done exit 0 diff --git a/lib/container/top b/lib/container/top index 31ec005..4978568 100755 --- a/lib/container/top +++ b/lib/container/top @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,6 +19,8 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" Parameters () @@ -60,14 +61,14 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} [-d|--delay DELAY]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} [-d|--delay DELAY]" >&2 exit 1 } Parameters "${@}" DELAY="${DELAY:-1}" -HOST="$(hostname -f)" +HOST="$(hostname -f 2> /dev/null || hostname)" # Pre hooks for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}" @@ -105,7 +106,7 @@ Top () trap 'clear' EXIT HUP INT QUIT TERM -Top "container list && printf '%-59s %-19s\n' \" Host: ${HOST}\" \"\$(date +%Y-%m-%d\ %H:%M:%S)\"" +Top "${PROGRAM} list && printf '%-59s %-19s\n' \" Host: ${HOST}\" \"\$(date +%Y-%m-%d\ %H:%M:%S)\"" # Post hooks for FILE in "${HOOKS}/post-${COMMAND}".* "${HOOKS}/${NAME}.post-${COMMAND}" diff --git a/lib/container/version b/lib/container/version index 543d6dc..d356c3e 100755 --- a/lib/container/version +++ b/lib/container/version @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -HOOKS="/etc/container-tools/hooks" -SHARE="/usr/share/container-tools" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" +SHARE="/usr/share/${PROJECT}/${PROGRAM}" # Pre hooks for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}" diff --git a/share/bash-completion/container b/share/bash-completion/container index e117d16..150ff71 100644 --- a/share/bash-completion/container +++ b/share/bash-completion/container @@ -1,8 +1,7 @@ # bash-completion # -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2016 Andreas Kreuzer <andreas.kreuzer@open-infrastructure.net> -# Copyright (C) 2016-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2016-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -64,13 +63,13 @@ _container() create) case "${prev}" in -n|--name) - opts="$(cd /etc/container-tools/debconf 2>/dev/null && ls *.cfg */*.cfg 2>/dev/null | sed -e 's|.*/||g' -e 's|.cfg$||g')" + opts="$(cd /etc/open-infrastructure/container/debconf 2>/dev/null && ls *.cfg */*.cfg 2>/dev/null | sed -e 's|.*/||g' -e 's|.cfg$||g')" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; -s|--script) - opts="$(cd /usr/share/container-tools/scripts && find -maxdepth 1 -not -type d -and -not -name 'default' -and -not -name 'debconf' -and -not -name '*.d' -printf '%P\n' | sort)" + opts="$(cd /usr/share/open-infrastructure/container/scripts && find -maxdepth 1 -not -type d -and -not -name 'default' -and -not -name 'debconf' -and -not -name '*.d' -printf '%P\n' | sort)" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; @@ -124,7 +123,7 @@ _container() list|ls) case "${prev}" in -h|--host) - opts="true false $(hostname -f)" + opts="true false $(hostname -f 2> /dev/null || hostname)" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; @@ -143,6 +142,43 @@ _container() esac ;; + log) + case "${prev}" in + -d|--date) + opts="$(if ls /var/log/open-infrastructure/container.log-*.gz > /dev/null 2>&1; + then \ + zcat /var/log/open-infrastructure/container.log-*.gz | awk '{ print $1 }' | sort -u; \ + fi; \ + if [ -e /var/log/open-infrastructure/container.log ]; \ + then \ + awk '{ print $1 }' /var/log/open-infrastructure/container.log | sort -u; \ + fi) \ + today yesterday" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + -n|--name) + opts="$(if ls /var/log/open-infrastructure/container.log-*.gz > /dev/null 2>&1; + then \ + zgrep -E '(\-n|\-\-name) ' /var/log/open-infrastructure/container.log-*.gz | sed -e 's|.*-n ||' -e 's|.*--name ||' -e 's| .*$||' | sort -u; \ + fi; \ + if [ -e /var/log/open-infrastructure/container.log ]; \ + then \ + grep -E '(\-n|\-\-name) ' /var/log/open-infrastructure/container.log | sed -e 's|.*-n ||' -e 's|.*--name ||' -e 's| .*$||' | sort -u; \ + fi)" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + *) + opts="-d --date -n --name" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + esac + ;; + move|mv) case "${prev}" in -o|--old) @@ -191,7 +227,7 @@ _container() esac ;; - start) + start|s) case "${prev}" in -n|--name) opts="$(container list -t -f shell)" @@ -207,7 +243,7 @@ _container() esac ;; - status) + status|st) case "${prev}" in -n|--name) opts="$(container list -t -f shell)" @@ -223,7 +259,7 @@ _container() esac ;; - stop) + stop|t) case "${prev}" in -n|--name) opts="$(container list -s -f shell)" @@ -250,7 +286,7 @@ _container() ;; *) - local commands=$(cd /usr/lib/container-tools/container 2>/dev/null && find * -type f -print) + local commands=$(cd /usr/lib/open-infrastructure/container 2>/dev/null && find * -type f -print) COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) ) return 0 ;; diff --git a/share/config/container.conf.in b/share/config/container.conf.in index 322e2c9..ebf91b9 100644 --- a/share/config/container.conf.in +++ b/share/config/container.conf.in @@ -1,4 +1,4 @@ -# container-tools: @NAME@ +# compute-tools: @NAME@ [start] cnt.auto=@CNT_AUTO@ diff --git a/share/doc/HOST-SETUP.txt b/share/doc/HOST-SETUP.txt index 74b7333..d2e4216 100644 --- a/share/doc/HOST-SETUP.txt +++ b/share/doc/HOST-SETUP.txt @@ -1,5 +1,5 @@ -container-tools: Host Setup -=========================== +compute-tools: Host Setup +========================= 1. Debian Packages @@ -180,14 +180,33 @@ iface br100 inet static EOF -4. Enabling container-shell +4. Enabling user namespace for unprivileged containers +------------------------------------------------------ + +Linux supports unprivileged containers with the user namespace. +By default the user namespace is disabled on Debian systems (see #898446). +To enable user namespace, edit the following file for a permant change: + + /etc/sysctl.d/zz-compute-tools.conf + sysctl -p + +or enable it manually with: + + echo 1 > /proc/sys/kernel/unprivileged_userns_clone + +Note that containers need to be started with the correct +configuration in /etc/compute-tools/container/config to run unpriviled +(private-users option). + + +5. Enabling container-shell --------------------------- -Managing containers requires root privileges. In order to allow unprivileged -users to manage containers without granting them privileges or accounts, -the container-shell can be used together with sudo and a container user. +Managing privileged containers requires root privileges. In order to allow +unprivileged users to manage privileged containers without granting them +privileges or accounts, the container-shell can be used together with sudo +and a container user. - sudo adduser --gecos "container-tools,,," \ - --home /var/lib/machines/container-tools \ - --shell /usr/bin/container-shell \ - --no-create-home container + sudo adduser --gecos "compute-tools,,," \ + --home /var/lib/open-infrastructure/container-shell \ + --shell /usr/bin/container-shell diff --git a/share/doc/asciicast/introduction.sh b/share/doc/asciicast/introduction.sh index c4efb0c..68b02d2 100755 --- a/share/doc/asciicast/introduction.sh +++ b/share/doc/asciicast/introduction.sh @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -51,7 +50,7 @@ Text () sleep 2 -Text "# Welcome to this container-tools introduction cast." +Text "# Welcome to this compute-tools introduction cast." echo echo @@ -59,7 +58,7 @@ Text "# 1. We're using Debian ($(lsb_release -cs))..." Command "lsb_release -a" -Text "# ...and container-tools version $(cnt version)." +Text "# ...and compute-tools version $(cnt version)." Command "cnt version" @@ -125,13 +124,13 @@ Command "sudo cnt list" echo echo -Text "# This concludes this introduction to container-tools." +Text "# This concludes this introduction to compute-tools." Text "#" Text "# Thanks for watching and have fun setting up" Text "# your own Linux containers based on systemd-nspawn" -Text "# using container-tools from Open Infrastructure:" +Text "# using compute-tools from Open Infrastructure:" Text "#" -Text "# https://open-infrastructure.net/software/container-tools" +Text "# https://open-infrastructure.net/software/compute-tools" sleep 2 diff --git a/share/doc/examples/buster.cfg b/share/doc/examples/buster.cfg new file mode 100644 index 0000000..cfc8595 --- /dev/null +++ b/share/doc/examples/buster.cfg @@ -0,0 +1,35 @@ +# example for automated Debian 10 (buster) based container creation +# using: sudo container create -s debian + +debconf debconf/priority select critical +debconf debconf/frontend select Noninteractive + +compute-tools container/mode select debian + +#compute-tools container/preseed-files string +#compute-tools container/include-preseed-files string + +compute-tools container/distribution select buster +#compute-tools container/parent-distribution select + +compute-tools container/architecture select auto + +compute-tools container/archives multiselect buster-security, buster-updates +#compute-tools container/parent-archives multiselect + +compute-tools container/mirror string https://deb.debian.org/debian +compute-tools container/mirror-security string http://security.debian.org + +#compute-tools container/parent-mirror string +#compute-tools container/parent-mirror-security string + +compute-tools container/archive-areas multiselect main +#compute-tools container/parent-archive-areas multiselect + +compute-tools container/packages string openssh-server + +compute-tools container/root-password string debian +#compute-tools container/root-password-crypted string + +compute-tools container/network1/bridge string bridge0 +#compute-tools container/network-mac string diff --git a/share/doc/examples/container-images.sh b/share/doc/examples/container-images.sh index 07f3451..f677799 100755 --- a/share/doc/examples/container-images.sh +++ b/share/doc/examples/container-images.sh @@ -1,7 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# # Description: example for automated Debian base system container image creation # Requires: debootstrap plzip xz-utils # Usage: sudo ./container-images.sh @@ -9,7 +7,7 @@ set -e ARCHITECTURES="amd64 i386" -DISTRIBUTIONS="stretch sid" +DISTRIBUTIONS="buster sid" MIRROR="https://deb.debian.org/debian" INCLUDE="dbus" diff --git a/share/doc/examples/dschinn-backports.cfg b/share/doc/examples/dschinn-backports.cfg deleted file mode 100644 index 4f72268..0000000 --- a/share/doc/examples/dschinn-backports.cfg +++ /dev/null @@ -1,72 +0,0 @@ -# container-tools - Manage systemd-nspawn containers -# -# example for automated Progress Linux 4+ (dschinn-backports) container creation -# using: sudo container create -s progress-linux - -debconf debconf/priority select critical -debconf debconf/frontend select Noninteractive - -container-tools cnt-debconf/mode select progress-linux - -#container-tools cnt-debconf/preseed-files string -#container-tools cnt-debconf/include-preseed-files string - -container-tools cnt-debconf/distribution select dschinn-backports -#container-tools cnt-debconf/parent-distribution select - -container-tools cnt-debconf/architecture select auto - -container-tools cnt-debconf/archives multiselect dschinn-security, dschinn-updates, dschinn-extras, dschinn-backports, dschinn-backports-extras -#container-tools cnt-debconf/parent-archives multiselect - -container-tools cnt-debconf/mirror string https://cdn.archive.progress-linux.org/packages -container-tools cnt-debconf/mirror-security string https://cdn.archive.progress-linux.org/packages - -container-tools cnt-debconf/parent-mirror string https://deb.debian.org/debian -container-tools cnt-debconf/parent-mirror-security string http://security.debian.org - -container-tools cnt-debconf/archive-areas multiselect main, contrib, non-free -container-tools cnt-debconf/parent-archive-areas multiselect main, contrib, non-free - -container-tools cnt-debconf/packages string knot-resolver openssh-server - -container-tools cnt-debconf/root-password string progress -#container-tools cnt-debconf/root-password-crypted string - -# Network IP configuration -container-tools cnt-debconf/network1/bridge string bridge0 -container-tools cnt-debconf/network1/veth string veth0 -container-tools cnt-debconf/network1/ipv4-method select static -container-tools cnt-debconf/network1/ipv4-comment string Primary network interfaces -container-tools cnt-debconf/network1/ipv4-address string 192.168.0.2 -container-tools cnt-debconf/network1/ipv4-gateway string 192.168.0.1 -container-tools cnt-debconf/network1/ipv4-netmask string 255.255.255.0 -#container-tools cnt-debconf/network1/ipv4-post-up string -#container-tools cnt-debconf/network1/ipv4-post-down string - -# Network DNS configuration -container-tools cnt-debconf/nameserver/server string 127.0.0.1 8.8.8.8 8.8.4.4 -container-tools cnt-debconf/nameserver/domain string example.net -container-tools cnt-debconf/nameserver/search string example.net -container-tools cnt-debconf/nameserver/options string timeout:1 attempts:1 - -# Third-Party Repositories -#container-tools cnt-debconf/archive1/repository string -#container-tools cnt-debconf/archive1/list string -#container-tools cnt-debconf/archive1/comment string -#container-tools cnt-debconf/archive1/source string -#container-tools cnt-debconf/archive1/key string -#container-tools cnt-debconf/archive1/preferences-package string -#container-tools cnt-debconf/archive1/preferences-pin string -#container-tools cnt-debconf/archive1/preferences-pin-priority - -# Internal Options -#container-tools cnt-debconf/apt-recommends string -#container-tools cnt-debconf/debconf-frontend string -#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/overlay string -#container-tools cnt-debconf/bind string -#container-tools cnt-debconf/bind-ro string diff --git a/share/doc/examples/engywuck-backports.cfg b/share/doc/examples/engywuck-backports.cfg new file mode 100644 index 0000000..392c40d --- /dev/null +++ b/share/doc/examples/engywuck-backports.cfg @@ -0,0 +1,70 @@ +# example for automated Progress Linux 5+ (engywuck-backports) container creation +# using: sudo container create -s progress-linux + +debconf debconf/priority select critical +debconf debconf/frontend select Noninteractive + +compute-tools container/mode select progress-linux + +#compute-tools container/preseed-files string +#compute-tools container/include-preseed-files string + +compute-tools container/distribution select engywuck-backports +#compute-tools container/parent-distribution select + +compute-tools container/architecture select auto + +compute-tools container/archives multiselect engywuck-security, engywuck-updates, engywuck-extras, engywuck-backports, engywuck-backports-extras +#compute-tools container/parent-archives multiselect + +compute-tools container/mirror string https://cdn.deb.progress-linux.org/packages +compute-tools container/mirror-security string https://cdn.deb.progress-linux.org/packages + +compute-tools container/parent-mirror string https://deb.debian.org/debian +compute-tools container/parent-mirror-security string http://security.debian.org + +compute-tools container/archive-areas multiselect main, contrib, non-free +compute-tools container/parent-archive-areas multiselect main, contrib, non-free + +compute-tools container/packages string knot-resolver openssh-server + +compute-tools container/root-password string progress +#compute-tools container/root-password-crypted string + +# Network IP configuration +compute-tools container/network1/bridge string bridge0 +compute-tools container/network1/veth string veth0 +compute-tools container/network1/ipv4-method select static +compute-tools container/network1/ipv4-comment string Primary network interfaces +compute-tools container/network1/ipv4-address string 192.168.0.2 +compute-tools container/network1/ipv4-gateway string 192.168.0.1 +compute-tools container/network1/ipv4-netmask string 255.255.255.0 +#compute-tools container/network1/ipv4-post-up string +#compute-tools container/network1/ipv4-post-down string + +# Network DNS configuration +compute-tools container/nameserver/server string 127.0.0.1 8.8.8.8 8.8.4.4 +compute-tools container/nameserver/domain string example.net +compute-tools container/nameserver/search string example.net +compute-tools container/nameserver/options string timeout:1 attempts:1 + +# Third-Party Repositories +#compute-tools container/archive1/repository string +#compute-tools container/archive1/list string +#compute-tools container/archive1/comment string +#compute-tools container/archive1/source string +#compute-tools container/archive1/key string +#compute-tools container/archive1/preferences-package string +#compute-tools container/archive1/preferences-pin string +#compute-tools container/archive1/preferences-pin-priority + +# Internal Options +#compute-tools container/apt-recommends string +#compute-tools container/debconf-frontend string +#compute-tools container/debconf-priority string +#compute-tools container/container-command string +#compute-tools container/host-command string +compute-tools container/auto string true +#compute-tools container/overlay string +#compute-tools container/bind string +#compute-tools container/bind-ro string diff --git a/share/doc/examples/stretch.cfg b/share/doc/examples/stretch.cfg deleted file mode 100644 index 4a137b7..0000000 --- a/share/doc/examples/stretch.cfg +++ /dev/null @@ -1,37 +0,0 @@ -# container-tools - Manage systemd-nspawn containers -# -# example for automated Debian 9 (stretch) based container creation -# using: sudo container create -s debian - -debconf debconf/priority select critical -debconf debconf/frontend select Noninteractive - -container-tools cnt-debconf/mode select debian - -#container-tools cnt-debconf/preseed-files string -#container-tools cnt-debconf/include-preseed-files string - -container-tools cnt-debconf/distribution select stretch -#container-tools cnt-debconf/parent-distribution select - -container-tools cnt-debconf/architecture select auto - -container-tools cnt-debconf/archives multiselect stretch-security, stretch-updates -#container-tools cnt-debconf/parent-archives multiselect - -container-tools cnt-debconf/mirror string https://deb.debian.org/debian -container-tools cnt-debconf/mirror-security string http://security.debian.org - -#container-tools cnt-debconf/parent-mirror string -#container-tools cnt-debconf/parent-mirror-security string - -container-tools cnt-debconf/archive-areas multiselect main -#container-tools cnt-debconf/parent-archive-areas multiselect - -container-tools cnt-debconf/packages string openssh-server - -container-tools cnt-debconf/root-password string debian -#container-tools cnt-debconf/root-password-crypted string - -container-tools cnt-debconf/network1/bridge string bridge0 -#container-tools cnt-debconf/network-mac string diff --git a/share/hooks/pre-create.git-pull.sh b/share/hooks/pre-create.git-pull.sh index cee7d8c..a82a7a0 100755 --- a/share/hooks/pre-create.git-pull.sh +++ b/share/hooks/pre-create.git-pull.sh @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,7 +19,10 @@ set -e -DIRECTORIES="/etc/container-tools/debconf /etc/container-tools/debconf/*/" +PROJECT="open-infrastructure" +PROGRAM="container" + +DIRECTORIES="/etc/${PROJECT}/${PROGRAM}/debconf /etc/${PROJECT}/${PROGRAM}/debconf/*/" for DIRECTORY in ${DIRECTORIES} do @@ -28,9 +30,9 @@ do then echo "Updating ${DIRECTORY}..." - if [ -e /etc/default/container-tools ] + if [ -e "/etc/${PROJECT}/${PROGRAM}.conf" ] then - . /etc/default/container-tools + . "/etc/${PROJECT}/${PROGRAM}.conf" fi DEBCONF_ID="${DEBCONF_ID:-HEAD}" diff --git a/share/logrotate/container-tools b/share/logrotate/container index 18aa713..14599be 100644 --- a/share/logrotate/container-tools +++ b/share/logrotate/container @@ -1,4 +1,4 @@ -/var/log/container-tools/container.log { +/var/log/open-infrastructure/container.log { compress create 0640 root adm dateext diff --git a/share/man/Makefile b/share/man/Makefile index a069734..4f5b682 100644 --- a/share/man/Makefile +++ b/share/man/Makefile @@ -1,7 +1,6 @@ # Makefile -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # diff --git a/share/man/container-tools.7.txt b/share/man/compute-tools.7.txt index 8195ea4..5a4d6db 100644 --- a/share/man/container-tools.7.txt +++ b/share/man/compute-tools.7.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,13 +19,13 @@ CONTAINER-TOOLS(7) ================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} NAME ---- -container-tools - Manage systemd-nspawn containers +compute-tools - Manage systemd-nspawn containers DESCRIPTION @@ -34,15 +33,15 @@ DESCRIPTION "[A Linux container] is an operating-system-level virtualization environment for running multiple isolated Linux systems (containers) on a single Linux control host.":: -- Wikipedia (https://en.wikipedia.org/wiki/LXC) -container-tools provides the system integration for managing containers using systemd-nspawn. +compute-tools provides the system integration for managing containers using systemd-nspawn. DOWNLOAD -------- - * Upstream Releases: https://files.open-infrastructure.net/software/container-tools/upstream - * Upstream Sources: https://sources.open-infrastructure.net/software/container-tools - * Debian Releases: https://files.open-infrastructure.net/software/container-tools/debian - * Debian Sources: https://sources.progress-linux.org/users/daniel/debian/packages/open-infrastructure-container-tools + * Upstream Releases: https://get.open-infrastructure.net/software/compute-tools/upstream + * Upstream Sources: https://git.open-infrastructure.net/software/compute-tools + * Debian Releases: https://get.open-infrastructure.net/software/compute-tools/debian + * Debian Sources: https://git.progress-linux.org/users/daniel/debian/packages/open-infrastructure-compute-tools INSTALLATION @@ -51,8 +50,8 @@ INSTALLATION SOURCE ~~~~~~ 1. sudo apt install asciidoc git docbook-xml docbook-xsl libxml2-utils make xsltproc dbus systemd-container - 2. git clone https://sources.open-infrastructure.net/software/container-tools - 3. cd container-tools && sudo make install + 2. git clone https://git.open-infrastructure.net/software/compute-tools + 3. cd compute-tools && sudo make install DEBIAN 9 (STRETCH) AND NEWER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -77,7 +76,7 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System: KNOWN LIMITATIONS ----------------- - * This version of container-tools currently do not work with systemd-networkd and depend on ifupdown. + * This version of compute-tools currently do not work with systemd-networkd and depend on ifupdown. * Using overlay, the upper directory can not be an NFS mount due to limitations in Linux' overlay filesystem, see https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/overlayfs.txt @@ -99,7 +98,7 @@ USAGE *List container on the system:*:: sudo container list -*Show container-tools version:*:: +*Show container version:*:: container version See container(1) for a list of all container commands. @@ -131,4 +130,4 @@ LINKS AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-auto.1.txt b/share/man/container-auto.1.txt index f1ab951..0d0a633 100644 --- a/share/man/container-auto.1.txt +++ b/share/man/container-auto.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-START(1) ================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -64,13 +63,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -83,4 +82,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-console.1.txt b/share/man/container-console.1.txt index 4ea8216..54cf242 100644 --- a/share/man/container-console.1.txt +++ b/share/man/container-console.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-CONSOLE(1) ==================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -58,13 +57,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -77,4 +76,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-create-curl.1.txt b/share/man/container-create-curl.1.txt index 6486c9b..40028c9 100644 --- a/share/man/container-create-curl.1.txt +++ b/share/man/container-create-curl.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-CREATE-CURL(1) ======================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -63,7 +62,7 @@ The following script options are available: Specify the root password, defaults to a random 16 character password. *--server='SERVER'*:: - Specify the image server to download from, defaults to https://files.open-infrastructure.net/system/container/debian. + Specify the image server to download from, defaults to https://get.open-infrastructure.net/system/container/debian. *--setup='SETUP'*:: Specify the setup image name to download, defaults to the value specified through --system using the setup.tar.${COMPRESSION} suffix. @@ -84,37 +83,37 @@ FILES ----- The following files are used: -*/etc/container-tools/config*:: +*/etc/open-infrastructure/container/config*:: Container configuration files. -*/usr/share/container-tools/scripts*:: +*/usr/share/open-infrastructure/container/scripts*:: Container creation scripts. -*/usr/share/doc/container-tools*:: +*/usr/share/doc/compute-tools*:: Container documentation. */var/lib/machines*:: Container directory. -*/var/cache/container-tools*:: +*/var/cache/open-infrastructure/container*:: Container cache directory. CONTAINER IMAGES ---------------- -container-tools will download tarballs from a server expecting that the images are tarballs with either gzip, lzip, xz, or no compression. See container-images.sh as an example on how to create your own container images. +compute-tools will download tarballs from a server expecting that the images are tarballs with either gzip, lzip, xz, or no compression. See container-images.sh as an example on how to create your own container images. SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -127,4 +126,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-create-debconf.1.txt b/share/man/container-create-debconf.1.txt index a86d964..e6f2582 100644 --- a/share/man/container-create-debconf.1.txt +++ b/share/man/container-create-debconf.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-CREATE-DEBOOTSTRAP(1) =============================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -113,34 +112,34 @@ FILES ----- The following files are used: -*/etc/container-tools/config*:: +*/etc/open-infrastructure/container/config*:: Container configuration files. -*/usr/share/container-tools/scripts*:: +*/usr/share/open-infrastructure/container/scripts*:: Container creation scripts. -*/usr/share/doc/container-tools*:: +*/usr/share/doc/compute-tools*:: Container documentation. */var/lib/machines*:: Container directory. -*/var/cache/container-tools*:: +*/var/cache/open-infrastructure/container*:: Container cache directory. -*/tmp/container-tools*:: +*/tmp/compute-tools*:: Container temporary directory. SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -153,4 +152,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-create-debootstrap.1.txt b/share/man/container-create-debootstrap.1.txt index da578bd..fc8651e 100644 --- a/share/man/container-create-debootstrap.1.txt +++ b/share/man/container-create-debootstrap.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-CREATE-DEBOOTSTRAP(1) =============================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -76,13 +75,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -95,4 +94,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-create.1.txt b/share/man/container-create.1.txt index 4e88175..d36a694 100644 --- a/share/man/container-create.1.txt +++ b/share/man/container-create.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-CREATE(1) =================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -82,7 +81,7 @@ The following container scripts are available: 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'. + 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_script'. EXAMPLES @@ -101,13 +100,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -120,4 +119,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-enter.1.txt b/share/man/container-enter.1.txt index 5051d74..aaf14de 100644 --- a/share/man/container-enter.1.txt +++ b/share/man/container-enter.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-CONSOLE(1) ==================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -58,13 +57,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -77,4 +76,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-key.1.txt b/share/man/container-key.1.txt index 448bd56..7e7f376 100644 --- a/share/man/container-key.1.txt +++ b/share/man/container-key.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-KEY(1) ================ :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -65,13 +64,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -84,4 +83,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-limit.1.txt b/share/man/container-limit.1.txt index a36328a..62f0288 100644 --- a/share/man/container-limit.1.txt +++ b/share/man/container-limit.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-LIMIT(1) ================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -88,13 +87,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -107,4 +106,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-list.1.txt b/share/man/container-list.1.txt index 8a018b0..1916a6b 100644 --- a/share/man/container-list.1.txt +++ b/share/man/container-list.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-LIST(1) ================= :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -105,13 +104,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -124,4 +123,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-log.1.txt b/share/man/container-log.1.txt new file mode 100644 index 0000000..ea5ab91 --- /dev/null +++ b/share/man/container-log.1.txt @@ -0,0 +1,90 @@ +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// +// SPDX-License-Identifier: GPL-3.0+ +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +CONTAINER-LOG(1) +================ +:doctype: manpage +:man manual: Open Infrastructure +:man source: compute-tools +:man version: {revnumber} + + +NAME +---- +container-log - Show container log + + +SYNOPSIS +-------- +*container log* ['OPTIONS'] + + +DESCRIPTION +----------- +The container log command shows the container log. + + +OPTIONS +------- +The following container options are available: + +*-d, --date*:: + Show only log entries of the specified date as 'YYYY-MM-DD' or a date range like 'today-7'. + +*-n, --name*:: + Show only log entries for the specified container. + +EXAMPLES +-------- +*Show all log entries:*:: + sudo container log + +*Show only log entries of today:*:: + sudo container log -d today + +*Show only log entries of yesterday:*:: + sudo container log -d yesterday + +*Show all log entries of the example.net container:*:: + sudo container log -n example.net + +*Show only log entries of the example.net container of the last 30 days:*:: + sudo container log -d today-30 -n example.net + + +SEE ALSO +-------- +compute-tools(7), +container(1). + + +HOMEPAGE +-------- +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. + + +CONTACT +------- +Bug reports, feature requests, help, patches, support and everything else +are welcome on the Open Infrastructure Software Mailing List <software@lists.open-infrastructure.net>. + +Debian specific bugs can also be reported in the Debian Bug Tracking System at https://bugs.debian.org. + + +AUTHORS +------- +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-move.1.txt b/share/man/container-move.1.txt index 172bd67..2320dfb 100644 --- a/share/man/container-move.1.txt +++ b/share/man/container-move.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-REMOVE(1) =================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -66,13 +65,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -85,4 +84,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-remove.1.txt b/share/man/container-remove.1.txt index 94d167b..b3fb1f7 100644 --- a/share/man/container-remove.1.txt +++ b/share/man/container-remove.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-REMOVE(1) =================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -75,13 +74,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -94,4 +93,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-restart.1.txt b/share/man/container-restart.1.txt index 99b461d..f3780b6 100644 --- a/share/man/container-restart.1.txt +++ b/share/man/container-restart.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-RESTART(1) ==================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -58,13 +57,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -77,4 +76,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-shell.1.txt b/share/man/container-shell.1.txt index bd0f4e1..0fd1aa9 100644 --- a/share/man/container-shell.1.txt +++ b/share/man/container-shell.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER(1) ============ :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -36,7 +35,7 @@ SYNOPSIS DESCRIPTION ----------- -container-tools provides the system integration for managing containers using systemd-nspawn. +compute-tools provides the system integration for managing containers using systemd-nspawn. COMMANDS @@ -63,13 +62,13 @@ needing a regular shell login on the container server. For usage over SSH a unprivileged user should be created: - sudo adduser --gecos "container-tools,,," \ - --home /var/lib/container-tools/container-shell \ + sudo adduser --gecos "compute-tools,,," \ + --home /var/lib/open-infrastructure/container-shell \ --shell /usr/bin/container-shell -The container-shell can then be allowed for specific SSH keys via /var/ib/container-tools/container-shell/.ssh/authorized_keys like so: +The container-shell can then be allowed for specific SSH keys via /var/lib/open-infrastructure/container-shell/.ssh/authorized_keys like so: - command="/usr/bin/container-shell",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa [...] + command="/usr/bin/container-shell",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-ed25519 [...] RESTRICTED SHELL @@ -84,7 +83,7 @@ Example (blacklisting): In order to allow all commands except for removing and s command="CONTAINER_COMMANDS_DISABLE='remove stop' /usr/bin/container-shell",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa [...] -Example (whitelisting): The other way around works too. To disallow all commands except for listing containers and showing the container-tools version, the following variable can be used: +Example (whitelisting): The other way around works too. To disallow all commands except for listing containers and showing the compute-tools version, the following variable can be used: command="CONTAINER_COMMANDS_ENABLE='list version' /usr/bin/container-shell",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa [...] @@ -97,7 +96,7 @@ systemd-nspawn(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -110,4 +109,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-start.1.txt b/share/man/container-start.1.txt index ae4ff89..544d155 100644 --- a/share/man/container-start.1.txt +++ b/share/man/container-start.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-START(1) ================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -61,13 +60,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -80,4 +79,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-status.1.txt b/share/man/container-status.1.txt index b403769..d4d06a9 100644 --- a/share/man/container-status.1.txt +++ b/share/man/container-status.1.txt @@ -1,4 +1,3 @@ -// container-tools - Manage systemd-nspawn containers // Copyright (C) 2016 Simon Spöehel <simon.spoehel@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ @@ -20,7 +19,7 @@ CONTAINER-STATUS(1) =================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -55,13 +54,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -74,4 +73,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-stop.1.txt b/share/man/container-stop.1.txt index ec169d8..62cfcd3 100644 --- a/share/man/container-stop.1.txt +++ b/share/man/container-stop.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-STOP(1) ================= :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -64,13 +63,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -83,4 +82,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-top.1.txt b/share/man/container-top.1.txt index 2f99c5b..b603557 100644 --- a/share/man/container-top.1.txt +++ b/share/man/container-top.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER-TOP(1) ================ :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -55,13 +54,13 @@ EXAMPLES SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -74,4 +73,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container-version.1.txt b/share/man/container-version.1.txt index 19a1138..d774401 100644 --- a/share/man/container-version.1.txt +++ b/share/man/container-version.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,13 +19,13 @@ CONTAINER-VERSION(1) ==================== :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} NAME ---- -container-version - Show container-tools version +container-version - Show container version SYNOPSIS @@ -38,7 +37,7 @@ SYNOPSIS DESCRIPTION ----------- -The container version command shows the container-tools version number. +The container version command shows the container version number. OPTIONS @@ -48,19 +47,19 @@ This command has no options. EXAMPLES -------- -*Show container-tools version:*:: +*Show container version:*:: container version SEE ALSO -------- -container-tools(7), +compute-tools(7), container(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -73,4 +72,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/man/container.1.txt b/share/man/container.1.txt index 0473958..aba9141 100644 --- a/share/man/container.1.txt +++ b/share/man/container.1.txt @@ -1,5 +1,4 @@ -// container-tools - Manage systemd-nspawn containers -// Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +// Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> // // SPDX-License-Identifier: GPL-3.0+ // @@ -20,7 +19,7 @@ CONTAINER(1) ============ :doctype: manpage :man manual: Open Infrastructure -:man source: container-tools +:man source: compute-tools :man version: {revnumber} @@ -37,7 +36,7 @@ SYNOPSIS DESCRIPTION ----------- -container-tools provides the system integration for managing containers using systemd-nspawn. +compute-tools provides the system integration for managing containers using systemd-nspawn. OPTIONS @@ -85,6 +84,9 @@ The following container commands are available: *list*:: List container on the system, see container-list(1). +*log*:: + Show container log, see container-log(1). + *status*:: Show container status, see container-status(1). @@ -92,14 +94,14 @@ The following container commands are available: Dynamic list of container on the system, see container-top(1). *version*:: - Show container-tools version, see container-version(1). + Show container version, see container-version(1). FILES ----- The following files are used: -*/etc/container-tools*:: +*/etc/open-infrastructure/container*:: Container configuration files. */usr/bin/container*, */usr/bin/cnt*:: @@ -108,22 +110,22 @@ The following files are used: */usr/bin/container-shell*, */usr/bin/cntsh*:: Container shell program. -*/usr/lib/container-tools*:: +*/usr/lib/open-infrastructure/container*:: Container commands. -*/usr/share/container-tools*:: +*/usr/share/open-infrastructure/container*:: Container shared data. -*/usr/share/doc/container-tools*:: +*/usr/share/doc/compute-tools*:: Container documentation files. -*/var/cache/container-tools*:: +*/var/cache/open-infrastructure/container*:: Container cache directory. */var/lib/machines*:: Container root directory. -*/var/log/container-tools*:: +*/var/log/open-infrastructure*:: Container log files. @@ -135,7 +137,7 @@ systemd-nspawn(1). HOMEPAGE -------- -More information about container-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. +More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. CONTACT @@ -148,4 +150,4 @@ Debian specific bugs can also be reported in the Debian Bug Tracking System at h AUTHORS ------- -container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. +compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. diff --git a/share/procps/zz-container-tools.conf b/share/procps/zz-container.conf index 8b15f11..c464c42 100644 --- a/share/procps/zz-container-tools.conf +++ b/share/procps/zz-container.conf @@ -11,3 +11,6 @@ fs.inotify.max_user_instances=1048576 # /proc/sys/fs/inotify/max_user_watches defaults to 8192 fs.inotify.max_user_watches=1048576 + +# Enabling user namespace, disabled by default (#898446) +#kernel.unprivileged_userns_clone=1 diff --git a/share/scripts/curl b/share/scripts/curl index 72bdec3..80ccde6 100755 --- a/share/scripts/curl +++ b/share/scripts/curl @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,12 +19,15 @@ set -e +PROJECT="open-infrastructure" +SOFTWARE="compute-tools" +PROGRAM="container" SCRIPT="${0}" -HOOKS="/etc/container-tools/hooks" -KEYS="/etc/container-tools/keys" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" +KEYS="/etc/${PROJECT}/${PROGRAM}/keys" MACHINES="/var/lib/machines" -CACHE="/var/cache/container-tools/system" +CACHE="/var/cache/${PROJECT}/${PROGRAM}/system" Parameters () { @@ -172,7 +174,7 @@ then exit 1 fi -SERVER="${SERVER:-https://files.open-infrastructure.net/system/container/debian}" +SERVER="${SERVER:-https://get.open-infrastructure.net/system/container/debian}" PASSWORD="${PASSWORD:-$(dd if=/dev/urandom bs=12 count=1 2> /dev/null | base64)}" VERSION="$(container version)" @@ -241,8 +243,8 @@ then # Downloading container list if curl --fail --head --output /dev/null --silent "${SERVER}/container-list.txt" then - mkdir -p /tmp/container-tools - DEBCONF_TMPDIR="$(mktemp -d -p /tmp/container-tools -t $(basename ${0}).XXXX)" + mkdir -p "/tmp/${SOFTWARE}" + DEBCONF_TMPDIR="$(mktemp -d -p "/tmp/${SOFTWARE}" -t $(basename ${0}).XXXX)" export DEBCONF_TMPDIR if [ -z "${ARCHITECTURE}" ] @@ -257,7 +259,7 @@ then GREP_PATTERN="${GREP_PATTERN:-${ARCHITECTURE}}" echo "Downloading $(echo ${SERVER} | awk -F/ '{ print $3 }') container list" - curl --fail --location --progress-bar --user-agent container-tools/${VERSION} ${CURL_OPTIONS} \ + curl --fail --location --progress-bar --user-agent ${SOFTWARE}/${VERSION} ${CURL_OPTIONS} \ "${SERVER}/container-list.txt" | grep -E "${GREP_PATTERN}" > "${DEBCONF_TMPDIR}/container-list.txt" umask 0022 @@ -265,12 +267,12 @@ then Debconf # Run debconf parts - for DEBCONF_SCRIPT in /usr/share/container-tools/scripts/curl.d/* + for DEBCONF_SCRIPT in /usr/share/${PROJECT}/${PROGRAM}/scripts/curl.d/* do if [ -x "${DEBCONF_SCRIPT}" ] then # FIXME - # debconf -ocontainer-tools "${DEBCONF_SCRIPT}" + # debconf -o${SOFTWARE} "${DEBCONF_SCRIPT}" "${DEBCONF_SCRIPT}" fi done @@ -280,7 +282,7 @@ then # Remove debconf temporary files rm --preserve-root --one-file-system -rf "${DEBCONF_TMPDIR}" - rmdir --ignore-fail-on-non-empty /tmp/container-tools 2>&1 || true + rmdir --ignore-fail-on-non-empty "/tmp/${SOFTWARE}" 2>&1 || true fi fi @@ -320,7 +322,7 @@ do fi echo "Downloading ${FILE}" - curl --fail --location --progress-bar --user-agent container-tools/${VERSION} ${CURL_OPTIONS} ${CURL_TIME_COND} \ + curl --fail --location --progress-bar --user-agent ${SOFTWARE}/${VERSION} ${CURL_OPTIONS} ${CURL_TIME_COND} \ "${SERVER}/${FILE}" -o "${CACHE}/${FILE}" fi done diff --git a/share/scripts/curl.d/0001-debconf b/share/scripts/curl.d/0001-debconf index 1f31b63..3f98f74 100755 --- a/share/scripts/curl.d/0001-debconf +++ b/share/scripts/curl.d/0001-debconf @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # diff --git a/share/scripts/debconf b/share/scripts/debconf index 5325c11..fbb20fa 100755 --- a/share/scripts/debconf +++ b/share/scripts/debconf @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,11 +19,14 @@ set -e +PROJECT="open-infrastructure" +SOFTWARE="compute-tools" +PROGRAM="container" SCRIPT="${0}" export SCRIPT -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -157,7 +159,7 @@ Upgrade_system () # Disable dpkg syncing -cat > "${DIRECTORY}/etc/dpkg/dpkg.cfg.d/container-tools" << EOF +cat > "${DIRECTORY}/etc/dpkg/dpkg.cfg.d/${SOFTWARE}" << EOF force-unsafe-io EOF @@ -190,7 +192,7 @@ Cleanup_system () Chroot "${DIRECTORY}" "apt-get clean" # Cleanup - rm -f "${DIRECTORY}/etc/dpkg/dpkg.cfg.d/container-tools" + rm -f "${DIRECTORY}/etc/dpkg/dpkg.cfg.d/${SOFTWARE}" rm -f "${DIRECTORY}/usr/sbin/policy-rc.d" # Unmount pseudo-filesystems @@ -202,8 +204,8 @@ Cleanup_system () Debconf () { # Configure local debconf - mkdir -p /tmp/container-tools - DEBCONF_TMPDIR="$(mktemp -d -p /tmp/container-tools -t $(basename ${0}).XXXX)" + mkdir -p "/tmp/${SOFTWARE}" + DEBCONF_TMPDIR="$(mktemp -d -p "/tmp/${SOFTWARE}" -t $(basename ${0}).XXXX)" export DEBCONF_TMPDIR mkdir -p "${DEBCONF_TMPDIR}/debconf" @@ -247,12 +249,18 @@ Debootstrap () EXCLUDE="ifupdown" INCLUDE="dbus" - if echo "${MIRROR}" | grep -qs '^https' || \ - echo "{PARENT_MIRROR}" | grep -qs '^https' + if ( echo "${MIRROR}" | grep -qs '^https' ) || \ + ( echo "${PARENT_MIRROR}" | grep -qs '^https' ) then INCLUDE="${INCLUDE},apt-transport-https,ca-certificates" fi + case "${MODE}" in + progress-linux) + INCLUDE="${INCLUDE},progress-linux,gnupg" + ;; + esac + mkdir -p "$(dirname ${DIRECTORY})" debootstrap --verbose --arch=${ARCHITECTURE} --components=${PARENT_ARCHIVE_AREAS} \ --exclude=${EXCLUDE} --include=${INCLUDE} ${PARENT_DISTRIBUTION} "${DIRECTORY}" ${PARENT_MIRROR} @@ -332,58 +340,7 @@ EOF ;; esac - # Import archive keys - KEYS="project/pgp/archive-key-${DIST}.asc" - - for KEY in ${KEYS} - do - KEY_NAME="$(basename ${KEY})" - echo "P: Fetching archive-key ${KEY_NAME}..." - - wget -q "${MIRROR}/${KEY}" -O "${DIRECTORY}/key.asc" - wget -q "${MIRROR}/${KEY}.gpg" -O "${DIRECTORY}/key.asc.gpg" - - if [ -e /usr/bin/gpgv ] - then - if [ -e /usr/share/keyrings/debian-keyring.gpg ] || [ -e /usr/share/keyrings/debian-maintainers.gpg ] - then - KEY_VALID="" - - for KEYRING in /usr/share/keyrings/debian-keyring.gpg /usr/share/keyrings/debian-maintainers.gpg - do - if [ -e "${KEYRING}" ] - then - echo -n "I: Verifying archive-key ${KEY_NAME} against $(basename ${KEYRING} .gpg | sed -e 's|-keyring||') keyring..." - - # FIXME: doesn't work anymore when the template eventually be run with 'set -e' - /usr/bin/gpgv --quiet --keyring ${KEYRING} "${DIRECTORY}/key.asc.gpg" "${DIRECTORY}/key.asc" > /dev/null 2>&1 && KEY_VALID="true" && break - fi - done - - case "${KEY_VALID}" in - true) - echo " successful." - ;; - - *) - echo " failed." - return 1 - ;; - esac - else - echo "W: Skipping archive-key ${KEY_NAME} verification, debian-keyring not available..." - fi - else - echo "W: Skipping archive-key ${KEY_NAME} verification, gpgv not available..." - fi - - echo "P: Importing archive-key ${KEY_NAME}..." - - Chroot "${DIRECTORY}" "apt-key add key.asc" - rm -f "${DIRECTORY}/key.asc" - rm -f "${DIRECTORY}/key.asc.gpg" - done - + Chroot "${DIRECTORY}" "apt-key add /usr/share/progress-linux/pgp-keys/apt.progress-linux.org.gpg" Chroot "${DIRECTORY}" "apt-get update" ;; esac @@ -898,7 +855,7 @@ EOF cat > "${DIRECTORY}/etc/systemd/system/cnt-ipv4-post-up-eno${NUMBER}.service" << EOF [Unit] -Description=container-tools IPV4_POST_UP +Description=${SOFTWARE} IPV4_POST_UP After=network-online.target Wants=network-online.target @@ -918,7 +875,7 @@ EOF cat > "${DIRECTORY}/etc/systemd/system/cnt-ipv4-post-down-eno${NUMBER}.service" << EOF [Unit] -Description=container-tools IPV4_POST_DOWN +Description=${SOFTWARE} IPV4_POST_DOWN After=network.target Wants=network.target @@ -1031,12 +988,12 @@ do done # Run debconf parts -for DEBCONF_SCRIPT in /usr/share/container-tools/scripts/debconf.d/* +for DEBCONF_SCRIPT in "/usr/share/${PROJECT}/${PROGRAM}/scripts/debconf.d"/* do if [ -x "${DEBCONF_SCRIPT}" ] then # FIXME - # debconf -ocontainer-tools "${DEBCONF_SCRIPT}" + # debconf -o${SOFTWARE} "${DEBCONF_SCRIPT}" "${DEBCONF_SCRIPT}" fi done @@ -1044,7 +1001,7 @@ done # Read-in configuration from debconf . "${DEBCONF_TMPDIR}/debconf.default" -CACHE="/var/cache/container-tools/${MODE}" +CACHE="/var/cache/${PROJECT}/${PROGRAM}/${MODE}" SYSTEM="${MACHINES}/${NAME}" ## Generic parts @@ -1057,7 +1014,7 @@ then mv "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}.tmp" "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" fi -Upgrade_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" || echo "W: If upgrading the system failed, try removing the cache for your distribution in /var/cache/container-tools" +Upgrade_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" || echo "W: If upgrading the system failed, try removing the cache for your distribution in /var/cache/${PROJECT}/${PROGRAM}" Cleanup_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" ## Specific parts @@ -1175,7 +1132,7 @@ fi # remove debconf temporary files rm --preserve-root --one-file-system -rf "${DEBCONF_TMPDIR}" -rmdir --ignore-fail-on-non-empty /tmp/container-tools 2>&1 || true +rmdir --ignore-fail-on-non-empty "/tmp/${SOFTWARE}" 2>&1 || true # Post hooks for FILE in "${HOOKS}/post-${SCRIPT}".* "${HOOKS}/${NAME}.post-${SCRIPT}" diff --git a/share/scripts/debconf.d/0001-preseed-file b/share/scripts/debconf.d/0001-preseed-file index fab7d8d..d9ff245 100755 --- a/share/scripts/debconf.d/0001-preseed-file +++ b/share/scripts/debconf.d/0001-preseed-file @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,7 +19,10 @@ set -e -CONFIG="/etc/container-tools/debconf" +PROJECT="open-infrastructure" +PROGRAM="container" + +CONFIG="/etc/${PROJECT}/${PROGRAM}/debconf" DEBCONF_NOWARNINGS="true" export DEBCONF_NOWARNINGS @@ -30,28 +32,28 @@ export DEBCONF_NOWARNINGS if [ -n "${PRESEED_FILE}" ] 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 + db_set container/preseed-file "${PRESEED_FILE}" + db_fset container/preseed-file seen true elif [ -e "${CONFIG}/${NAME}.cfg" ] then # user did not specify a pressed file, but there is a matching one # available on the system matching the container name - db_set cnt-debconf/preseed-file "${CONFIG}/${NAME}.cfg" - db_fset cnt-debconf/preseed-file seen true + db_set container/preseed-file "${CONFIG}/${NAME}.cfg" + db_fset container/preseed-file seen true elif [ "$(ls ${CONFIG}/*/${NAME}.cfg 2>/dev/null | wc -l)" -eq 1 ] then # user did not specify a pressed file, but there is 1 (and only 1) - # matching in a sub-directory of /etc/container-tools/debconf + # matching in a sub-directory of /etc/${PROJECT}/${PROGRAM}/debconf FILE="$(ls ${CONFIG}/*/${NAME}.cfg)" - db_set cnt-debconf/preseed-file "${FILE}" - db_fset cnt-debconf/preseed-file seen true + db_set container/preseed-file "${FILE}" + db_fset container/preseed-file seen true elif [ -e "${CONFIG}/default.cfg" ] then # user did not specify a pressed file, but there is a default one - db_set cnt-debconf/preseed-file "${CONFIG}/default.cfg" - db_fset cnt-debconf/preseed-file seen true + db_set container/preseed-file "${CONFIG}/default.cfg" + db_fset container/preseed-file seen true elif ls "${CONFIG}"/*.cfg > /dev/null 2>&1 || ls "${CONFIG}"/*/*.cfg > /dev/null 2>&1 then # user has not specified preseed files through commandline option, @@ -62,13 +64,13 @@ then if [ -n "${PRESEED_FILES}" ] then - db_subst cnt-debconf/preseed-files CHOICES "none, custom, , ${PRESEED_FILES}" + db_subst container/preseed-files CHOICES "none, custom, , ${PRESEED_FILES}" - db_settitle cnt-debconf/title - db_input high cnt-debconf/preseed-files || true + db_settitle container/title + db_input high container/preseed-files || true db_go - db_get cnt-debconf/preseed-files + db_get container/preseed-files PRESEED_FILE="${RET}" # select case "${PRESEED_FILE}" in @@ -77,8 +79,8 @@ then *) # user specified preseed file through debconf select - db_set cnt-debconf/preseed-file "${CONFIG}/${PRESEED_FILE}.cfg" - db_fset cnt-debconf/preseed-file seen true + db_set container/preseed-file "${CONFIG}/${PRESEED_FILE}.cfg" + db_fset container/preseed-file seen true ;; esac fi @@ -90,11 +92,11 @@ case "${PRESEED_FILE}" in *) # ask user for a preseed file - db_settitle cnt-debconf/title - db_input high cnt-debconf/preseed-file || true + db_settitle container/title + db_input high container/preseed-file || true db_go - db_get cnt-debconf/preseed-file + db_get container/preseed-file PRESEED_FILE="${RET}" # string (w/ empty) echo "PRESEED_FILE=\"${PRESEED_FILE}\"" >> "${DEBCONF_TMPDIR}/debconf.default" diff --git a/share/scripts/debconf.d/0001-preseed-file.templates b/share/scripts/debconf.d/0001-preseed-file.templates index 707da95..7e12e0d 100644 --- a/share/scripts/debconf.d/0001-preseed-file.templates +++ b/share/scripts/debconf.d/0001-preseed-file.templates @@ -1,14 +1,14 @@ -Template: cnt-debconf/title +Template: container/title Type: title -Description: container-tools +Description: compute-tools -Template: cnt-debconf/preseed-files +Template: container/preseed-files Type: select Default: none Choices: ${CHOICES} Description: Choose a preseed config, enter a custom one, or use no preseed file at all. -Template: cnt-debconf/preseed-file +Template: container/preseed-file Type: string Default: Description: Enter (optional) preseed file to use: diff --git a/share/scripts/debconf.d/0002-preseed-debconf b/share/scripts/debconf.d/0002-preseed-debconf index ac101ad..086fffc 100755 --- a/share/scripts/debconf.d/0002-preseed-debconf +++ b/share/scripts/debconf.d/0002-preseed-debconf @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -50,14 +49,14 @@ do # add preseed file to debconf DEBCONF_PRESEED_FILES="${DEBCONF_PRESEED_FILES} ${PRESEED_FILE}" - if ! grep -qs '^ *container-tools *cnt-debconf/include-preseed-files' "${PRESEED_FILE}" + if ! grep -qs '^ *compute-tools *container/include-preseed-files' "${PRESEED_FILE}" then # preseed file has no includes continue fi # preseed file has includes - INCLUDE_PRESEED_FILES="$(grep '^ *container-tools *cnt-debconf/include-preseed-files' ${PRESEED_FILE} | awk '{ $1=$2=$3=""; print $0 }' | sed -e 's|,| |g')" + INCLUDE_PRESEED_FILES="$(grep '^ *compute-tools *container/include-preseed-files' ${PRESEED_FILE} | awk '{ $1=$2=$3=""; print $0 }' | sed -e 's|,| |g')" # FIXME: we're supporting only *ONE* include layer for now, so no nested/recursive includes just yet for FILE in ${INCLUDE_PRESEED_FILES} diff --git a/share/scripts/debconf.d/0003-debconf b/share/scripts/debconf.d/0003-debconf index 1d04adc..843d0b4 100755 --- a/share/scripts/debconf.d/0003-debconf +++ b/share/scripts/debconf.d/0003-debconf @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -27,7 +26,7 @@ export DEBCONF_NOWARNINGS Mode () { - db_get cnt-debconf/mode + db_get container/mode MODE="${RET}" # select if [ -z "${MODE}" ] @@ -47,34 +46,34 @@ Mode () Distribution () { - db_get cnt-debconf/distribution + db_get container/distribution DISTRIBUTION="${RET}" # select if [ -z "${DISTRIBUTION}" ] then case "${MODE}" in debian) - db_subst cnt-debconf/distribution CHOICES "Debian GNU/Linux 9 \"stretch\", Debian GNU/Linux testing/buster, Debian GNU/Linux unstable/sid" - db_subst cnt-debconf/distribution CHOICES_C "stretch, buster, sid" + db_subst container/distribution CHOICES "Debian GNU/Linux 9 \"stretch\", Debian GNU/Linux 10 \"buster\", Debian GNU/Linux testing/bullseye, Debian GNU/Linux unstable/sid" + db_subst container/distribution CHOICES_C "stretch, buster, bullseye, sid" - db_set cnt-debconf/distribution stretch - db_fset cnt-debconf/distribution seen false + db_set container/distribution buster + db_fset container/distribution seen false ;; progress-linux) - db_subst cnt-debconf/distribution CHOICES "Progress Linux 4 (dschinn), Progress Linux 4+ (dschinn-backports)" - db_subst cnt-debconf/distribution CHOICES_C "dschinn, dschinn-backports" + db_subst container/distribution CHOICES "Progress Linux 5 (engywuck), Progress Linux 5+ (engywuck-backports)" + db_subst container/distribution CHOICES_C "engywuck, engywuck-backports" - db_set cnt-debconf/distribution dschinn-backports - db_fset cnt-debconf/distribution seen false + db_set container/distribution engywuck-backports + db_fset container/distribution seen false ;; esac - db_settitle cnt-debconf/title - db_input high cnt-debconf/distribution || true + db_settitle container/title + db_input high container/distribution || true db_go - db_get cnt-debconf/distribution + db_get container/distribution DISTRIBUTION="${RET}" # select fi @@ -84,7 +83,7 @@ Distribution () Parent_distribution () { - db_get cnt-debconf/parent-distribution + db_get container/parent-distribution PARENT_DISTRIBUTION="${RET}" if [ -z "${PARENT_DISTRIBUTION}" ] @@ -92,8 +91,8 @@ Parent_distribution () case "${MODE}" in progress-linux) case "${DISTRIBUTION}" in - dschinn*) - PARENT_DISTRIBUTION="stretch" + engywuck*) + PARENT_DISTRIBUTION="buster" ;; esac ;; @@ -156,22 +155,22 @@ Architecture () exit 1 esac - db_get cnt-debconf/architecture + db_get container/architecture ARCHITECTURE="${RET}" # select if [ -z "${ARCHITECTURE}" ] && [ -n "${CHOICES}" ] then - db_subst cnt-debconf/architecture CHOICES ${CHOICES} - db_subst cnt-debconf/architecture CHOICES_C ${CHOICES_C} + db_subst container/architecture CHOICES ${CHOICES} + db_subst container/architecture CHOICES_C ${CHOICES_C} - db_set cnt-debconf/architecture ${DEFAULT} - db_fset cnt-debconf/distribution seen false + db_set container/architecture ${DEFAULT} + db_fset container/distribution seen false - db_settitle cnt-debconf/title - db_input high cnt-debconf/architecture || true + db_settitle container/title + db_input high container/architecture || true db_go - db_get cnt-debconf/architecture + db_get container/architecture ARCHITECTURE="${RET}" # select fi @@ -187,7 +186,7 @@ Architecture () Archives () { - db_get cnt-debconf/archives + db_get container/archives ARCHIVES="${RET}" # multiselect if [ -z "${ARCHIVES}" ] @@ -196,33 +195,33 @@ Archives () debian) case "${PARENT_DISTRIBUTION}" in sid) - db_subst cnt-debconf/archives CHOICES "Experimental" - db_subst cnt-debconf/archives CHOICES_C "experimental" + db_subst container/archives CHOICES "Experimental" + db_subst container/archives CHOICES_C "experimental" - db_set cnt-debconf/archives "" - db_fset cnt-debconf/archives seen false + db_set container/archives "" + db_fset container/archives seen false ;; *) - db_subst cnt-debconf/archives CHOICES "Security, Updates, Backports, Proposed Updates" - db_subst cnt-debconf/archives CHOICES_C "${DISTRIBUTION}-security, ${DISTRIBUTION}-updates, ${DISTRIBUTION}-backports, ${DISTRIBUTION}-proposed-updates" + db_subst container/archives CHOICES "Security, Updates, Backports, Proposed Updates" + db_subst container/archives CHOICES_C "${DISTRIBUTION}-security, ${DISTRIBUTION}-updates, ${DISTRIBUTION}-backports, ${DISTRIBUTION}-proposed-updates" case "${PARENT_DISTRIBUTION}" in sid) - db_set cnt-debconf/archives "" + db_set container/archives "" ;; buster) - db_set cnt-debconf/archives "${DISTRIBUTION}-security, ${DISTRIBUTION}-updates" + db_set container/archives "${DISTRIBUTION}-security, ${DISTRIBUTION}-updates" ;; *) - #db_set cnt-debconf/archives "${DISTRIBUTION}-security, ${DISTRIBUTION}-updates, ${DISTRIBUTION}-backports" - db_set cnt-debconf/archives "${DISTRIBUTION}-security, ${DISTRIBUTION}-updates" + #db_set container/archives "${DISTRIBUTION}-security, ${DISTRIBUTION}-updates, ${DISTRIBUTION}-backports" + db_set container/archives "${DISTRIBUTION}-security, ${DISTRIBUTION}-updates" ;; esac - db_fset cnt-debconf/archives seen false + db_fset container/archives seen false ;; esac ;; @@ -230,19 +229,19 @@ Archives () progress-linux) DIST="$(echo ${DISTRIBUTION} | sed -e 's|-backports||')" - db_subst cnt-debconf/archives CHOICES "staging, Security, Security (staging), Updates, Updates (staging), Extras, Extras (staging), Backports, Backports (staging), Backports Extras, Backports Extras (staging)" - db_subst cnt-debconf/archives CHOICES_C "${DIST}-staging, ${DIST}-security, ${DIST}-security-staging, ${DIST}-updates, ${DIST}-updates-staging, ${DIST}-extras, ${DIST}-extras-staging, ${DIST}-backports, ${DIST}-backports-staging, ${DIST}-backports-extras, ${DIST}-backports-extras-staging" + db_subst container/archives CHOICES "staging, Security, Security (staging), Updates, Updates (staging), Extras, Extras (staging), Backports, Backports (staging), Backports Extras, Backports Extras (staging)" + db_subst container/archives CHOICES_C "${DIST}-staging, ${DIST}-security, ${DIST}-security-staging, ${DIST}-updates, ${DIST}-updates-staging, ${DIST}-extras, ${DIST}-extras-staging, ${DIST}-backports, ${DIST}-backports-staging, ${DIST}-backports-extras, ${DIST}-backports-extras-staging" - db_set cnt-debconf/archives "${DIST}-security, ${DIST}-updates, ${DIST}-extras, ${DIST}-backports, ${DIST}-backports-extras" - db_fset cnt-debconf/archives seen false + db_set container/archives "${DIST}-security, ${DIST}-updates, ${DIST}-extras, ${DIST}-backports, ${DIST}-backports-extras" + db_fset container/archives seen false ;; esac - db_settitle cnt-debconf/title - db_input high cnt-debconf/archives || true + db_settitle container/title + db_input high container/archives || true db_go - db_get cnt-debconf/archives + db_get container/archives ARCHIVES="${RET}" # multiselect fi @@ -254,40 +253,40 @@ Archives () Parent_archives () { - db_get cnt-debconf/parent-archives + db_get container/parent-archives PARENT_ARCHIVES="${RET}" # multiselect (w/o empty) if [ -z "${PARENT_ARCHIVES}" ] then case "${MODE}" in progress-linux) - db_subst cnt-debconf/parent-archives CHOICES "Security, Updates, Backports, Proposed Updates" - db_subst cnt-debconf/parent-archives CHOICES_C "${PARENT_DISTRIBUTION}-security, ${PARENT_DISTRIBUTION}-updates, ${PARENT_DISTRIBUTION}-backports, ${PARENT_DISTRIBUTION}-proposed-updates" + db_subst container/parent-archives CHOICES "Security, Updates, Backports, Proposed Updates" + db_subst container/parent-archives CHOICES_C "${PARENT_DISTRIBUTION}-security, ${PARENT_DISTRIBUTION}-updates, ${PARENT_DISTRIBUTION}-backports, ${PARENT_DISTRIBUTION}-proposed-updates" case "${PARENT_DISTRIBUTION}" in *) - #db_set cnt-debconf/parent-archives "${PARENT_DISTRIBUTION}-security, ${PARENT_DISTRIBUTION}-updates, ${PARENT_DISTRIBUTION}-backports" - db_set cnt-debconf/parent-archives "${PARENT_DISTRIBUTION}-security, ${PARENT_DISTRIBUTION}-updates" + #db_set container/parent-archives "${PARENT_DISTRIBUTION}-security, ${PARENT_DISTRIBUTION}-updates, ${PARENT_DISTRIBUTION}-backports" + db_set container/parent-archives "${PARENT_DISTRIBUTION}-security, ${PARENT_DISTRIBUTION}-updates" ;; esac - db_fset cnt-debconf/parent-archives seen false + db_fset container/parent-archives seen false - db_settitle cnt-debconf/title - db_input high cnt-debconf/parent-archives || true + db_settitle container/title + db_input high container/parent-archives || true db_go ;; *) - db_subst cnt-debconf/parent-archives CHOICES "Security, Updates, Backports, Proposed Updates" - db_subst cnt-debconf/parent-archives CHOICES_C "${ARCHIVES}" + db_subst container/parent-archives CHOICES "Security, Updates, Backports, Proposed Updates" + db_subst container/parent-archives CHOICES_C "${ARCHIVES}" - db_set cnt-debconf/parent-archives "${ARCHIVES}" - db_fset cnt-debconf/parent-archives seen true + db_set container/parent-archives "${ARCHIVES}" + db_fset container/parent-archives seen true ;; esac - db_get cnt-debconf/parent-archives + db_get container/parent-archives PARENT_ARCHIVES="${RET}" # multiselect (w/o empty) if [ -z "${PARENT_ARCHIVES}" ] @@ -317,28 +316,28 @@ Parent_archives () Mirror () { - db_get cnt-debconf/mirror + db_get container/mirror MIRROR="${RET}" if [ -z "${MIRROR}" ] then case "${MODE}" in debian) - db_set cnt-debconf/mirror https://deb.debian.org/debian - db_fset cnt-debconf/mirror seen false + db_set container/mirror https://deb.debian.org/debian + db_fset container/mirror seen false ;; progress-linux) - db_set cnt-debconf/mirror https://cdn.archive.progress-linux.org/packages - db_fset cnt-debconf/mirror seen false + db_set container/mirror https://cdn.deb.progress-linux.org/packages + db_fset container/mirror seen false ;; esac - db_settitle cnt-debconf/title - db_input high cnt-debconf/mirror || true + db_settitle container/title + db_input high container/mirror || true db_go - db_get cnt-debconf/mirror + db_get container/mirror MIRROR="${RET}" # string (w/o empty) if [ -z "${MIRROR}" ] @@ -349,7 +348,7 @@ Mirror () ;; progress-linux) - MIRROR="https://cdn.archive.progress-linux.org/packages" + MIRROR="https://cdn.deb.progress-linux.org/packages" ;; esac fi @@ -366,28 +365,28 @@ Mirror_security () return 0 fi - db_get cnt-debconf/mirror-security + db_get container/mirror-security MIRROR_SECURITY="${RET}" # string (w/o empty) if [ -z "${MIRROR_SECURITY}" ] then case "${MODE}" in debian) - db_set cnt-debconf/mirror-security http://security.debian.org - db_fset cnt-debconf/mirror-security seen false + db_set container/mirror-security http://security.debian.org + db_fset container/mirror-security seen false ;; *) - db_set cnt-debconf/mirror-security ${MIRROR} - db_fset cnt-debconf/mirror-security seen true + db_set container/mirror-security ${MIRROR} + db_fset container/mirror-security seen true ;; esac - db_settitle cnt-debconf/title - db_input high cnt-debconf/mirror-security || true + db_settitle container/title + db_input high container/mirror-security || true db_go - db_get cnt-debconf/mirror-security + db_get container/mirror-security MIRROR_SECURITY="${RET}" # string (w/o empty) if [ -z "${MIRROR_SECURITY}" ] @@ -410,28 +409,28 @@ Mirror_security () Parent_mirror () { - db_get cnt-debconf/parent-mirror + db_get container/parent-mirror PARENT_MIRROR="${RET}" # string (w/o empty) if [ -z "${PARENT_MIRROR}" ] then case "${MODE}" in progress-linux) - db_set cnt-debconf/parent-mirror https://deb.debian.org/debian - db_fset cnt-debconf/parent-mirror seen false + db_set container/parent-mirror https://deb.debian.org/debian + db_fset container/parent-mirror seen false - db_settitle cnt-debconf/title - db_input high cnt-debconf/parent-mirror || true + db_settitle container/title + db_input high container/parent-mirror || true db_go ;; *) - db_set cnt-debconf/parent-mirror ${MIRROR} - db_fset cnt-debconf/parent-mirror seen true + db_set container/parent-mirror ${MIRROR} + db_fset container/parent-mirror seen true ;; esac - db_get cnt-debconf/parent-mirror + db_get container/parent-mirror PARENT_MIRROR="${RET}" # string (w/o empty) if [ -z "${PARENT_MIRROR}" ] @@ -459,28 +458,28 @@ Parent_mirror_security () return 0 fi - db_get cnt-debconf/parent-mirror-security + db_get container/parent-mirror-security PARENT_MIRROR_SECURITY="${RET}" # string (w/o empty) if [ -z "${PARENT_MIRROR_SECURITY}" ] then case "${MODE}" in progress-linux) - db_set cnt-debconf/parent-mirror-security http://security.debian.org - db_fset cnt-debconf/parent-mirror-security seen false + db_set container/parent-mirror-security http://security.debian.org + db_fset container/parent-mirror-security seen false - db_settitle cnt-debconf/title - db_input high cnt-debconf/parent-mirror-security || true + db_settitle container/title + db_input high container/parent-mirror-security || true db_go ;; *) - db_set cnt-debconf/parent-mirror-security ${MIRROR_SECURITY} - db_fset cnt-debconf/parent-mirror-security seen true + db_set container/parent-mirror-security ${MIRROR_SECURITY} + db_fset container/parent-mirror-security seen true ;; esac - db_get cnt-debconf/parent-mirror-security + db_get container/parent-mirror-security PARENT_MIRROR_SECURITY="${RET}" # string (w/o empty) if [ -z "${PARENT_MIRROR_SECURITY}" ] @@ -503,32 +502,32 @@ Parent_mirror_security () Archive_areas () { - db_get cnt-debconf/archive-areas + db_get container/archive-areas ARCHIVE_AREAS="${RET}" if [ -z "${ARCHIVE_AREAS}" ] then case "${MODE}" in progress-linux) - db_subst cnt-debconf/archive-areas CHOICES "main, contrib, non-free" + db_subst container/archive-areas CHOICES "main, contrib, non-free" - db_set cnt-debconf/archive-areas "main, contrib, non-free" - db_fset cnt-debconf/archive-areas seen false + db_set container/archive-areas "main, contrib, non-free" + db_fset container/archive-areas seen false ;; *) - db_subst cnt-debconf/archive-areas CHOICES "main, contrib, non-free" + db_subst container/archive-areas CHOICES "main, contrib, non-free" - db_set cnt-debconf/archive-areas "main" - db_fset cnt-debconf/archive-areas seen false + db_set container/archive-areas "main" + db_fset container/archive-areas seen false ;; esac - db_settitle cnt-debconf/title - db_input high cnt-debconf/archive-areas || true + db_settitle container/title + db_input high container/archive-areas || true db_go - db_get cnt-debconf/archive-areas + db_get container/archive-areas ARCHIVE_AREAS="${RET}" # multiselect (w/o empty) if [ -z "${ARCHIVE_AREAS}" ] @@ -553,32 +552,32 @@ Archive_areas () Parent_archive_areas () { - db_get cnt-debconf/parent-archive-areas + db_get container/parent-archive-areas PARENT_ARCHIVE_AREAS="${RET}" # multiselect (w/o empty) if [ -z "${PARENT_ARCHIVE_AREAS}" ] then case "${MODE}" in progress-linux) - db_subst cnt-debconf/parent-archive-areas CHOICES "main, contrib, non-free" + db_subst container/parent-archive-areas CHOICES "main, contrib, non-free" - db_set cnt-debconf/parent-archive-areas "main, contrib, non-free" - db_fset cnt-debconf/parent-archive-areas seen false + db_set container/parent-archive-areas "main, contrib, non-free" + db_fset container/parent-archive-areas seen false - db_settitle cnt-debconf/title - db_input high cnt-debconf/parent-archive-areas || true + db_settitle container/title + db_input high container/parent-archive-areas || true db_go ;; *) - db_subst cnt-debconf/parent-archive-areas CHOICES "${ARCHIVE_AREAS}" + db_subst container/parent-archive-areas CHOICES "${ARCHIVE_AREAS}" - db_set cnt-debconf/parent-archive-areas "${ARCHIVE_AREAS}" - db_fset cnt-debconf/parent-archive-areas seen true + db_set container/parent-archive-areas "${ARCHIVE_AREAS}" + db_fset container/parent-archive-areas seen true ;; esac - db_get cnt-debconf/parent-archive-areas + db_get container/parent-archive-areas PARENT_ARCHIVE_AREAS="${RET}" # multiselect (w/o empty) if [ -z "${PARENT_ARCHIVE_AREAS}" ] @@ -603,16 +602,16 @@ Parent_archive_areas () Packages () { - db_get cnt-debconf/packages + db_get container/packages PACKAGES="${RET}" # string (w/ empty) if [ -z "${PACKAGES}" ] then - db_settitle cnt-debconf/title - db_input high cnt-debconf/packages || true + db_settitle container/title + db_input high container/packages || true db_go - db_get cnt-debconf/packages + db_get container/packages PACKAGES="${RET}" # string (w/ empty) fi @@ -624,20 +623,20 @@ Local_archives () { NUMBER="1" - while db_get cnt-debconf/archive${NUMBER}/repository && [ "${RET}" ] + while db_get container/archive${NUMBER}/repository && [ "${RET}" ] do mkdir -p "${DEBCONF_TMPDIR}/apt" REPOSITORY="${RET#deb }" LIST="archive${NUMBER}.list" - if db_get cnt-debconf/archive${NUMBER}/list + if db_get container/archive${NUMBER}/list then LIST="$(basename ${RET} .list).list" fi COMMENT="" - if db_get cnt-debconf/archive${NUMBER}/comment + if db_get container/archive${NUMBER}/comment then COMMENT="${RET}" @@ -646,13 +645,13 @@ Local_archives () echo "deb ${REPOSITORY}" >> "${DEBCONF_TMPDIR}/apt/${LIST}" - if db_get cnt-debconf/archive${NUMBER}/source && [ "$RET" = true ] + if db_get container/archive${NUMBER}/source && [ "$RET" = true ] then echo "deb-src ${REPOSITORY}" >> "${DEBCONF_TMPDIR}/apt/${LIST}" fi KEY="" - if db_get cnt-debconf/archive${NUMBER}/key + if db_get container/archive${NUMBER}/key then KEY="${RET}" @@ -662,16 +661,16 @@ Local_archives () PREFERENCES_PACKAGE="" PREFERENCES_PIN="" PREFERENCES_PIN_PRIORITY="" - if db_get cnt-debconf/archive${NUMBER}/preferences-package + if db_get container/archive${NUMBER}/preferences-package then PREFERENCES_PACKAGE="${RET}" - if db_get cnt-debconf/archive${NUMBER}/preferences-pin + if db_get container/archive${NUMBER}/preferences-pin then PREFERENCES_PIN="${RET}" fi - if db_get cnt-debconf/archive${NUMBER}/preferences-pin-priority + if db_get container/archive${NUMBER}/preferences-pin-priority then PREFERENCES_PIN_PRIORITY="${RET}" fi @@ -722,97 +721,97 @@ Network_defaults () Network () { - db_get cnt-debconf/network1/bridge + db_get container/network1/bridge NETWORK1_BRIDGE="${RET}" # string (w/o empty) - db_get cnt-debconf/network1/veth + db_get container/network1/veth NETWORK1_VETH="${RET}" # string (w/o empty) - db_get cnt-debconf/network1/ipv4-method + db_get container/network1/ipv4-method NETWORK1_IPV4_METHOD="${RET}" # select - db_get cnt-debconf/network1/ipv4-comment + db_get container/network1/ipv4-comment NETWORK1_IPV4_COMMENT="${RET}" # string (w/ empty) - db_get cnt-debconf/network1/ipv4-address + db_get container/network1/ipv4-address NETWORK1_IPV4_ADDRESS="${RET}" # string (w/o empty) - db_get cnt-debconf/network1/ipv4-gateway + db_get container/network1/ipv4-gateway NETWORK1_IPV4_GATEWAY="${RET}" # string (w/ empty) - db_get cnt-debconf/network1/ipv4-netmask + db_get container/network1/ipv4-netmask NETWORK1_IPV4_NETMASK="${RET}" # string (w/o empty) - db_get cnt-debconf/network1/ipv4-post-up + db_get container/network1/ipv4-post-up NETWORK1_IPV4_POST_UP="${RET}" # string (w/ empty) - db_get cnt-debconf/network1/ipv4-post-down + db_get container/network1/ipv4-post-down NETWORK1_IPV4_POST_DOWN="${RET}" # string (w/ empty) - db_get cnt-debconf/nameserver/server + db_get container/nameserver/server NAMESERVER_SERVER="${RET}" # string (w/ empty) - db_get cnt-debconf/nameserver/domain + db_get container/nameserver/domain NAMESERVER_DOMAIN="${RET}" # string (w/ empty) - db_get cnt-debconf/nameserver/search + db_get container/nameserver/search NAMESERVER_SEARCH="${RET}" # string (w/ empty) - db_get cnt-debconf/nameserver/options + db_get container/nameserver/options NAMESERVER_OPTIONS="${RET}" # string (w/ empty) Network_defaults - db_set cnt-debconf/network1/bridge "${NETWORK1_BRIDGE}" - db_fset cnt-debconf/network1/bridge seen false + db_set container/network1/bridge "${NETWORK1_BRIDGE}" + db_fset container/network1/bridge seen false - db_set cnt-debconf/network1/veth "${NETWORK1_VETH}" - db_fset cnt-debconf/network1/veth seen false + db_set container/network1/veth "${NETWORK1_VETH}" + db_fset container/network1/veth seen false - db_set cnt-debconf/network1/ipv4-method "${NETWORK1_IPV4_METHOD}" - db_fset cnt-debconf/network1/ipv4-method seen false + db_set container/network1/ipv4-method "${NETWORK1_IPV4_METHOD}" + db_fset container/network1/ipv4-method seen false - db_set cnt-debconf/network1/ipv4-comment "${NETWORK1_IPV4_COMMENT}" - db_fset cnt-debconf/network1/ipv4-comment seen false + db_set container/network1/ipv4-comment "${NETWORK1_IPV4_COMMENT}" + db_fset container/network1/ipv4-comment seen false - db_set cnt-debconf/network1/ipv4-address "${NETWORK1_IPV4_ADDRESS}" - db_fset cnt-debconf/network1/ipv4-address seen false + db_set container/network1/ipv4-address "${NETWORK1_IPV4_ADDRESS}" + db_fset container/network1/ipv4-address seen false - db_set cnt-debconf/network1/ipv4-gateway "${NETWORK1_IPV4_GATEWAY}" - db_fset cnt-debconf/network1/ipv4-gateway seen false + db_set container/network1/ipv4-gateway "${NETWORK1_IPV4_GATEWAY}" + db_fset container/network1/ipv4-gateway seen false - db_set cnt-debconf/network1/ipv4-netmask "${NETWORK1_IPV4_NETMASK}" - db_fset cnt-debconf/network1/ipv4-netmask seen false + db_set container/network1/ipv4-netmask "${NETWORK1_IPV4_NETMASK}" + db_fset container/network1/ipv4-netmask seen false - db_set cnt-debconf/network1/ipv4-post-up "${NETWORK1_IPV4_POST_UP}" - db_fset cnt-debconf/network1/ipv4-post-up seen false + db_set container/network1/ipv4-post-up "${NETWORK1_IPV4_POST_UP}" + db_fset container/network1/ipv4-post-up seen false - db_set cnt-debconf/network1/ipv4-post-down "${NETWORK1_IPV4_POST_DOWN}" - db_fset cnt-debconf/network1/ipv4-post-down seen false + db_set container/network1/ipv4-post-down "${NETWORK1_IPV4_POST_DOWN}" + db_fset container/network1/ipv4-post-down seen false - db_set cnt-debconf/nameserver/server "${NAMESERVER_SERVER}" - db_fset cnt-debconf/nameserver/server seen false + db_set container/nameserver/server "${NAMESERVER_SERVER}" + db_fset container/nameserver/server seen false - db_set cnt-debconf/nameserver/domain "${NAMESERVER_DOMAIN}" - db_fset cnt-debconf/nameserver/domain seen false + db_set container/nameserver/domain "${NAMESERVER_DOMAIN}" + db_fset container/nameserver/domain seen false - db_set cnt-debconf/nameserver/search "${NAMESERVER_SEARCH}" - db_fset cnt-debconf/nameserver/search seen false + db_set container/nameserver/search "${NAMESERVER_SEARCH}" + db_fset container/nameserver/search seen false - db_set cnt-debconf/nameserver/options "${NAMESERVER_OPTIONS}" - db_fset cnt-debconf/nameserver/options seen false + db_set container/nameserver/options "${NAMESERVER_OPTIONS}" + db_fset container/nameserver/options seen false - db_settitle cnt-debconf/title - db_input high cnt-debconf/network1/ipv4-method || true + db_settitle container/title + db_input high container/network1/ipv4-method || true db_go - db_get cnt-debconf/network1/bridge + db_get container/network1/bridge NETWORK1_BRIDGE="${RET}" # select - db_get cnt-debconf/network1/veth + db_get container/network1/veth NETWORK1_VETH="${RET}" # select - db_get cnt-debconf/network1/ipv4-method + db_get container/network1/ipv4-method NETWORK1_IPV4_METHOD="${RET}" # select case "${NETWORK1_IPV4_METHOD}" in @@ -820,81 +819,81 @@ Network () ;; static) - db_settitle cnt-debconf/title - db_input high cnt-debconf/network1/ipv4-comment || true + db_settitle container/title + db_input high container/network1/ipv4-comment || true db_go - db_settitle cnt-debconf/title - db_input high cnt-debconf/network1/ipv4-address || true + db_settitle container/title + db_input high container/network1/ipv4-address || true db_go - db_settitle cnt-debconf/title - db_input high cnt-debconf/network1/ipv4-gateway || true + db_settitle container/title + db_input high container/network1/ipv4-gateway || true db_go - db_settitle cnt-debconf/title - db_input high cnt-debconf/network1/ipv4-netmask || true + db_settitle container/title + db_input high container/network1/ipv4-netmask || true db_go - db_settitle cnt-debconf/title - db_input high cnt-debconf/network1/ipv4-post-up || true + db_settitle container/title + db_input high container/network1/ipv4-post-up || true db_go - db_settitle cnt-debconf/title - db_input high cnt-debconf/network1/ipv4-post-down || true + db_settitle container/title + db_input high container/network1/ipv4-post-down || true db_go - db_settitle cnt-debconf/title - db_input high cnt-debconf/nameserver/server || true + db_settitle container/title + db_input high container/nameserver/server || true db_go ;; esac NUMBER="1" - while db_get cnt-debconf/network${NUMBER}/ipv4-method && [ "${RET}" ] + while db_get container/network${NUMBER}/ipv4-method && [ "${RET}" ] do - if db_get cnt-debconf/network${NUMBER}/bridge + if db_get container/network${NUMBER}/bridge then eval NETWORK${NUMBER}_BRIDGE="\"${RET}\"" # string (w/o empty) fi - if db_get cnt-debconf/network${NUMBER}/veth + if db_get container/network${NUMBER}/veth then eval NETWORK${NUMBER}_VETH="\"${RET}\"" # string (w/o empty) fi - if db_get cnt-debconf/network${NUMBER}/ipv4-comment + if db_get container/network${NUMBER}/ipv4-comment then eval NETWORK${NUMBER}_IPV4_COMMENT="\"${RET}\"" # string (w/ empty) fi - if db_get cnt-debconf/network${NUMBER}/ipv4-method + if db_get container/network${NUMBER}/ipv4-method then eval NETWORK${NUMBER}_IPV4_METHOD="\"${RET}\"" # select fi - if db_get cnt-debconf/network${NUMBER}/ipv4-address + if db_get container/network${NUMBER}/ipv4-address then eval NETWORK${NUMBER}_IPV4_ADDRESS="\"${RET}\"" # string (w/o empty) fi - if db_get cnt-debconf/network${NUMBER}/ipv4-gateway + if db_get container/network${NUMBER}/ipv4-gateway then eval NETWORK${NUMBER}_IPV4_GATEWAY="\"${RET}\"" # string (w/ empty) fi - if db_get cnt-debconf/network${NUMBER}/ipv4-netmask + if db_get container/network${NUMBER}/ipv4-netmask then eval NETWORK${NUMBER}_IPV4_NETMASK="\"${RET}\"" # string (w/o empty) fi - if db_get cnt-debconf/network${NUMBER}/ipv4-post-up + if db_get container/network${NUMBER}/ipv4-post-up then eval NETWORK${NUMBER}_IPV4_POST_UP="\"${RET}\"" # string (w/ empty) fi - if db_get cnt-debconf/network${NUMBER}/ipv4-post-down + if db_get container/network${NUMBER}/ipv4-post-down then eval NETWORK${NUMBER}_IPV4_POST_DOWN="\"${RET}\"" # string (w/ empty) fi @@ -904,16 +903,16 @@ Network () NETWORK_NUMBER="$((${NUMBER} - 1))" - db_get cnt-debconf/nameserver/server + db_get container/nameserver/server NAMESERVER_SERVER="${RET}" # string (w/ empty) - db_get cnt-debconf/nameserver/domain + db_get container/nameserver/domain NAMESERVER_DOMAIN="${RET}" # string (w/ empty) - db_get cnt-debconf/nameserver/search + db_get container/nameserver/search NAMESERVER_SEARCH="${RET}" # string (w/ empty) - db_get cnt-debconf/nameserver/options + db_get container/nameserver/options NAMESERVER_OPTIONS="${RET}" # string (w/ empty) Network_defaults @@ -958,7 +957,7 @@ Network () Root_password () { - if db_get cnt-debconf/root-password + if db_get container/root-password then ROOT_PASSWORD="${RET}" # string (w/o empty) fi @@ -968,14 +967,14 @@ Root_password () # Create a random password as suggestion for the user RANDOM_PASSWORD="$(dd if=/dev/urandom bs=12 count=1 2> /dev/null | base64)" - db_set cnt-debconf/root-password ${RANDOM_PASSWORD} - db_fset cnt-debconf/root-password seen false + db_set container/root-password ${RANDOM_PASSWORD} + db_fset container/root-password seen false - db_settitle cnt-debconf/title - db_input high cnt-debconf/root-password || true + db_settitle container/title + db_input high container/root-password || true db_go - db_get cnt-debconf/root-password + db_get container/root-password ROOT_PASSWORD="${RET}" if [ -z "${ROOT_PASSWORD}" ] @@ -995,14 +994,14 @@ Root_password () Internal_options () { - if db_get cnt-debconf/apt-recommends + if db_get container/apt-recommends then APT_RECOMMENDS="${RET}" # boolean (w/ empty) fi echo "APT_RECOMMENDS=\"${APT_RECOMMENDS}\"" >> "${DEBCONF_TMPDIR}/debconf.default" - if db_get cnt-debconf/debconf-frontend + if db_get container/debconf-frontend then DEBCONF_FRONTEND="${RET}" # select fi @@ -1010,7 +1009,7 @@ Internal_options () DEBCONF_FRONTEND="${DEBCONF_FRONTEND:-dialog}" echo "DEBCONF_FRONTEND=\"${DEBCONF_FRONTEND}\"" >> "${DEBCONF_TMPDIR}/debconf.default" - if db_get cnt-debconf/debconf-priority + if db_get container/debconf-priority then DEBCONF_PRIORITY="${RET}" # select fi @@ -1018,7 +1017,7 @@ Internal_options () DEBCONF_PRIORITY="${DEBCONF_PRIORITY:-high}" echo "DEBCONF_PRIORITY=\"${DEBCONF_PRIORITY}\"" >> "${DEBCONF_TMPDIR}/debconf.default" - if db_get cnt-debconf/container-command + if db_get container/container-command then CONTAINER_COMMAND="${RET}" # string (w/ empty) fi @@ -1027,9 +1026,9 @@ Internal_options () NUMBER="1" - while db_get cnt-debconf/container-command${NUMBER} && [ "${RET}" ] + while db_get container/container-command${NUMBER} && [ "${RET}" ] do - if db_get cnt-debconf/container-command${NUMBER} + if db_get container/container-command${NUMBER} then eval CONTAINER_COMMAND${NUMBER}="\"${RET}\"" # string (w/o empty) fi @@ -1047,7 +1046,7 @@ Internal_options () echo "CONTAINER_COMMAND${NUMBER}=\"${COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default" done - if db_get cnt-debconf/host-command + if db_get container/host-command then HOST_COMMAND="${RET}" # string (w/ empty) fi @@ -1056,9 +1055,9 @@ Internal_options () NUMBER="1" - while db_get cnt-debconf/host-command${NUMBER} && [ "${RET}" ] + while db_get container/host-command${NUMBER} && [ "${RET}" ] do - if db_get cnt-debconf/host-command${NUMBER} + if db_get container/host-command${NUMBER} then eval HOST_COMMAND${NUMBER}="\"${RET}\"" # string (w/o empty) fi @@ -1076,7 +1075,7 @@ Internal_options () echo "HOST_COMMAND${NUMBER}=\"${COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default" done - if db_get cnt-debconf/auto + if db_get container/auto then CNT_AUTO="${RET:-true}" # string (w/o empty) fi @@ -1084,7 +1083,7 @@ Internal_options () CNT_AUTO="${CNT_AUTO:-true}" echo "CNT_AUTO=\"${CNT_AUTO}\"" >> "${DEBCONF_TMPDIR}/debconf.default" - if db_get cnt-debconf/container-server + if db_get container/container-server then CNT_CONTAINER_SERVER="${RET:-FQDN}" # string (w/o empty) fi @@ -1093,20 +1092,20 @@ Internal_options () case "${CNT_CONTAINER_SERVER}" in FQDN) - CNT_CONTAINER_SERVER="$(hostname -f)" + CNT_CONTAINER_SERVER="$(hostname -f 2> /dev/null || hostname)" ;; esac echo "CNT_CONTAINER_SERVER=\"${CNT_CONTAINER_SERVER}\"" >> "${DEBCONF_TMPDIR}/debconf.default" - if db_get cnt-debconf/bind + if db_get container/bind then BIND="${RET}" # string (w/ empty) fi echo "BIND=\"${BIND}\"" >> "${DEBCONF_TMPDIR}/debconf.default" - if db_get cnt-debconf/overlay + if db_get container/overlay then CNT_OVERLAY="${RET}" # string (w/ empty) fi diff --git a/share/scripts/debconf.d/0003-debconf.templates b/share/scripts/debconf.d/0003-debconf.templates index e3dbc24..3d607a7 100644 --- a/share/scripts/debconf.d/0003-debconf.templates +++ b/share/scripts/debconf.d/0003-debconf.templates @@ -1,8 +1,8 @@ -Template: cnt-debconf/title +Template: container/title Type: title -Description: container-tools +Description: compute-tools -Template: cnt-debconf/mode +Template: container/mode Type: select Default: Choices-C: ${CHOICES_C} @@ -10,7 +10,7 @@ Choices: ${CHOICES} Description: Mode Mode. -Template: cnt-debconf/distribution +Template: container/distribution Type: select Default: Choices-C: ${CHOICES_C} @@ -18,7 +18,7 @@ Choices: ${CHOICES} Description: Distribution Distribution. -Template: cnt-debconf/parent-distribution +Template: container/parent-distribution Type: select Default: Choices-C: ${CHOICES_C} @@ -26,7 +26,7 @@ Choices: ${CHOICES} Description: for internal use; can be preseeded Parent Distribution. -Template: cnt-debconf/architecture +Template: container/architecture Type: select Default: Choices-C: ${CHOICES_C} @@ -34,7 +34,7 @@ Choices: ${CHOICES} Description: Architecture Architecture. -Template: cnt-debconf/archives +Template: container/archives Type: multiselect Default: Choices-C: ${CHOICES_C} @@ -42,7 +42,7 @@ Choices: ${CHOICES} Description: Archives Archives. -Template: cnt-debconf/parent-archives +Template: container/parent-archives Type: multiselect Default: Choices-C: ${CHOICES_C} @@ -50,69 +50,69 @@ Choices: ${CHOICES} Description: Parent Archives Parent Archives. -Template: cnt-debconf/mirror +Template: container/mirror Type: string Default: Description: Mirror Mirror. -Template: cnt-debconf/mirror-security +Template: container/mirror-security Type: string Default: Description: Mirror Security Mirror Security. -Template: cnt-debconf/parent-mirror +Template: container/parent-mirror Type: string Default: Description: Parent Mirror Parent Mirror. -Template: cnt-debconf/parent-mirror-security +Template: container/parent-mirror-security Type: string Default: Description: Parent Mirror Security Parent Mirror Security. -Template: cnt-debconf/archive-areas +Template: container/archive-areas Type: multiselect Default: Choices: ${CHOICES} Description: Archive Areas Archive Areas. -Template: cnt-debconf/parent-archive-areas +Template: container/parent-archive-areas Type: multiselect Default: Choices: ${CHOICES} Description: Parent Archive Areas Parent Archive Areas. -Template: cnt-debconf/packages +Template: container/packages Type: string Default: Description: Packages Packages. -Template: cnt-debconf/root-password +Template: container/root-password Type: string Default: Description: Root password Root password. -Template: cnt-debconf/network1/bridge +Template: container/network1/bridge Type: string Default: Description: Bridge Bridge. -Template: cnt-debconf/network1/veth +Template: container/network1/veth Type: string Default: Description: Veth name Veth name. -Template: cnt-debconf/network1/ipv4-method +Template: container/network1/ipv4-method Type: select Choices: dhcp, static, none Default: @@ -122,7 +122,7 @@ Description: Ethernet Interface Method (IPv4)? This defaults to dhcp and will require that you run a dhcp-server in your network. -Template: cnt-debconf/network1/ipv4-comment +Template: container/network1/ipv4-comment Type: string Default: Description: Ethernet Interface Comment (IPv4)? @@ -130,7 +130,7 @@ Description: Ethernet Interface Comment (IPv4)? . This defaults to empty. -Template: cnt-debconf/network1/ipv4-address +Template: container/network1/ipv4-address Type: string Default: Description: Ethernet IP Address (IPv4)? @@ -138,7 +138,7 @@ Description: Ethernet IP Address (IPv4)? . This defaults to 192.168.1.2. -Template: cnt-debconf/network1/ipv4-gateway +Template: container/network1/ipv4-gateway Type: string Default: Description: Ethernet Gateway Address (IPv4)? @@ -146,7 +146,7 @@ Description: Ethernet Gateway Address (IPv4)? . This defaults to empty. -Template: cnt-debconf/network1/ipv4-netmask +Template: container/network1/ipv4-netmask Type: string Default: Description: Ethernet Network Mask (IPv4)? @@ -154,7 +154,7 @@ Description: Ethernet Network Mask (IPv4)? . This defaults to empty. -Template: cnt-debconf/network1/ipv4-post-up +Template: container/network1/ipv4-post-up Type: string Default: Description: Ethernet post-up Command (IPv4)? @@ -162,7 +162,7 @@ Description: Ethernet post-up Command (IPv4)? . This defaults to empty. -Template: cnt-debconf/network1/ipv4-post-down +Template: container/network1/ipv4-post-down Type: string Default: Description: Ethernet post-down Command (IPv4)? @@ -170,7 +170,7 @@ Description: Ethernet post-down Command (IPv4)? . This defaults to empty. -Template: cnt-debconf/nameserver/server +Template: container/nameserver/server Type: string Default: Description: Nameserver Addresses? @@ -178,7 +178,7 @@ Description: Nameserver Addresses? . This defaults to empty. Multiple nameservers can be separated by whitespace. -Template: cnt-debconf/nameserver/domain +Template: container/nameserver/domain Type: string Default: Description: Nameserver Local Domain Name? @@ -188,7 +188,7 @@ Description: Nameserver Local Domain Name? . This defaults to empty. -Template: cnt-debconf/nameserver/search +Template: container/nameserver/search Type: string Default: Description: Nameserver Search List? @@ -198,7 +198,7 @@ Description: Nameserver Search List? . This defaults to empty. -Template: cnt-debconf/nameserver/options +Template: container/nameserver/options Type: string Default: Description: Nameserver Resolver Options? diff --git a/share/scripts/debootstrap b/share/scripts/debootstrap index 12f1b95..7910ac3 100755 --- a/share/scripts/debootstrap +++ b/share/scripts/debootstrap @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,9 +19,11 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" SCRIPT="${0}" -HOOKS="/etc/container-tools/hooks" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -138,7 +139,7 @@ then fi ARCHITECTURE="${ARCHITECTURE:-$(dpkg --print-architecture)}" -DISTRIBUTION="${DISTRIBUTION:-stretch}" +DISTRIBUTION="${DISTRIBUTION:-buster}" MIRROR="${MIRROR:-https://deb.debian.org/debian}" PASSWORD="${PASSWORD:-$(dd if=/dev/urandom bs=12 count=1 2> /dev/null | base64)}" diff --git a/share/sudo/container-tools b/share/sudo/container-shell index cd3f74d..cd3f74d 100644 --- a/share/sudo/container-tools +++ b/share/sudo/container-shell diff --git a/share/systemd/container-auto.service b/share/systemd/container-auto.service index 99decf6..4d7e10e 100644 --- a/share/systemd/container-auto.service +++ b/share/systemd/container-auto.service @@ -1,5 +1,5 @@ [Unit] -Description=container-tools automatic start and stop +Description=compute-tools automatic start and stop Documentation=man:container-auto After=network.target diff --git a/share/systemd/container@.service b/share/systemd/container@.service index 4a30ff6..9e9f720 100644 --- a/share/systemd/container@.service +++ b/share/systemd/container@.service @@ -1,6 +1,6 @@ [Unit] Description="Container: %i" -Documentation=man:container-tools +Documentation=man:compute-tools [Service] Type=simple |