summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt240
-rw-r--r--LICENSE.txt8
-rw-r--r--Makefile55
-rw-r--r--VERSION.txt2
-rwxr-xr-xbin/container7
-rwxr-xr-xbin/container-shell2
-rwxr-xr-xlibexec/container/auto54
-rwxr-xr-xlibexec/container/build9
-rwxr-xr-xlibexec/container/console5
-rwxr-xr-xlibexec/container/enter7
-rwxr-xr-xlibexec/container/get5
-rwxr-xr-xlibexec/container/info31
-rwxr-xr-xlibexec/container/key13
-rwxr-xr-xlibexec/container/limit5
-rwxr-xr-xlibexec/container/list13
-rwxr-xr-xlibexec/container/log5
-rwxr-xr-xlibexec/container/move5
-rwxr-xr-xlibexec/container/rebuild152
-rwxr-xr-xlibexec/container/remove7
-rwxr-xr-xlibexec/container/restart42
-rwxr-xr-xlibexec/container/run3
-rwxr-xr-xlibexec/container/start38
-rwxr-xr-xlibexec/container/status3
-rwxr-xr-xlibexec/container/stop82
-rwxr-xr-xlibexec/container/top5
-rwxr-xr-xlibexec/container/update145
-rwxr-xr-xlibexec/container/version71
-rw-r--r--python3/compute_tools/__init__.py20
-rw-r--r--python3/compute_tools/container/__init__.py20
-rw-r--r--python3/compute_tools/container/version/__init__.py21
-rw-r--r--python3/compute_tools/container/version/functions.py28
-rw-r--r--python3/compute_tools/container/version/variables.py21
-rw-r--r--share/bash-completion/container26
-rwxr-xr-xshare/build-scripts/debconf217
-rwxr-xr-xshare/build-scripts/debconf.d/0001-preseed-file49
-rwxr-xr-xshare/build-scripts/debconf.d/0002-preseed-debconf3
-rwxr-xr-xshare/build-scripts/debconf.d/0003-debconf120
-rw-r--r--share/build-scripts/debconf.d/0003-debconf.templates10
-rwxr-xr-xshare/build-scripts/debootstrap6
-rw-r--r--share/doc/examples/bookworm.cfg (renamed from share/doc/examples/bullseye.cfg)6
-rwxr-xr-xshare/doc/examples/container-images.sh4
-rw-r--r--share/doc/examples/graograman-backports.cfg (renamed from share/doc/examples/fuchur-backports.cfg)10
-rw-r--r--share/doc/host-setup.old.txt230
-rw-r--r--share/doc/host-setup.txt177
-rwxr-xr-xshare/get-scripts/curl13
-rwxr-xr-xshare/get-scripts/curl.d/0001-debconf2
-rwxr-xr-xshare/hooks/post-start.chown-nvidia.sh2
-rwxr-xr-xshare/hooks/pre-build.git-pull.sh2
-rwxr-xr-xshare/hooks/pre-get.git-pull.sh2
-rwxr-xr-xshare/hooks/pre-start.unlink-console.sh2
-rw-r--r--share/man/Makefile2
-rw-r--r--share/man/compute-tools.7.rst8
-rw-r--r--share/man/container-auto.1.rst2
-rw-r--r--share/man/container-build-debconf.1.rst2
-rw-r--r--share/man/container-build-debootstrap.1.rst12
-rw-r--r--share/man/container-build.1.rst2
-rw-r--r--share/man/container-console.1.rst2
-rw-r--r--share/man/container-enter.1.rst2
-rw-r--r--share/man/container-get-curl.1.rst12
-rw-r--r--share/man/container-get.1.rst2
-rw-r--r--share/man/container-info.1.rst5
-rw-r--r--share/man/container-key.1.rst3
-rw-r--r--share/man/container-limit.1.rst2
-rw-r--r--share/man/container-list.1.rst3
-rw-r--r--share/man/container-log.1.rst2
-rw-r--r--share/man/container-move.1.rst2
-rw-r--r--share/man/container-rebuild.1.rst93
-rw-r--r--share/man/container-remove.1.rst2
-rw-r--r--share/man/container-restart.1.rst8
-rw-r--r--share/man/container-run.1.rst2
-rw-r--r--share/man/container-shell.1.rst2
-rw-r--r--share/man/container-start.1.rst2
-rw-r--r--share/man/container-status.1.rst2
-rw-r--r--share/man/container-stop.1.rst14
-rw-r--r--share/man/container-top.1.rst3
-rw-r--r--share/man/container-update.1.rst5
-rw-r--r--share/man/container-version.1.rst2
-rw-r--r--share/man/container.1.rst5
-rw-r--r--share/man/man.in2
-rw-r--r--share/needrestart/container-tools.conf6
80 files changed, 1877 insertions, 339 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 704f3f8..8dd6e3d 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,232 @@
+2022-12-23 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20221023.
+
+ [ Daniel Baumann ]
+ * Tightening version matches for OS detection in container info command.
+ * Adding release support for Debian 12 (bookworm).
+ * Updating distribution defaults for bookworm in container build scripts.
+ * Updating references in manpages for bookworm.
+ * Updating examples for bookworm.
+ * Adding support for non-free-firmware archive-area in debconf build script.
+ * Updating arm64 description in debconf build script.
+
+2022-10-23 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20221023.
+
+ [ Daniel Baumann ]
+ * Removing curl pre-http2 option handling.
+ * Renaming internal bootstrap function to be more generic in debconf build-script.
+ * Adding initial image support in container debconf build-scripts.
+
+2022-10-15 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20221015.
+
+ [ Daniel Baumann ]
+ * Removing machine-id from cache to fix re-using it amongst all generated containers, thanks to Sakirnth Nagarasa <sakirnth@debian.org>.
+ * Correcting a few formating errors in changelog.
+
+2022-10-02 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20221002.
+
+ [ Daniel Baumann ]
+ * Adding force and interactive options to container restart command.
+ * Updating license with newer GPL-3 version containing https instead of http links.
+ * Replacing explicit container command with variable in container main wrapper.
+ * Correcting distclean target in makefile.
+ * Also passing explicit directory output-format to mmdebstrap in build scripts.
+ * Also passing root as sandbox user to mmdebstrap in build scripts.
+
+2022-07-21 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20220721.
+
+ [ Daniel Baumann ]
+ * Returning all ip addresses in cnt info command.
+ * Correcting container info command to report IP addresses of stopped container.
+ * Handling multiple IP addresses in container info command the same way for stopped containers as for started ones.
+ * Adding lazy detection in container info command for Debian 12 (booworm).
+
+2022-07-04 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20220704.
+
+ [ Daniel Baumann ]
+ * Adding release related targets in Makefile.
+ * Updating links about related articles in compute-tools manpage.
+ * Reverting adding LinkLocalAddressing=no to ipv6 interfaces as its only desirable on container bridges but breaks a few other things in normal containers.
+
+2022-06-05 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20220605.
+
+ * Backward incompatible changes:
+ - The container stop command is now interactive by default,
+ use 'container stop --force' / 'cnt stop -f' instead.
+
+ [ Daniel Baumann ]
+ * Correcting container status bash-completion to complete on all containers rather than only stopped ones.
+ * Using variables in directory paths in container key command.
+ * Adding default interactive mode for container stop command.
+ * Renaming force option in container stop command to kill in order to properly separate the three different stop modi (interactive, force, kill).
+ * Tracking container state in run files in /var/lib/compute-tools.
+ * Automatically restoring previous state after reboot by using last-on/last-off config options, thanks to Sakirnth Nagarasa <sakirnth@gmail.com> for the use-case and idea.
+ * Setting default for cnt.auto to last-on in debconf build scripts.
+
+2022-06-04 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20220604.
+
+ [ Daniel Baumann ]
+ * Adding --name option in container-info manpage.
+ * Adding missing dhcp option in select question of the debconf build script.
+ * Adding new 'stub' network interface method in debconf build-script, thanks to Sakirnth Nagarasa <sakirnth@gmail.com> for the use-case and idea.
+ * Adding LinkLocalAddressing=no to ipv6 interfaces.
+
+2022-05-22 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20220522.
+
+ [ Daniel Baumann ]
+ * Fixing copy&paste mistake in systemd-network run-files handling.
+
+2022-05-09 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20220509.
+
+ [ Daniel Baumann ]
+ * Correcting wrong preseed-file handling for new links directory in container build script.
+
+2022-05-08 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20220508.
+
+ [ Daniel Baumann ]
+ * Correcting off-by-one error when warning about too long veth interface names in container start commend.
+ * Adding comments about debconf hierarchy in debconf build script.
+ * Using versioned sort when sorting debconf templates.
+ * Excluding /etc/compute-tools/debconf/links from being shown in preseed file selection dialog to declutter automatization symlinks from real templates.
+ * Explicitly prefering links subdirectory over other locations withint debconf hierarchy in debconf build scripts.
+
+2022-05-05 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20220505.
+
+ [ Daniel Baumann ]
+ * Adding container rebuild command.
+ * Correcting wrong shortlink for container restart command (rs instead of rt).
+ * Updating copyright notices for 2022.
+ * Showing all IP address for stopped containers in container list command.
+ * Supporting both ifupdown and systemd-networkd for the time being, depending on the existence of /etc/network/interfaces.
+ * Readding old ifupdown documentation for the time being.
+
+2022-04-30 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20220430.
+
+ [ Simon Spöhel ]
+ * Updating documentation for systemd-networkd.
+
+ [ Daniel Baumann ]
+ * Actually passing through SSH_CLIENT variable to enable powerline-prompt in container enter command.
+ * Listing all IP addresses in container list command.
+
+2022-04-28 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20220428.
+
+ [ Simon Spöhel ]
+ * Using systemd-networkd to manage veth interfaces on host.
+
+2021-12-31 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20211231.
+
+ [ Daniel Baumann ]
+ * Adding interactive option to container update command to ease skipping containers.
+ * Making name argument mandatory in container update command.
+
+2021-11-17 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20211117.
+
+ [ Daniel Baumann ]
+ * Adding complete debconf envars in container update command.
+ * Passing fix-missing to apt upgrade in container update command.
+
+2021-11-16 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20211116.
+
+ [ Daniel Baumann ]
+ * Adding comment about using grep to de-colorize apt messages in container update command.
+ * Making container update command work entirely non-interactive.
+ * Updating notifications in container update command.
+ * Refactoring notification in container update command.
+ * Adding notificiations for autoremovals in container update command.
+
+2021-11-15 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20211115.
+
+ [ Daniel Baumann ]
+ * Speeding up full-upgrades in container update command by removing redundant upgrade step.
+ * Preparing update notifications handling in container update command.
+ * Adding notification handling in container update command.
+
+2021-11-13 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20211113.
+
+ [ Daniel Baumann ]
+ * Replacing individual needrestart overrides by globally blacklisting container-tools service units.
+
+2021-11-03 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20211103.
+
+ [ Daniel Baumann ]
+ * Adding needrestart restart scripts.
+ * Enabling automatic needrestart blacklisting for containers.
+
+2021-11-02 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20211102.
+
+ [ Daniel Baumann ]
+ * Adding 'exit' in debconf build script, thanks to Katharina.
+ * Sorting preseed-file options in debconf build script.
+ * Renaming internal config variable to more suitable debconf in debconf build script.
+ * Also removing config file stub when exiting debconf build script.
+
+2021-08-04 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20210804.
+
+ [ Daniel Baumann ]
+ * Updating container update options in bash-completion.
+ * Fixing full-upgrade option in container update command.
+ * Harmonizing usage messages over all container commands with manpage references.
+ * Harmonizing parameter and usage in container build command.
+
+2021-07-27 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20210727.
+
+ [ Daniel Baumann ]
+ * Adding backward incompatible changes of the previous release to changelog.
+ * Correcting synopsis in container-run manpage.
+ * Adding container update command.
+ * Also adding notifications for container get command in container main program.
+ * Suffixing keys with keyid in container keyring samples for transparency and uniqueness of the keys.
+ * Adding manpage references in usage message in main container program.
+ * Hardening quoting in container main program.
+ * Supporting /etc/compute-tools/container.conf.d.
+ * Adding boliderplate variables in post-start.chown-nvidia.sh example hook for consistency.
+
2021-07-26 Daniel Baumann <daniel.baumann@open-infrastructure.net>
* Releasing version 20210726.
@@ -66,7 +295,7 @@
2021-06-29 Daniel Baumann <daniel.baumann@open-infrastructure.net>
- * Releasing version 20210628.
+ * Releasing version 20210629.
* Backward incompatible changes:
- The networking integration on the container host depended on
@@ -644,6 +873,7 @@
2016-12-10 Daniel Baumann <daniel.baumann@open-infrastructure.net>
* Releasing version 20161210.
+
* Backward incompatible changes:
- container list shows now only the first IPv4 address.
- container rename command has been renamed to move.
@@ -691,7 +921,7 @@
2016-11-25 Daniel Baumann <daniel.baumann@open-infrastructure.net>
- * Releasing version 20161122.
+ * Releasing version 20161125.
[ Daniel Baumann ]
* Renaming too generic internal getopt variables to avoid possible
@@ -702,6 +932,7 @@
2016-11-22 Daniel Baumann <daniel.baumann@open-infrastructure.net>
* Releasing version 20161122.
+
* Backward incompatible changes:
- renaming curl cache directory from /var/cache/container-tools/curl
to /var/cache/container-tools/images.
@@ -723,6 +954,7 @@
2016-11-12 Daniel Baumann <daniel.baumann@open-infrastructure.net>
* Releasing version 20161112.
+
* Backward incompatible changes:
- removes support to create Debian 8 (jessie) container in debconf
container create script.
@@ -746,6 +978,7 @@
2016-11-05 Daniel Baumann <daniel.baumann@open-infrastructure.net>
* Releasing version 20161105.
+
* Backward incompatible changes:
- container use systemd-networkd instead of ifupdown.
@@ -934,6 +1167,7 @@
2016-06-01 Daniel Baumann <daniel.baumann@open-infrastructure.net>
* Releasing version 20160601.
+
* Backward incompatible changes:
- for consistency reasons, instead of any file only files
with .cfg suffix are accepted as preseed files in
@@ -958,6 +1192,7 @@
2016-05-15 Daniel Baumann <daniel.baumann@open-infrastructure.net>
* Releasing version 20160515.
+
* Backward incompatible changes:
- container network configuration in the [start] section for
multi-interface support:
@@ -1023,6 +1258,7 @@
2016-04-15 Daniel Baumann <daniel.baumann@open-infrastructure.net>
* Releasing version 20160415.
+
* Backward incompatible changes:
- container stop command option -k|--kill renamed to -f|--force for
consistency
diff --git a/LICENSE.txt b/LICENSE.txt
index 94a9ed0..f288702 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
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/>.
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
+<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
diff --git a/Makefile b/Makefile
index 7bcccc9..ed219cc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
# Open Infrastructure: compute-tools
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -25,12 +25,18 @@ PROGRAM = container
SCRIPTS = bin/* libexec/*/*
+VERSION := $(shell cat VERSION.txt)
+
all: build
test:
@echo -n "Checking for syntax errors with sh... "
@for SCRIPT in $(SCRIPTS); \
do \
+ if grep -qs /usr/bin/python3 $${SCRIPT}; \
+ then \
+ continue; \
+ fi; \
sh -n $${SCRIPT}; \
echo -n "."; \
done
@@ -41,6 +47,10 @@ test:
then \
for SCRIPT in $(SCRIPTS); \
do \
+ if grep -qs /usr/bin/python3 $${SCRIPT}; \
+ then \
+ continue; \
+ fi; \
checkbashisms -f -x $${SCRIPT}; \
echo -n "."; \
done; \
@@ -55,6 +65,10 @@ test:
then \
for SCRIPT in $(SCRIPTS); \
do \
+ if grep -qs /usr/bin/python3 $${SCRIPT}; \
+ then \
+ continue; \
+ fi; \
shellcheck $${SCRIPT} || true; \
echo -n "."; \
done; \
@@ -81,6 +95,9 @@ install: build
mkdir -p $(DESTDIR)/usr/libexec
cp -r libexec/* $(DESTDIR)/usr/libexec
+ mkdir -p $(DESTDIR)/usr/lib/python3/dist-packages
+ cp -r python3/* $(DESTDIR)/usr/lib/python3/dist-packages
+
mkdir -p $(DESTDIR)/usr/share/$(SOFTWARE)
cp -r VERSION.txt $(DESTDIR)/usr/share/$(SOFTWARE)
cp -r share/config share/hooks share/keys share/build-scripts share/get-scripts $(DESTDIR)/usr/share/$(SOFTWARE)
@@ -91,6 +108,9 @@ install: build
mkdir -p $(DESTDIR)/etc/logrotate.d
cp -r share/logrotate/* $(DESTDIR)/etc/logrotate.d
+ mkdir -p $(DESTDIR)/etc/needrestart/conf.d
+ cp -r share/needrestart/* $(DESTDIR)/etc/needrestart/conf.d
+
mkdir -p $(DESTDIR)/etc/sysctl.d
cp -r share/procps/* $(DESTDIR)/etc/sysctl.d
@@ -130,6 +150,7 @@ install: build
ln -sf list $(DESTDIR)/usr/libexec/$(PROGRAM)/ls
ln -sf move $(DESTDIR)/usr/libexec/$(PROGRAM)/mv
ln -sf remove $(DESTDIR)/usr/libexec/$(PROGRAM)/rm
+ ln -sf rebuild $(DESTDIR)/usr/libexec/$(PROGRAM)/rb
ln -sf restart $(DESTDIR)/usr/libexec/$(PROGRAM)/rs
ln -sf start $(DESTDIR)/usr/libexec/$(PROGRAM)/s
ln -sf status $(DESTDIR)/usr/libexec/$(PROGRAM)/st
@@ -177,6 +198,11 @@ uninstall:
rm -f $(DESTDIR)/etc/sysctl.d/$$(basename $${FILE}); \
done
+ for FILE in share/needrestart/*; \
+ do \
+ rm -f $(DESTDIR)/etc/needrestart/conf.d/$$(basename $${FILE}); \
+ done
+
for FILE in share/logrotate/*; \
do \
rm -f $(DESTDIR)/etc/logrotate.d/$$(basename $${FILE}); \
@@ -193,6 +219,9 @@ uninstall:
rm -rf $(DESTDIR)/usr/share/$(SOFTWARE)
rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/usr/share || true
+ rm -rf $(DESTDIR)/usr/lib/python3/dist-packages/compute_tools
+ rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/usr/lib/python3/dist-packages
+
rm -rf $(DESTDIR)/usr/libexec/$(PROGRAM)
rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/usr/libexec || true
@@ -217,6 +246,28 @@ clean:
rm -f README.txt
-distclean:
+distclean: clean
+ rm -rf $(SOFTWARE)-$(VERSION)
reinstall: uninstall install
+
+release: distclean
+ git commit -a -s -S -m 'Releasing version $(VERSION).' || true
+ git tag -s -m 'Tagging version $(VERSION).' v$(VERSION) || true
+
+ mkdir -p $(SOFTWARE)-$(VERSION)
+ find . -mindepth 1 -maxdepth 1 -and -not -name ".git*" -and -not -name debian -and -not -name $(SOFTWARE)-$(VERSION) -exec cp \-a {} $(SOFTWARE)-$(VERSION) \;
+
+ for FORMAT in xz lzip; \
+ do \
+ EXTENSION=$$(echo $${FORMAT} | cut -b-2); \
+ tar --$${FORMAT} -cf ../$(SOFTWARE)-$(VERSION).tar.$${EXTENSION} $(SOFTWARE)-$(VERSION); \
+ sha512sum ../$(SOFTWARE)-$(VERSION).tar.$${EXTENSION} > ../$(SOFTWARE)-$(VERSION).tar.$${EXTENSION}.sha512; \
+ gpg --default-key 0xB62C61A10B93195F --armor -b ../$(SOFTWARE)-$(VERSION).tar.$${EXTENSION}; \
+ mv ../$(SOFTWARE)-$(VERSION).tar.$${EXTENSION}.asc ../$(SOFTWARE)-$(VERSION).tar.$${EXTENSION}.sig; \
+ done
+
+ rm -rf $(SOFTWARE)-$(VERSION)
+
+upload:
+ scp ../$(SOFTWARE)-$(VERSION).* get.open-infrastructure.net:/srv/get.open-infrastructure.net/software/$(SOFTWARE)/upstream
diff --git a/VERSION.txt b/VERSION.txt
index e8d397b..7a58b9c 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-20210726
+20221223
diff --git a/bin/container b/bin/container
index 172caec..fb52687 100755
--- a/bin/container
+++ b/bin/container
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -34,6 +34,7 @@ then
echo "Usage: ${PROGRAM} COMMAND1,COMMAND2,... [COMMON_OPTIONS]" >&2
echo
echo "See ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
fi
@@ -48,7 +49,7 @@ for COMMAND in $(echo "${COMMANDS}" | sed -e 's|,| |g')
do
if [ ! -e "/usr/libexec/${PROGRAM}/${COMMAND}" ]
then
- echo "'${COMMAND}': no such ${PROGRAM} command, see container(1)." >&2
+ echo "'${COMMAND}': no such ${PROGRAM} command, see ${PROGRAM}(1)." >&2
exit 1
fi
@@ -67,7 +68,7 @@ do
OPTIONS="$(echo "${OPTIONS}" | sed -e 's|--no-notification||')"
else
case "${COMMAND}" in
- build|b|get|g|move|mv|remove|rm|restart|rt|start|s|stop|t|update|u)
+ build|b|get|g|move|mv|remove|rm|rebuild|rb|restart|rs|start|s|stop|t|update|u)
if [ -z "${CONTAINER_USER}" ]
then
CONTAINER_USER="${SUDO_USER:-${USER}}"
diff --git a/bin/container-shell b/bin/container-shell
index 98ece06..d63c3c0 100755
--- a/bin/container-shell
+++ b/bin/container-shell
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
diff --git a/libexec/container/auto b/libexec/container/auto
index 0c9d136..83c5c50 100755
--- a/libexec/container/auto
+++ b/libexec/container/auto
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -76,6 +76,9 @@ Parameters ()
Usage ()
{
echo "Usage: ${PROGRAM} ${COMMAND} -f|--force -s|--start -t|--stop" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
@@ -108,17 +111,50 @@ esac
for FILE in "${CONFIG}"/*.conf
do
- if grep -Eqs "^ *cnt.auto=force-true" "${FILE}"
+ if ! grep -Eqs "^ *cnt.container-server=${HOST}" "${FILE}"
then
- OPTIONS="${OPTIONS} -f"
+ continue
fi
- if grep -Eqs "^ *cnt.auto=(force-true|true)" "${FILE}" && grep -Eqs "^ *cnt.container-server=${HOST}" "${FILE}"
- then
- CONTAINER="$(basename ${FILE} .conf)"
-
- cnt ${ACTION} -n ${CONTAINER} ${OPTIONS} || true
- fi
+ CONTAINER="$(basename ${FILE} .conf)"
+ CNT_AUTO="$(grep -Es "^ *cnt.auto=" ${FILE} | awk -F= '{ print $2 }')"
+
+ case "${ACTION}" in
+ start)
+ case "${CNT_AUTO}" in
+ force-true)
+ OPTIONS="${OPTIONS} -f"
+
+ cnt ${ACTION} -n ${CONTAINER} ${OPTIONS} || true
+ ;;
+
+ last-on)
+ if grep -qs start "/var/lib/${SOFTWARE}/state/${CONTAINER}.run" || \
+ [ ! -e "/var/lib/${SOFTWARE}/state/${CONTAINER}.run" ]
+ then
+ cnt start -n ${CONTAINER} ${OPTIONS} -f || true
+ fi
+ ;;
+
+ last-off)
+ if grep -qs start "/var/lib/${SOFTWARE}/state/${CONTAINER}.run"
+ then
+ cnt start -n ${CONTAINER} ${OPTIONS} -f || true
+ fi
+ ;;
+
+ true)
+ cnt ${ACTION} -n ${CONTAINER} ${OPTIONS} || true
+ ;;
+ esac
+ ;;
+
+ stop)
+ OPTIONS="${OPTIONS} -f --stateless"
+
+ cnt ${ACTION} -n ${CONTAINER} ${OPTIONS} || true
+ ;;
+ esac
done
# Post hooks
diff --git a/libexec/container/build b/libexec/container/build
index b64af48..2c29730 100755
--- a/libexec/container/build
+++ b/libexec/container/build
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -32,7 +32,7 @@ CONFIG_TEMPLATE="/usr/share/${SOFTWARE}/config/container.conf.in"
Parameters ()
{
- GETOPT_LONGOPTIONS="name:,cnt.container-server:,cnt.overlay:,cnt.overlay-options:,start:,bind:,bind-ro:,capability:,drop-capability:,script:,verbose,"
+ GETOPT_LONGOPTIONS="name:,cnt.auto:,cnt.container-server:,cnt.overlay:,cnt.overlay-options:,cnt.start:,bind:,bind-ro:,capability:,drop-capability:,script:,verbose,"
GETOPT_OPTIONS="n:,b:,c:,d:,s:,v,"
PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})"
@@ -123,7 +123,10 @@ Parameters ()
Usage ()
{
- echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [--cnt.container-server=true|false|FQDN] [--cnt.overlay=DIRECTORY_LOWER:DIRECTORY_UPPER:DIRECTORY_WORK:DIRECTORY_MERGED] [--cnt.overlay-options=OPTION[,OPTION]] [--cnt.start=OPTION[,OPTION]] [-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.auto=true|false|force-true|last-on|last-off] [--cnt.container-server=true|false|FQDN] [--cnt.overlay=DIRECTORY_LOWER:DIRECTORY_UPPER:DIRECTORY_WORK:DIRECTORY_MERGED] [--cnt.overlay-options=OPTION[,OPTION]] [--cnt.start=OPTION[,OPTION]] [-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
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
diff --git a/libexec/container/console b/libexec/container/console
index ce53712..be2b897 100755
--- a/libexec/container/console
+++ b/libexec/container/console
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -66,6 +66,9 @@ Parameters ()
Usage ()
{
echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
diff --git a/libexec/container/enter b/libexec/container/enter
index 2664fdc..b366ba6 100755
--- a/libexec/container/enter
+++ b/libexec/container/enter
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -66,6 +66,9 @@ Parameters ()
Usage ()
{
echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
@@ -108,7 +111,7 @@ done
SSH_CLIENT="${SSH_CLIENT:-127.0.0.1 0 0}"
# Run
-nsenter --all --target "${LEADER}" --wd="${MACHINES}/${NAME}/root" /usr/bin/script -c "LC_ALL=C.UTF-8 /bin/bash -l" -q /dev/null
+nsenter --all --target "${LEADER}" --wd="${MACHINES}/${NAME}/root" /usr/bin/script -c "LC_ALL=C.UTF-8 SSH_CLIENT=\"${SSH_CLIENT}\" /bin/bash -l" -q /dev/null
case "${SSH_CLIENT}" in
127.0.0.1*)
diff --git a/libexec/container/get b/libexec/container/get
index 1005f89..0d0f420 100755
--- a/libexec/container/get
+++ b/libexec/container/get
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -124,6 +124,9 @@ Parameters ()
Usage ()
{
echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [--cnt.container-server=true|false|FQDN] [--cnt.overlay=DIRECTORY_LOWER:DIRECTORY_UPPER:DIRECTORY_WORK:DIRECTORY_MERGED] [--cnt.overlay-options=OPTION[,OPTION]] [--cnt.start=OPTION[,OPTION]] [-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
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
diff --git a/libexec/container/info b/libexec/container/info
index 63c42ff..b713e7a 100755
--- a/libexec/container/info
+++ b/libexec/container/info
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -84,6 +84,9 @@ Parameters ()
Usage ()
{
echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [--status] [--os] [--ip]" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
@@ -140,30 +143,34 @@ esac
VERSION_BASH="$(chroot ${MACHINES}/${NAME} apt-cache policy bash | awk '/Installed: / { print $2 }')"
case "${VERSION_BASH}" in
- 4.1*)
+ 4.1-*|4.1.[0-9]*)
OS="Debian 6 (squeeze)"
;;
- 4.2*)
+ 4.2-*|4.2.[0-9]*)
OS="Debian 7 (wheezy)"
;;
- 4.3*)
+ 4.3-*|4.3.[0-9]*)
OS="Debian 8 (jessie)"
;;
- 4.4*)
+ 4.4-*|4.4.[0-9]*)
OS="Debian 9 (stretch)"
;;
- 5.0*)
+ 5.0-*|5.0.[0-9]*)
OS="Debian 10 (buster)"
;;
- 5.1*)
+ 5.1-*|5.1.[0-9]*)
OS="Debian 11 (bullseye)"
;;
+ 5.2-*|5.2.[0-9]*)
+ OS="Debian 12 (bookworm)"
+ ;;
+
*)
OS="n/a"
;;
@@ -171,16 +178,16 @@ esac
case "${STATUS}" in
started)
- IP="$(cnt run -n ${NAME} -- hostname -I | awk '{ print $1 }')"
+ IP="$(cnt run -n ${NAME} -- hostname -I)"
;;
*)
- if ls "${MACHINES}/${CONTAINER}/etc/systemd/network"/*.network > /dev/null 2>&1
+ if ls "${MACHINES}/${NAME}/etc/systemd/network"/*.network > /dev/null 2>&1
then
- IP="$(awk -FAddress= '/^Address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/systemd/network/*.network | head -n1)"
- elif [ -e "${MACHINES}/${CONTAINER}/etc/network/interfaces" ]
+ IP="$(awk -FAddress= '/^Address/ { printf "%s ", $2 }' ${MACHINES}/${NAME}/etc/systemd/network/*.network)"
+ elif [ -e "${MACHINES}/${NAME}/etc/network/interfaces" ]
then
- IP="$(awk '/address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/network/interfaces | head -n1)"
+ IP="$(awk '/address/ { printf "%s ", $2 }' ${MACHINES}/${NAME}/etc/network/interfaces)"
fi
IP="${IP:-n/a}"
diff --git a/libexec/container/key b/libexec/container/key
index 19b7fa9..efd214e 100755
--- a/libexec/container/key
+++ b/libexec/container/key
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -77,6 +77,9 @@ Parameters ()
Usage ()
{
echo "Usage: ${PROGRAM} ${COMMAND} [-a|--add KEY_FILE|KEY_ID] [-l|--list] [-r|--remove KEY|KEY_ID]" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
@@ -143,12 +146,12 @@ case "${ACTION}" in
if [ -e "${ADD}" ]
then
gpg --homedir "${KEYS}" --import "${ADD}"
- elif [ -e "/usr/share/compute-tools/keys/${ADD}" ]
+ elif [ -e "/usr/share/${SOFTWARE}/keys/${ADD}" ]
then
- gpg --homedir "${KEYS}" --import "/usr/share/compute-tools/keys/${ADD}"
- elif [ -e "/usr/share/compute-tools/keys/${ADD}.pub" ]
+ gpg --homedir "${KEYS}" --import "/usr/share/${SOFTWARE}/keys/${ADD}"
+ elif [ -e "/usr/share/${SOFTWARE}/keys/${ADD}.pub" ]
then
- gpg --homedir "${KEYS}" --import "/usr/share/compute-tools/keys/${ADD}.pub"
+ gpg --homedir "${KEYS}" --import "/usr/share/${SOFTWARE}/keys/${ADD}.pub"
else
gpg --homedir "${KEYS}" --recv "${ADD}"
fi
diff --git a/libexec/container/limit b/libexec/container/limit
index 6323a42..b7f6e9b 100755
--- a/libexec/container/limit
+++ b/libexec/container/limit
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -106,6 +106,9 @@ Parameters ()
Usage ()
{
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
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
diff --git a/libexec/container/list b/libexec/container/list
index 6567afb..e211b7c 100755
--- a/libexec/container/list
+++ b/libexec/container/list
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -109,6 +109,9 @@ Parameters ()
Usage ()
{
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
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
@@ -324,7 +327,7 @@ esac
if ls "${MACHINES}"/* > /dev/null 2>&1
then
- CONTAINERS="$(cd "${MACHINES}" 2>/dev/null && find -maxdepth 1 \( -type d -or -type l \) -and -not -name 'lost+found' -printf '%P\n' | sort)"
+ CONTAINERS="$(cd "${MACHINES}" 2>/dev/null && find -maxdepth 1 \( -type d -or -type l \) -and -not -name 'lost+found' -printf '%P\n' | sort -V)"
fi
for CONTAINER in ${CONTAINERS}
@@ -374,7 +377,7 @@ do
*)
LEADER="$(machinectl status ${CONTAINER} | awk '/Leader: / { print $2 }')"
- ADDRESS="$(nsenter --all --target "${LEADER}" /bin/hostname -I | sed -e 's|\r$||' | awk '{ print $1 }')"
+ ADDRESS="$(nsenter --all --target "${LEADER}" /bin/hostname -I)"
;;
esac
@@ -384,10 +387,10 @@ do
*)
if ls "${MACHINES}/${CONTAINER}/etc/systemd/network"/*.network > /dev/null 2>&1
then
- ADDRESS="$(awk -FAddress= '/^Address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/systemd/network/*.network | head -n1)"
+ ADDRESS="$(for IP in $(awk -FAddress= '/^Address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/systemd/network/*.network); do echo -n "${IP} "; done)"
elif [ -e "${MACHINES}/${CONTAINER}/etc/network/interfaces" ]
then
- ADDRESS="$(awk '/address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/network/interfaces | head -n1)"
+ ADDRESS="$(for IP in $(awk '/address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/network/interfaces); do echo -n "${IP} "; done)"
fi
ADDRESS="${ADDRESS:-n/a}"
diff --git a/libexec/container/log b/libexec/container/log
index e514391..b7a000d 100755
--- a/libexec/container/log
+++ b/libexec/container/log
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -76,6 +76,9 @@ Parameters ()
Usage ()
{
echo "Usage: ${PROGRAM} ${COMMAND} [-n|--name NAME] [-d|--date DATE|today|today-N|yesterday] [-u|--user USER]" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
diff --git a/libexec/container/move b/libexec/container/move
index a76cde1..fdc19e6 100755
--- a/libexec/container/move
+++ b/libexec/container/move
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -77,6 +77,9 @@ Parameters ()
Usage ()
{
echo "Usage: ${PROGRAM} ${COMMAND} [-f|--force] -n|--new NAME -o|--old NAME" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
diff --git a/libexec/container/rebuild b/libexec/container/rebuild
new file mode 100755
index 0000000..e526520
--- /dev/null
+++ b/libexec/container/rebuild
@@ -0,0 +1,152 @@
+#!/bin/sh
+
+# Copyright (C) 2014-2022 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 <https://www.gnu.org/licenses/>.
+
+set -e
+
+PROJECT="open-infrastructure"
+SOFTWARE="compute-tools"
+PROGRAM="container"
+COMMAND="$(basename ${0})"
+
+HOOKS="/etc/${SOFTWARE}/hooks"
+MACHINES="/var/lib/machines"
+
+Parameters ()
+{
+ OPTIONS_ALL=""
+
+ GETOPT_LONGOPTIONS="name:,force,verbose,"
+ GETOPT_OPTIONS="n:,f,v,"
+
+ 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
+ -n|--name)
+ NAME="${2}"
+ shift 2
+ ;;
+
+ -f|--force)
+ FORCE="true"
+ shift 1
+
+ OPTIONS_ALL="${OPTIONS_ALL} --force"
+ ;;
+
+ -v|--verbose)
+ VERBOSE="true"
+ shift 1
+
+ OPTIONS_ALL="${OPTIONS_ALL} --verbose"
+ ;;
+
+ --)
+ shift 1
+ break
+ ;;
+
+ *)
+ echo "'${COMMAND}': getopt error" >&2
+ exit 1
+ ;;
+ esac
+ done
+}
+
+Usage ()
+{
+ echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force] [-v|--verbose]" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
+ exit 1
+}
+
+Parameters "${@}"
+
+if [ -z "${NAME}" ]
+then
+ Usage
+fi
+
+case "${NAME}" in
+ ALL)
+ NAMES="$(${PROGRAM} list --format shell --started)"
+
+ for NAME in ${NAMES}
+ do
+ ${PROGRAM} rebuild,start --name ${NAME} ${OPTIONS_ALL} || true
+ done
+
+ exit 0
+ ;;
+esac
+
+if [ ! -e "${MACHINES}/${NAME}" ]
+then
+ echo "'${NAME}': no such container" >&2
+ exit 1
+fi
+
+# Pre hooks
+for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}"
+do
+ if [ -x "${FILE}" ]
+ then
+ "${FILE}"
+ fi
+done
+
+# Run
+case "${VERBOSE}" in
+ true)
+ echo -n "Rebuilding container ${NAME}..."
+ ;;
+esac
+
+${PROGRAM} stop ${OPTIONS_ALL} --name ${NAME} || true
+sleep 0.5
+${PROGRAM} remove ${OPTIONS_ALL} --name ${NAME} || true
+sleep 0.5
+${PROGRAM} build --name ${NAME} || true
+
+case "${VERBOSE}" in
+ true)
+ echo " done."
+ ;;
+esac
+
+# Post hooks
+for FILE in "${HOOKS}/post-${COMMAND}".* "${HOOKS}/${NAME}.post-${COMMAND}"
+do
+ if [ -x "${FILE}" ]
+ then
+ "${FILE}"
+ fi
+done
diff --git a/libexec/container/remove b/libexec/container/remove
index 3205c32..4cb5d48 100755
--- a/libexec/container/remove
+++ b/libexec/container/remove
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -90,6 +90,9 @@ Parameters ()
Usage ()
{
echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [--allow-stop] [-f|--force] [-v|--verbose]" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
@@ -147,7 +150,7 @@ case "${STATE}" in
case "${ALLOW_STOP}" in
true)
echo "'${NAME}': container is started, stopping it now" >&2
- ${PROGRAM} stop -n ${NAME}
+ ${PROGRAM} stop -n ${NAME} -f
;;
*)
diff --git a/libexec/container/restart b/libexec/container/restart
index 922629d..0eb753c 100755
--- a/libexec/container/restart
+++ b/libexec/container/restart
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -31,8 +31,8 @@ Parameters ()
{
OPTIONS_ALL=""
- GETOPT_LONGOPTIONS="name:,verbose,"
- GETOPT_OPTIONS="n:,v,"
+ GETOPT_LONGOPTIONS="name:,force,interactive,verbose,"
+ GETOPT_OPTIONS="n:,f,i,v,"
PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})"
@@ -52,6 +52,20 @@ Parameters ()
shift 2
;;
+ -f|--force)
+ FORCE="true"
+ shift 1
+
+ OPTIONS_ALL="${OPTIONS_ALL} --force"
+ ;;
+
+ -i|--interactive)
+ INTERACTIVE="true"
+ shift 1
+
+ OPTIONS_ALL="${OPTIONS_ALL} --interactive"
+ ;;
+
-v|--verbose)
VERBOSE="true"
shift 1
@@ -74,7 +88,10 @@ Parameters ()
Usage ()
{
- echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-v|--verbose]" >&2
+ echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force] [-i|--interactive] [-v|--verbose]" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
@@ -104,6 +121,23 @@ then
exit 1
fi
+if [ "${FORCE}" != "true" ] || [ "${INTERACTIVE}" = "true" ]
+then
+ echo -n "'${NAME}': restart container '${NAME}' [y|N]? "
+ read STOP
+
+ STOP="$(echo ${STOP} | tr '[A-Z]' '[a-z]')"
+
+ case "${STOP}" in
+ y|yes)
+ ;;
+
+ *)
+ exit 1
+ ;;
+ esac
+fi
+
# Pre hooks
for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}"
do
diff --git a/libexec/container/run b/libexec/container/run
index bf8d0a7..4daeaa2 100755
--- a/libexec/container/run
+++ b/libexec/container/run
@@ -66,6 +66,9 @@ Parameters ()
Usage ()
{
echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME -- COMMAND" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
diff --git a/libexec/container/start b/libexec/container/start
index 08c3611..1f22325 100755
--- a/libexec/container/start
+++ b/libexec/container/start
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -99,6 +99,9 @@ Parameters ()
Usage ()
{
echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force]" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
@@ -188,6 +191,13 @@ case "${HOST_ARCHITECTURE}" in
;;
esac
+if systemctl status systemd-networkd > /dev/null 2>&1
+then
+ NETWORK_SUBSYSTEM="systemd-networkd"
+else
+ NETWORK_SUBSYSTEM="ifupdown"
+fi
+
case "${START}" in
start)
;;
@@ -359,7 +369,7 @@ then
NETWORK_VETH_EXTRA="${NETWORK_VETH_EXTRA} --network-veth-extra=${VETH}"
INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')"
- if [ "$(echo ${INTERFACE} | wc -c)" -gt 15 ]
+ if [ "$(echo ${INTERFACE} | wc -c)" -gt 16 ]
then
echo "'${INTERFACE}': name exceeds maximum of 15 characters, network might be not working."
fi
@@ -379,7 +389,7 @@ then
INTERFACE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $1 }')"
BRIDGE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $2 }')"
- if [ "$(echo ${INTERFACE} | wc -c)" -gt 15 ]
+ if [ "$(echo ${INTERFACE} | wc -c)" -gt 16 ]
then
echo "'${INTERFACE}': name exceeds maximum of 15 characters, network might be not working."
fi
@@ -387,6 +397,9 @@ then
if [ -n "${BRIDGE}" ] && [ -n "${INTERFACE}" ]
then
+ case "${NETWORK_SUBSYSTEM}" in
+ ifupdown)
+
cat > "/etc/network/interfaces.d/${INTERFACE}" << EOF
allow-hotplug ${INTERFACE}
iface ${INTERFACE} inet manual
@@ -396,6 +409,22 @@ iface ${INTERFACE} inet manual
post-down ip link set ${INTERFACE} down
EOF
+ ;;
+
+ systemd-networkd)
+ mkdir -p /run/systemd/network
+
+cat > "/run/systemd/network/${INTERFACE}.network" << EOF
+[Match]
+Name=${INTERFACE}
+
+[Network]
+Bridge=${BRIDGE}
+EOF
+
+ networkctl reload
+ ;;
+ esac
else
echo "Warning bridge definition '${BRIDGE_DEFINITION}' not recognized (expected <bridge>:<interface>): Ignoring"
fi
@@ -527,6 +556,9 @@ case "${START}" in
;;
esac
+ mkdir -p "/var/lib/${SOFTWARE}/state"
+ echo "start" > "/var/lib/${SOFTWARE}/state/${NAME}.run"
+
${SETARCH} systemd-nspawn --keep-unit ${BIND} ${BIND_RO} ${BOOT} ${CAPABILITY} ${DIRECTORY} ${DROP_CAPABILITY} ${MACHINE} ${NETWORK_VETH_EXTRA} ${LINK_JOURNAL} ${REGISTER}
case "${VERBOSE}" in
diff --git a/libexec/container/status b/libexec/container/status
index 9c3a076..5b930a7 100755
--- a/libexec/container/status
+++ b/libexec/container/status
@@ -67,6 +67,9 @@ Parameters ()
Usage ()
{
echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
diff --git a/libexec/container/stop b/libexec/container/stop
index 4310a35..8ca98ce 100755
--- a/libexec/container/stop
+++ b/libexec/container/stop
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -34,8 +34,8 @@ Parameters ()
{
OPTIONS_ALL=""
- GETOPT_LONGOPTIONS="name:,force,clean,verbose,"
- GETOPT_OPTIONS="n:,f,v,"
+ GETOPT_LONGOPTIONS="name:,force,interactive,kill,clean,stateless,verbose,"
+ GETOPT_OPTIONS="n:,f,i,k,v,"
PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})"
@@ -62,6 +62,20 @@ Parameters ()
OPTIONS_ALL="${OPTIONS_ALL} --force"
;;
+ -i|--interactive)
+ INTERACTIVE="true"
+ shift 1
+
+ OPTIONS_ALL="${OPTIONS_ALL} --interactive"
+ ;;
+
+ -k|--kill)
+ KILL="true"
+ shift 1
+
+ OPTIONS_ALL="${OPTIONS_ALL} --kill"
+ ;;
+
--clean)
# internal option
CLEAN="true"
@@ -70,6 +84,14 @@ Parameters ()
OPTONS_ALL="${OPTIONS_ALL} --clean"
;;
+ --stateless)
+ # internal option
+ STATELESS="true"
+ shift 1
+
+ OPTIONS_ALL="${OPTIONS_ALL} --stateless"
+ ;;
+
-v|--verbose)
VERBOSE="true"
shift 1
@@ -92,7 +114,10 @@ Parameters ()
Usage ()
{
- echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force] [-v|--verbose]" >&2
+ echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force] [-i|--interactive] [-v|--verbose]" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
@@ -143,6 +168,13 @@ then
exit 1
fi
+if systemctl status systemd-networkd > /dev/null 2>&1
+then
+ NETWORK_SUBSYSTEM="systemd-networkd"
+else
+ NETWORK_SUBSYSTEM="ifupdown"
+fi
+
# Pre hooks
for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}"
do
@@ -217,7 +249,16 @@ case "${CLEAN}" in
for VETH in ${VETHS}
do
INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')"
- FILE="/etc/network/interfaces.d/${INTERFACE}"
+
+ case "${NETWORK_SUBSYSTEM}" in
+ ifupdown)
+ FILE="/etc/network/interfaces.d/${INTERFACE}"
+ ;;
+
+ systemd-networkd)
+ FILE="/run/systemd/network/${INTERFACE}.network"
+ ;;
+ esac
if [ -f "${FILE}" ]
then
@@ -244,7 +285,7 @@ case "${STATE}" in
;;
esac
-case "${FORCE}" in
+case "${KILL}" in
true)
MODE="terminate"
;;
@@ -254,6 +295,23 @@ case "${FORCE}" in
;;
esac
+if [ "${FORCE}" != "true" ] || [ "${INTERACTIVE}" = "true" ]
+then
+ echo -n "'${NAME}': stop container '${NAME}' [y|N]? "
+ read STOP
+
+ STOP="$(echo ${STOP} | tr '[A-Z]' '[a-z]')"
+
+ case "${STOP}" in
+ y|yes)
+ ;;
+
+ *)
+ exit 1
+ ;;
+ esac
+fi
+
# Run
case "${VERBOSE}" in
true)
@@ -263,7 +321,7 @@ esac
machinectl ${MODE} ${NAME}
-case "${FORCE}" in
+case "${KILL}" in
true)
VETHS="$(awk -Fnetwork-veth-extra= '/^network-veth-extra=/ { print $2 }' ${CONFIG}/${NAME}.conf | awk -F: '{ print $1 }')"
@@ -276,6 +334,16 @@ case "${FORCE}" in
;;
esac
+case "${STATELESS}" in
+ true)
+ ;;
+
+ *)
+ mkdir -p "/var/lib/${SOFTWARE}/state"
+ echo "stop" > "/var/lib/${SOFTWARE}/state/${NAME}.run"
+ ;;
+esac
+
case "${VERBOSE}" in
true)
echo " done."
diff --git a/libexec/container/top b/libexec/container/top
index c846000..268da9a 100755
--- a/libexec/container/top
+++ b/libexec/container/top
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -63,6 +63,9 @@ Parameters ()
Usage ()
{
echo "Usage: ${PROGRAM} ${COMMAND} [-d|--delay DELAY]" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
diff --git a/libexec/container/update b/libexec/container/update
index bb175d1..e2d9c80 100755
--- a/libexec/container/update
+++ b/libexec/container/update
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -28,8 +28,8 @@ HOOKS="/etc/${SOFTWARE}/hooks"
Parameters ()
{
- GETOPT_LONGOPTIONS="name:,full-upgrade,autoremove,purge,yes,"
- GETOPT_OPTIONS="n:,r,p,y,"
+ GETOPT_LONGOPTIONS="name:,full-upgrade,interactive,autoremove,purge,yes,"
+ GETOPT_OPTIONS="n:,f,i,r,p,y,"
PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})"
@@ -54,6 +54,11 @@ Parameters ()
shift 1
;;
+ -i|--interactive)
+ INTERACTIVE="true"
+ shift 1
+ ;;
+
-r|--autoremove)
AUTOREMOVE="true"
shift 1
@@ -84,12 +89,60 @@ Parameters ()
Usage ()
{
- echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--full-upgrade] [-r|--autoremove] [-p|--purge] [-y|--yes]" >&2
+ echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--full-upgrade] [-i|--interactive] [-r|--autoremove] [-p|--purge] [-y|--yes]" >&2
+ echo
+ echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
+
exit 1
}
Parameters "${@}"
+if [ -z "${NAME}" ]
+then
+ Usage
+fi
+
+Notification ()
+{
+ TYPE="${1}"
+ NUMBER="${2}"
+ PACKAGES="${3}"
+
+ if [ -z "${PACKAGES}" ]
+ then
+ return
+ fi
+
+ CONTAINER_USER="${SUDO_USER:-${USER}}"
+
+ DATE="$(date +%Y-%m-%d\ %H:%M:%S)"
+ HOST="$(hostname -f 2> /dev/null || hostname)"
+
+ # logfile
+ echo "${DATE} ${HOST} ${CONTAINER_USER} ${NAME} ${NUMBER} ${TYPE}: ${PACKAGES}" >> "/var/log/${SOFTWARE}/${PROGRAM}.log"
+
+ # irc
+ if [ -e /usr/bin/irk ]
+ then
+ for FILE in "/etc/${SOFTWARE}/${PROGRAM}.conf" "/etc/${SOFTWARE}/${PROGRAM}.conf.d"/*.conf
+ do
+ if [ -e "${FILE}" ]
+ then
+ . "${FILE}"
+ fi
+ done
+
+ if [ -n "${IRK_TARGETS}" ]
+ then
+ for TARGET in ${IRK_TARGETS}
+ do
+ irk "${TARGET}" "\x0300${CONTAINER_USER}\x03@\x0312${HOST}:\x03 \x0303${NAME}\x03 \x0307${NUMBER} ${TYPE}\x03: ${PACKAGES}"
+ done
+ fi
+ fi
+}
+
case "${NAME}" in
ALL)
NAMES="$(container list --started --format shell)"
@@ -109,24 +162,98 @@ do
fi
done
+if [ $(echo ${NAMES} | wc -w) -gt 1 ]
+then
+ NAME_LOOP="true"
+else
+ NAME_LOOP="false"
+fi
+
# Run
for NAME in ${NAMES}
do
+ case "${INTERACTIVE}" in
+ true)
+ case "${NAME_LOOP}" in
+ true)
+ echo
+ ;;
+ esac
+
+ echo -n "'${NAME}': update container '${NAME}' [y|N|a]? "
+ read UPDATE
+
+ UPDATE="$(echo ${UPDATE} | tr '[A-Z]' '[a-z]')"
+
+ case "${UPDATE}" in
+ a|all)
+ INTERACTIVE="false"
+ ;;
+
+ y|yes)
+ ;;
+
+ *)
+ case "${NAME_LOOP}" in
+ true)
+ continue
+ ;;
+
+ *)
+ exit 1
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+
echo "################################################################################"
echo "Updating ${NAME}"
echo "################################################################################"
- container run -n ${NAME} -- "apt update && apt ${YES} upgrade"
+ container run -n ${NAME} -- "apt update"
- case "${FULL_UPGRADE}" in
- true)
- container run -n ${NAME} -- "apt update && ${YES} full-upgrade"
+ UPDATE_NUMBER="$(container run -n ${NAME} -- "apt \-\-simulate full-upgrade" | awk '/^[0-9]* upgraded, / { print $1 }')"
+
+ case "${UPDATE_NUMBER}" in
+ 0)
+ ;;
+
+ *)
+ # usefull use of grep to de-colorize apt output
+ UPDATE_PACKAGES="$(for PACKAGE in $(container run -n ${NAME} -- "apt list \-\-upgradable 2>/dev/null | grep '\/'" | awk -F/ '{ print $1 }'); do echo -n "${PACKAGE} "; done | sed -e 's| $||'; echo)"
+
+ case "${FULL_UPGRADE}" in
+ true)
+ container run -n ${NAME} -- "DEBCONF_FRONTEND='noninteractive' DEBCONF_PRIORITY='critical' DEBCONF_NONINTERACTIVE_SEEN='true' DEBCONF_NOWARNINGS='true' apt \-o Dpkg::Options::=\-\-force-confold -f ${YES} full-upgrade"
+ ;;
+
+ *)
+ container run -n ${NAME} -- "DEBCONF_FRONTEND='noninteractive' DEBCONF_PRIORITY='critical' DEBCONF_NONINTERACTIVE_SEEN='true' DEBCONF_NOWARNINGS='true' apt \-o Dpkg::Options::=\-\-force-confold -f ${YES} upgrade"
+ ;;
+ esac
+
+ Notification "update(s)" "${UPDATE_NUMBER}" "${UPDATE_PACKAGES}"
;;
esac
case "${AUTOREMOVE}" in
true)
- container run -n ${NAME} -- "apt ${YES} autoremove ${PURGE}"
+ REMOVE_NUMBER="$(container run -n ${NAME} -- "apt \-\-simulate autoremove" | awk '/^[0-9]* upgraded, / { print $6 }')"
+
+ case "${REMOVE_NUMBER}" in
+ 0)
+ ;;
+
+ *)
+ REMOVE_PACKAGES="$(for LINE in $(container run -n ${NAME} -- "apt \-\-simulate autoremove" | grep '^ '); do echo ${LINE}; done | sed -e 's|^ ||' -e 's| $||'; echo)"
+
+ container run -n ${NAME} -- "apt ${YES} autoremove ${PURGE}"
+
+ Notification "removal(s)" "${REMOVE_NUMBER}" "$(echo ${REMOVE_PACKAGES})"
+ ;;
+ esac
;;
esac
diff --git a/libexec/container/version b/libexec/container/version
index 3b33a4d..e567f8f 100755
--- a/libexec/container/version
+++ b/libexec/container/version
@@ -1,6 +1,8 @@
-#!/bin/sh
+#!/usr/bin/python3
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Open Infrastructure: compute-tools
+
+# Copyright (C) 2014-2023 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -17,33 +19,38 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-set -e
-
-PROJECT="open-infrastructure"
-SOFTWARE="compute-tools"
-PROGRAM="container"
-COMMAND="$(basename ${0})"
-
-HOOKS="/etc/${SOFTWARE}/hooks"
-SHARE="/usr/share/${SOFTWARE}"
-
-# Pre hooks
-for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}"
-do
- if [ -x "${FILE}" ]
- then
- "${FILE}"
- fi
-done
-
-# Run
-cat "${SHARE}/VERSION.txt"
-
-# Post hooks
-for FILE in "${HOOKS}/post-${COMMAND}".* "${HOOKS}/${NAME}.post-${COMMAND}"
-do
- if [ -x "${FILE}" ]
- then
- "${FILE}"
- fi
-done
+from os import access, X_OK
+from pathlib import Path
+from subprocess import run
+from sys import exit, stderr, stdout
+
+import compute_tools.container as container
+
+def main():
+ # pre hooks
+ pre_hooks = Path('/etc/compute-tools/hooks').glob('pre-version.*')
+
+ if pre_hooks:
+ # hooks exist
+ for hook in pre_hooks:
+ if access(hook, X_OK):
+ # hook is executable
+ run(str(hook), shell=True, stderr=stderr, stdout=stdout)
+
+ # run
+ container.print_version()
+
+ # post hooks
+ post_hooks = Path('/etc/compute-tools/hooks').glob('post-version.*')
+
+ if post_hooks:
+ # hooks exist
+ for hook in post_hooks:
+ if access(hook, X_OK):
+ # hook is executable
+ run(str(hook), shell=True, stderr=stderr, stdout=stdout)
+
+ exit(0)
+
+if __name__ == '__main__':
+ main()
diff --git a/python3/compute_tools/__init__.py b/python3/compute_tools/__init__.py
new file mode 100644
index 0000000..563db06
--- /dev/null
+++ b/python3/compute_tools/__init__.py
@@ -0,0 +1,20 @@
+# Open Infrastructure: compute-tools
+
+# Copyright (C) 2014-2023 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 <https://www.gnu.org/licenses/>.
+
+from .container import *
diff --git a/python3/compute_tools/container/__init__.py b/python3/compute_tools/container/__init__.py
new file mode 100644
index 0000000..ca5248b
--- /dev/null
+++ b/python3/compute_tools/container/__init__.py
@@ -0,0 +1,20 @@
+# Open Infrastructure: compute-tools
+
+# Copyright (C) 2014-2023 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 <https://www.gnu.org/licenses/>.
+
+from .version import *
diff --git a/python3/compute_tools/container/version/__init__.py b/python3/compute_tools/container/version/__init__.py
new file mode 100644
index 0000000..2250170
--- /dev/null
+++ b/python3/compute_tools/container/version/__init__.py
@@ -0,0 +1,21 @@
+# Open Infrastructure: compute-tools
+
+# Copyright (C) 2014-2023 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 <https://www.gnu.org/licenses/>.
+
+from .functions import *
+from .variables import *
diff --git a/python3/compute_tools/container/version/functions.py b/python3/compute_tools/container/version/functions.py
new file mode 100644
index 0000000..b31f974
--- /dev/null
+++ b/python3/compute_tools/container/version/functions.py
@@ -0,0 +1,28 @@
+# Open Infrastructure: compute-tools
+
+# Copyright (C) 2014-2023 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 <https://www.gnu.org/licenses/>.
+
+from .variables import *
+
+def print_version():
+ print('Open Infrastructure: compute-tools' + ' ' + version)
+ print('Copyright (C) 2014-2023 Daniel Baumann <daniel.baumann@open-infrastructure.net>')
+ print('')
+ print('License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>')
+ print('This is free software: you are free to change and redistribute it.')
+ print('There is NO WARRANTY, to the extent permitted by law.')
diff --git a/python3/compute_tools/container/version/variables.py b/python3/compute_tools/container/version/variables.py
new file mode 100644
index 0000000..ea86d6b
--- /dev/null
+++ b/python3/compute_tools/container/version/variables.py
@@ -0,0 +1,21 @@
+# Open Infrastructure: compute-tools
+
+# Copyright (C) 2014-2023 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 <https://www.gnu.org/licenses/>.
+
+with open('/usr/share/compute-tools/VERSION.txt', 'r') as f:
+ version = f.readline().strip()
diff --git a/share/bash-completion/container b/share/bash-completion/container
index dfb7ad5..5b57193 100644
--- a/share/bash-completion/container
+++ b/share/bash-completion/container
@@ -1,6 +1,6 @@
# Open Infrastructure: compute-tools
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -257,14 +257,30 @@ _container()
;;
*)
- opts="-n --name -f --force"
+ opts="-n --name -f --force -i --interactive -k --kill"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
esac
;;
- restart|rt)
+ rebuild|rb)
+ case "${prev}" in
+ -n|--name)
+ opts="$(container list -f shell)"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ opts="-n --name -f --force -v --verbose"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+
+ restart|rs)
case "${prev}" in
-n|--name)
opts="$(container list -s -f shell)"
@@ -299,7 +315,7 @@ _container()
status|st)
case "${prev}" in
-n|--name)
- opts="$(container list -t -f shell)"
+ opts="$(container list -f shell)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
@@ -343,7 +359,7 @@ _container()
;;
*)
- opts="-n --name -y --yes"
+ opts="-n --name -f --full-upgrade -r --autoremove -p --purge --y --yes"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
diff --git a/share/build-scripts/debconf b/share/build-scripts/debconf
index 39856ae..d6739ad 100755
--- a/share/build-scripts/debconf
+++ b/share/build-scripts/debconf
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -22,6 +22,7 @@ set -e
PROJECT="open-infrastructure"
SOFTWARE="compute-tools"
PROGRAM="container"
+VERSION="$(container version)"
SCRIPT="${0}"
export SCRIPT
@@ -116,23 +117,14 @@ then
exit 1
fi
-if [ -x /usr/bin/mmdebstrap ]
-then
- BOOTSTRAP="mmdebstrap"
-elif [ -x /usr/sbin/debootstrap ]
-then
- BOOTSTRAP="debootstrap"
-else
- echo "'${NAME}': /usr/bin/mmdebstrap or /usr/sbin/debootstrap - no such file." >&2
- exit 1
-fi
-
if [ "$(id -u)" -ne 0 ]
then
echo "'${NAME}': need root privileges" >&2
exit 1
fi
+HOST="$(echo ${NAME} | cut -d. -f1)"
+
Mount ()
{
# Mounting rw bind mounts
@@ -373,7 +365,7 @@ EOF
export DEBCONF_SYSTEMRC
}
-Debootstrap ()
+Bootstrap ()
{
DIRECTORY="${1}"
@@ -405,7 +397,8 @@ Debootstrap ()
mmdebstrap)
mmdebstrap --arch=${ARCHITECTURE} --components=${PARENT_ARCHIVE_AREAS} \
- --mode=root --include=${INCLUDE} ${PARENT_DISTRIBUTION} "${DIRECTORY}" ${PARENT_MIRROR}
+ --format=directory --mode=root --aptopt='APT::Sandbox::User "root"' \
+ --include=${INCLUDE} ${PARENT_DISTRIBUTION} "${DIRECTORY}" ${PARENT_MIRROR}
;;
*)
@@ -415,6 +408,83 @@ Debootstrap ()
esac
}
+Image ()
+{
+ DIRECTORY="${1}"
+
+ FILES="${IMAGE}"
+
+ for NUMBER in $(seq 1 ${IMAGE_NUMBER})
+ do
+ eval FILES="${FILES} $`echo IMAGE${NUMBER}`"
+ done
+
+ for FILE in ${FILES}
+ do
+ case "${FILE}" in
+ *.gz)
+ TAR_OPTIONS="--gzip"
+
+ if [ ! -e /bin/gzip ]
+ then
+ echo -en "\n"
+ echo "'${NAME}': /bin/lzip - no such file." >&2
+ exit 1
+ fi
+ ;;
+
+ *.lz)
+ TAR_OPTIONS="--lzip"
+
+ if [ ! -e /usr/bin/lzip ]
+ then
+ echo -en "\n"
+ echo "'${NAME}': /usr/bin/lzip - no such file." >&2
+ exit 1
+ fi
+ ;;
+
+ *.xz)
+ TAR_OPTIONS="--xz"
+
+ if [ ! -e /usr/bin/xz ]
+ then
+ echo -en "\n"
+ echo "'${NAME}': /usr/bin/xz - no such file." >&2
+ exit 1
+ fi
+ ;;
+
+ *)
+ TAR_OPTIONS=""
+ ;;
+ esac
+
+ mkdir -p "${DIRECTORY}"
+
+ echo "Using ${FILE}"
+
+ if [ -e /usr/bin/pv ]
+ then
+ curl --fail --location --progress-bar --user-agent ${SOFTWARE}/${VERSION} --http2 ${CURL_TIME_COND} \
+ "${FILE}" -o - | \
+ pv --format '%p' --width 77 | \
+ tar -C "${DIRECTORY}" --strip 1 ${TAR_OPTIONS} -xf -
+ #pv --format '%p' --width 77 "${CACHE}/${FILE}" | tar xf - ${TAR_OPTIONS} -C "${DIRECTORY}" --strip 1
+ else
+ curl --fail --location --progress-bar --user-agent ${SOFTWARE}/${VERSION} --http2 ${CURL_TIME_COND} \
+ "${FILE}" -o - | \
+ tar -C "${DIRECTORY}" --strip 1 ${TAR_OPTIONS} -xf -
+ fi
+
+ echo " ok."
+ done
+
+ # Writing resolv.conf
+ rm -f "${DIRECTORY}/etc/resolv.conf"
+ cp /etc/resolv.conf "${DIRECTORY}/etc"
+}
+
Configure_apt ()
{
DIRECTORY="${1}"
@@ -444,7 +514,11 @@ EOF
rm -f "${DIRECTORY}/progress-linux.cfg"
- Chroot "${DIRECTORY}" "apt update"
+ case "${INSTALLER}" in
+ bootstrap)
+ Chroot "${DIRECTORY}" "apt update"
+ ;;
+ esac
;;
esac
}
@@ -470,6 +544,9 @@ EOF
rm -f "${DIRECTORY}/etc/mtab"
ln -s /proc/self/mounts "${DIRECTORY}/etc/mtab"
+ # Removing machine-id
+ rm -f "${DIRECTORY}/etc/machine-id"
+
# Removing resolv.conf
rm -f "${DIRECTORY}/etc/resolv.conf"
cp /etc/resolv.conf "${DIRECTORY}/etc"
@@ -611,6 +688,7 @@ EOF
sed -e "s|@FILE@|${FILE}|g" \
-e "s|@NAME@|${NAME}|g" \
+ -e "s|@HOST@|${HOST}|g" \
-e "s|@IPV4_ADDRESS1@|${IPV4_ADDRESS1}|g" \
-e "s|@IPV4_ADDRESS1_PART1@|${IPV4_ADDRESS1_PART1}|g" \
-e "s|@IPV4_ADDRESS1_PART2@|${IPV4_ADDRESS1_PART2}|g" \
@@ -880,6 +958,14 @@ EOF
fi
;;
+
+ stub)
+
+cat >> "${DIRECTORY}/etc/systemd/network/eno${NUMBER}.network" << EOF
+DHCP=no
+EOF
+
+ ;;
esac
if [ -n "${IPV4_POST_UP}" ]
@@ -962,6 +1048,15 @@ EOF
fi
;;
+
+ stub)
+
+cat >> "${DIRECTORY}/etc/systemd/network/eno${NUMBER}.network" << EOF
+DHCP=no
+IPv6AcceptRA=no
+EOF
+
+ ;;
esac
if [ -n "${IPV6_POST_UP}" ]
@@ -1093,6 +1188,7 @@ trap 'Umount' EXIT HUP INT QUIT TERM
umask 0022
export NAME
+export HOST
Debconf
@@ -1119,22 +1215,89 @@ done
SYSTEM="${MACHINES}/${NAME}"
-## Generic parts
-if [ ! -e "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" ]
+if [ -z "${IMAGE}" ] && [ -z "${IMAGE1}" ]
then
- Debootstrap "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}.tmp"
- Configure_apt "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}.tmp"
- Deconfigure_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}.tmp"
-
- mv "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}.tmp" "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}"
+ INSTALLER="bootstrap"
+else
+ INSTALLER="image"
fi
-Upgrade_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" || echo "W: If upgrading the system failed, try removing the cache for your distribution in /var/cache/${PROGRAM}"
-Cleanup_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}"
+case "${INSTALLER}" in
+ bootstrap)
+ ## Dependencies
+ if [ -x /usr/bin/mmdebstrap ]
+ then
+ BOOTSTRAP="mmdebstrap"
+ elif [ -x /usr/sbin/debootstrap ]
+ then
+ BOOTSTRAP="debootstrap"
+ else
+ echo "'${NAME}': /usr/bin/mmdebstrap or /usr/sbin/debootstrap - no such file." >&2
+ exit 1
+ fi
+
+ ## Generic parts
+ if [ ! -e "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" ]
+ then
+ Bootstrap "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}.tmp"
+ Configure_apt "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}.tmp"
+ Deconfigure_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}.tmp"
+
+ 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/${PROGRAM}"
+ Cleanup_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}"
+
+ ## Specific parts
+ mkdir -p "${MACHINES}"
+ cp -a "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" "${MACHINES}/${NAME}"
+ ;;
+
+ image)
+ ## Dependencies
+ if [ -x /usr/bin/curl ]
+ then
+ GET="curl"
+ elif [ -x /usr/bin/wget ]
+ then
+ GET="wget"
+ else
+ echo "'${NAME}': /usr/bin/curl or /usr/bin/wget - no such file." >&2
+ exit 1
+ fi
+
+ COMPRESSIONS=""
+
+ if [ -x /usr/bin/lzip ]
+ then
+ COMPRESSIONS="${COMPRESSIONS} lz"
+ fi
+
+ if [ -x /usr/bin/xz ]
+ then
+ COMPRESSIONS="${COMPRESSIONS} xz"
+ fi
+
+ if [ -x /bin/gzip ]
+ then
+ COMPRESSIONS="${COMPRESSIONS} gz"
+ fi
+
+ if [ -z "${COMPRESSIONS}" ]
+ then
+ echo "'${NAME}': no supported compressor available (lz, xz, gz)."
+ exit 1
+ fi
+
+ ## Parts
+ mkdir -p "${MACHINES}"
+ Image "${MACHINES}/${NAME}"
-## Specific parts
-mkdir -p "${MACHINES}"
-cp -a "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" "${MACHINES}/${NAME}"
+ Configure_apt "${MACHINES}/${NAME}"
+ Deconfigure_system "${MACHINES}/${NAME}"
+ ;;
+esac
Mount
diff --git a/share/build-scripts/debconf.d/0001-preseed-file b/share/build-scripts/debconf.d/0001-preseed-file
index d70e4e1..aa2c3c7 100755
--- a/share/build-scripts/debconf.d/0001-preseed-file
+++ b/share/build-scripts/debconf.d/0001-preseed-file
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -23,49 +23,67 @@ PROJECT="open-infrastructure"
SOFTWARE="compute-tools"
PROGRAM="container"
-CONFIG="/etc/${SOFTWARE}/debconf"
+CONFIG="/etc/${SOFTWARE}/config"
+DEBCONF="/etc/${SOFTWARE}/debconf"
DEBCONF_NOWARNINGS="true"
export DEBCONF_NOWARNINGS
. /usr/share/debconf/confmodule
+# debconf template hierarchy (first match wins):
+#
+# 1. user specified a preseed file through commandline options
+# 2. /etc/compute-tools/debconf/${NAME}.cfg exists
+# 3. /etc/compute-tools/debconf/links/${NAME}.cfg exists
+# 4. /etc/compute-tools/debconf/*/${NAME}.cfg exists (only one file!)
+# 5. /etc/compute-tools/debconf/default.cfg exists
+# 6. user chooses from list of available (if any) *.cfg files
+# (recursively) found in /etc/compute-tools/debconf,
+# /etc/compute-tools/debconf/links is excluded.
+
if [ -n "${PRESEED_FILE}" ]
then
# user specified one or more preseed files through commandline option
db_set container/preseed-file "${PRESEED_FILE}"
db_fset container/preseed-file seen true
-elif [ -e "${CONFIG}/${NAME}.cfg" ]
+elif [ -e "${DEBCONF}/${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 container/preseed-file "${CONFIG}/${NAME}.cfg"
+ db_set container/preseed-file "${DEBCONF}/${NAME}.cfg"
db_fset container/preseed-file seen true
-elif [ "$(ls ${CONFIG}/*/${NAME}.cfg 2>/dev/null | wc -l)" -eq 1 ]
+elif [ -e "${DEBCONF}/links/${NAME}.cfg" ]
+then
+ # user did not specify a pressed file, but there is a matching one
+ # in /etc/${SOFTWARE}/debconf/links directory
+ db_set container/preseed-file "${DEBCONF}/links/${NAME}.cfg"
+ db_fset container/preseed-file seen true
+elif [ "$(ls ${DEBCONF}/*/${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/${SOFTWARE}/debconf
- FILE="$(ls ${CONFIG}/*/${NAME}.cfg)"
+ FILE="$(ls ${DEBCONF}/*/${NAME}.cfg)"
db_set container/preseed-file "${FILE}"
db_fset container/preseed-file seen true
-elif [ -e "${CONFIG}/default.cfg" ]
+elif [ -e "${DEBCONF}/default.cfg" ]
then
# user did not specify a pressed file, but there is a default one
- db_set container/preseed-file "${CONFIG}/default.cfg"
+ db_set container/preseed-file "${DEBCONF}/default.cfg"
db_fset container/preseed-file seen true
-elif ls "${CONFIG}"/*.cfg > /dev/null 2>&1 || ls "${CONFIG}"/*/*.cfg > /dev/null 2>&1
+elif ls "${DEBCONF}"/*.cfg > /dev/null 2>&1 || ls "${DEBCONF}"/*/*.cfg > /dev/null 2>&1
then
# user has not specified preseed files through commandline option,
# showing debconf selection dialog for global preseed file.
- FILES="$(cd ${CONFIG} && find . -type f -name '*.cfg' -printf '%P\n' | LC_ALL=C sort)"
+ FILES="$(cd ${DEBCONF} && find . -type f -name '*.cfg' -printf '%P\n' | grep -v '^links\/' | LC_ALL=C sort -V)"
PRESEED_FILES="$(for FILE in ${FILES}; do echo -n "$(echo ${FILE} | sed -e 's|.cfg$||'), "; done | sed -e 's|, $||')"
if [ -n "${PRESEED_FILES}" ]
then
- db_subst container/preseed-files CHOICES "none, custom, , ${PRESEED_FILES}"
+ db_subst container/preseed-files CHOICES "custom, exit, none, , ${PRESEED_FILES}"
db_settitle container/title
db_input high container/preseed-files || true
@@ -75,12 +93,17 @@ then
PRESEED_FILE="${RET}" # select
case "${PRESEED_FILE}" in
- none|custom)
+ custom|none)
+ ;;
+
+ exit)
+ rm -f "${CONFIG}/${NAME}.conf"
+ exit 1
;;
*)
# user specified preseed file through debconf select
- db_set container/preseed-file "${CONFIG}/${PRESEED_FILE}.cfg"
+ db_set container/preseed-file "${DEBCONF}/${PRESEED_FILE}.cfg"
db_fset container/preseed-file seen true
;;
esac
diff --git a/share/build-scripts/debconf.d/0002-preseed-debconf b/share/build-scripts/debconf.d/0002-preseed-debconf
index 4bc4da6..e4b5f44 100755
--- a/share/build-scripts/debconf.d/0002-preseed-debconf
+++ b/share/build-scripts/debconf.d/0002-preseed-debconf
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -93,6 +93,7 @@ do
fi
sed -e "s|@NAME@|${NAME}|g" \
+ -e "s|@HOST@|${HOST}|g" \
-e "s|@IPV4_ADDRESS1@|${IPV4_ADDRESS1}|g" \
-e "s|@IPV4_ADDRESS1_PART1@|${IPV4_ADDRESS1_PART1}|g" \
-e "s|@IPV4_ADDRESS1_PART2@|${IPV4_ADDRESS1_PART2}|g" \
diff --git a/share/build-scripts/debconf.d/0003-debconf b/share/build-scripts/debconf.d/0003-debconf
index c1c4e79..e12e25e 100755
--- a/share/build-scripts/debconf.d/0003-debconf
+++ b/share/build-scripts/debconf.d/0003-debconf
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -44,6 +44,39 @@ Mode ()
export MODE
}
+Images ()
+{
+ if db_get container/image && [ "${RET}" ]
+ then
+ db_get container/image
+ IMAGE="${RET}" # string (w/o empty)
+
+ echo "IMAGE=\"${IMAGE}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ fi
+
+ NUMBER="1"
+
+ while db_get container/image${NUMBER} && [ "${RET}" ]
+ do
+ if db_get container/image${NUMBER}
+ then
+ eval IMAGE${NUMBER}="\"${RET}\"" # string (w/o empty)
+ fi
+
+ NUMBER="$((${NUMBER} + 1))"
+ done
+
+ IMAGE_NUMBER="$((${NUMBER} - 1))"
+
+ echo "IMAGE_NUMBER=\"${IMAGE_NUMBER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ for NUMBER in $(seq 1 ${IMAGE_NUMBER})
+ do
+ eval IMAGE="$`echo IMAGE${NUMBER}`"
+ echo "IMAGE${NUMBER}=\"${IMAGE}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ done
+}
+
Distribution ()
{
db_get container/distribution
@@ -53,18 +86,18 @@ Distribution ()
then
case "${MODE}" in
debian)
- db_subst container/distribution CHOICES "Debian GNU/Linux 10 \"buster\", Debian GNU/Linux 11 \"bullseye\", Debian GNU/Linux testing/bookworm, Debian GNU/Linux unstable/sid"
- db_subst container/distribution CHOICES_C "buster, bullseye, bookworm, sid"
+ db_subst container/distribution CHOICES "Debian GNU/Linux 10 \"buster\", Debian GNU/Linux 11 \"bullseye\", Debian GNU/Linux 12 \"bookworm\", Debian GNU/Linux testing, Debian GNU/Linux unstable/sid"
+ db_subst container/distribution CHOICES_C "buster, bullseye, bookworm, testing, sid"
- db_set container/distribution bullseye
+ db_set container/distribution bookworm
db_fset container/distribution seen false
;;
progress-linux)
- db_subst container/distribution CHOICES "Progress Linux 5 (engywuck), Progress Linux 5.99 (engywuck-backports), Progress Linux 6 (fuchur), Progress Linux 6.99 (fuchur-backports)"
- db_subst container/distribution CHOICES_C "engywuck, engywuck-backports, fuchur, fuchur-backports"
+ db_subst container/distribution CHOICES "Progress Linux 5 (engywuck), Progress Linux 5.99 (engywuck-backports), Progress Linux 6 (fuchur), Progress Linux 6.99 (fuchur-backports), Progress Linux 7 (graograman), Progress Linux 7.99 (graograman-backports)"
+ db_subst container/distribution CHOICES_C "engywuck, engywuck-backports, fuchur, fuchur-backports, graograman, graograman-backports"
- db_set container/distribution fuchur-backports
+ db_set container/distribution graograman-backports
db_fset container/distribution seen false
;;
esac
@@ -98,6 +131,10 @@ Parent_distribution ()
fuchur*)
PARENT_DISTRIBUTION="bullseye"
;;
+
+ graograman*)
+ PARENT_DISTRIBUTION="bookworm"
+ ;;
esac
;;
@@ -122,7 +159,7 @@ Architecture ()
arm64)
DEFAULT="arm64"
- CHOICES="Automatic, RaspberryPi 3 (arm64)"
+ CHOICES="Automatic, RaspberryPi 3 and newer (arm64)"
CHOICES_C="auto, arm64"
;;
@@ -485,18 +522,28 @@ Archive_areas ()
db_get container/archive-areas
ARCHIVE_AREAS="${RET}"
+ case "${PARENT_DISTRIBUTION}" in
+ bookworm|testing|sid)
+ ARCHIVE_AREAS_ALL="main, contrib, non-free, non-free-firmware"
+ ;;
+
+ *)
+ ARCHIVE_AREAS_ALL="main, contrib, non-free"
+ ;;
+ esac
+
if [ -z "${ARCHIVE_AREAS}" ]
then
case "${MODE}" in
progress-linux)
- db_subst container/archive-areas CHOICES "main, contrib, non-free"
+ db_subst container/archive-areas CHOICES "${ARCHIVE_AREAS_ALL}"
- db_set container/archive-areas "main, contrib, non-free"
+ db_set container/archive-areas "${ARCHIVE_AREAS_ALL}"
db_fset container/archive-areas seen false
;;
*)
- db_subst container/archive-areas CHOICES "main, contrib, non-free"
+ db_subst container/archive-areas CHOICES "${ARCHIVE_AREAS_ALL}"
db_set container/archive-areas "main"
db_fset container/archive-areas seen false
@@ -518,7 +565,7 @@ Archive_areas ()
;;
progress-linux)
- ARCHIVE_AREAS="main, contrib, non-free"
+ ARCHIVE_AREAS="${ARCHIVE_AREAS_ALL}"
;;
esac
fi
@@ -535,13 +582,23 @@ Parent_archive_areas ()
db_get container/parent-archive-areas
PARENT_ARCHIVE_AREAS="${RET}" # multiselect (w/o empty)
+ case "${PARENT_DISTRIBUTION}" in
+ bookworm|testing|sid)
+ PARENT_ARCHIVE_AREAS_ALL="main, contrib, non-free, non-free-firmware"
+ ;;
+
+ *)
+ PARENT_ARCHIVE_AREAS_ALL="main, contrib, non-free"
+ ;;
+ esac
+
if [ -z "${PARENT_ARCHIVE_AREAS}" ]
then
case "${MODE}" in
progress-linux)
- db_subst container/parent-archive-areas CHOICES "main, contrib, non-free"
+ db_subst container/parent-archive-areas CHOICES "${PARENT_ARCHIVE_AREAS_ALL}"
- db_set container/parent-archive-areas "main, contrib, non-free"
+ db_set container/parent-archive-areas "${PARENT_ARCHIVE_AREAS_ALL}"
db_fset container/parent-archive-areas seen false
db_settitle container/title
@@ -564,7 +621,7 @@ Parent_archive_areas ()
then
case "${MODE}" in
progress-linux)
- PARENT_ARCHIVE_AREAS="main, contrib, non-free"
+ PARENT_ARCHIVE_AREAS="${PARENT_ARCHIVE_AREAS_ALL}"
;;
*)
@@ -868,6 +925,20 @@ Network ()
db_input high container/network1/ipv4-post-down || true
db_go
;;
+
+ stub)
+ db_settitle container/title
+ db_input high container/network1/ipv4-comment || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv4-post-up || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv4-post-down || true
+ db_go
+ ;;
esac
db_settitle container/title
@@ -906,6 +977,20 @@ Network ()
db_input high container/network1/ipv6-post-down || true
db_go
;;
+
+ stub)
+ db_settitle container/title
+ db_input high container/network1/ipv6-comment || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv6-post-up || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv6-post-down || true
+ db_go
+ ;;
esac
if [ "${NETWORK1_IPV4_METHOD}" = "static" ] || [ "${NETWORK1_IPV6_METHOD}" = "static" ]
@@ -1205,10 +1290,10 @@ Internal_options ()
if db_get container/auto
then
- CNT_AUTO="${RET:-true}" # string (w/o empty)
+ CNT_AUTO="${RET:-last-on}" # string (w/o empty)
fi
- CNT_AUTO="${CNT_AUTO:-true}"
+ CNT_AUTO="${CNT_AUTO:-last-on}"
echo "CNT_AUTO=\"${CNT_AUTO}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
if db_get container/container-server
@@ -1256,6 +1341,7 @@ Internal_options ()
}
Mode
+Images
Distribution
Parent_distribution
diff --git a/share/build-scripts/debconf.d/0003-debconf.templates b/share/build-scripts/debconf.d/0003-debconf.templates
index 73952a8..551033a 100644
--- a/share/build-scripts/debconf.d/0003-debconf.templates
+++ b/share/build-scripts/debconf.d/0003-debconf.templates
@@ -10,6 +10,12 @@ Choices: ${CHOICES}
Description: Mode
Mode.
+Template: container/image
+Type: string
+Default:
+Description: Image
+ Image.
+
Template: container/distribution
Type: select
Default:
@@ -112,7 +118,7 @@ Description: Veth name
Template: container/network1/ipv4-method
Type: select
-Choices: dhcp, static, none
+Choices: dhcp, static, stub, none
Default:
Description: Ethernet Interface Method (IPv4)?
What method should be used to configure the ethernet interface?
@@ -173,7 +179,7 @@ Description: Ethernet post-down Command (IPv4)?
Template: container/network1/ipv6-method
Type: select
-Choices: static, none
+Choices: dhcp, static, stub, none
Default:
Description: Ethernet Interface Method (IPv6)?
What method should be used to configure the ethernet interface?
diff --git a/share/build-scripts/debootstrap b/share/build-scripts/debootstrap
index 4c047ee..5ab5db2 100755
--- a/share/build-scripts/debootstrap
+++ b/share/build-scripts/debootstrap
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -136,7 +136,7 @@ case "${SCRIPT}" in
mmdebstrap)
BOOTSTRAP="/usr/bin/mmdebstrap"
- BOOTSTRAP_OPTIONS="--mode=root"
+ BOOTSTRAP_OPTIONS="--format=directory --mode=root --aptopt='APT::Sandbox::User \"root\"'"
;;
esac
@@ -153,7 +153,7 @@ then
fi
ARCHITECTURE="${ARCHITECTURE:-$(dpkg --print-architecture)}"
-DISTRIBUTION="${DISTRIBUTION:-bullseye}"
+DISTRIBUTION="${DISTRIBUTION:-bookworm}"
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/doc/examples/bullseye.cfg b/share/doc/examples/bookworm.cfg
index 4582c9f..1f878f4 100644
--- a/share/doc/examples/bullseye.cfg
+++ b/share/doc/examples/bookworm.cfg
@@ -1,4 +1,4 @@
-# example for automated Debian 11 (bullseye) based container building
+# example for automated Debian 12 (bookworm) based container building
# using: sudo container build -s debian
debconf debconf/priority select critical
@@ -9,12 +9,12 @@ compute-tools container/mode select debian
#compute-tools container/preseed-files string
#compute-tools container/include-preseed-files string
-compute-tools container/distribution select bullseye
+compute-tools container/distribution select bookworm
#compute-tools container/parent-distribution select
compute-tools container/architecture select auto
-compute-tools container/archives multiselect bullseye-security, bullseye-updates
+compute-tools container/archives multiselect bookworm-security, bookworm-updates
#compute-tools container/parent-archives multiselect
compute-tools container/mirror string https://deb.debian.org/debian
diff --git a/share/doc/examples/container-images.sh b/share/doc/examples/container-images.sh
index e6947e3..b711048 100755
--- a/share/doc/examples/container-images.sh
+++ b/share/doc/examples/container-images.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -24,7 +24,7 @@
set -e
ARCHITECTURES="amd64 i386"
-DISTRIBUTIONS="stretch buster bullseye sid"
+DISTRIBUTIONS="buster bullseye bookworm sid"
MIRROR="https://deb.debian.org/debian"
INCLUDE="dbus"
diff --git a/share/doc/examples/fuchur-backports.cfg b/share/doc/examples/graograman-backports.cfg
index c02e776..d1d2640 100644
--- a/share/doc/examples/fuchur-backports.cfg
+++ b/share/doc/examples/graograman-backports.cfg
@@ -1,4 +1,4 @@
-# example for automated Progress Linux 6.99 (fuchur-backports) container building
+# example for automated Progress Linux 7.99 (graograman-backports) container building
# using: sudo container build -s progress-linux
debconf debconf/priority select critical
@@ -9,12 +9,12 @@ 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 fuchur-backports
+compute-tools container/distribution select graograman-backports
#compute-tools container/parent-distribution select
compute-tools container/architecture select auto
-compute-tools container/archives multiselect fuchur-security, fuchur-updates, fuchur-extras, fuchur-backports, fuchur-backports-extras
+compute-tools container/archives multiselect graograman-security, graograman-updates, graograman-extras, graograman-backports, graograman-backports-extras
#compute-tools container/parent-archives multiselect
compute-tools container/mirror string https://deb.progress-linux.org/packages
@@ -23,8 +23,8 @@ compute-tools container/mirror-security string https://deb.progress-linux.org/pa
compute-tools container/parent-mirror string https://deb.debian.org/debian
compute-tools container/parent-mirror-security string https://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/archive-areas multiselect main, contrib, non-free, non-free-firmware
+compute-tools container/parent-archive-areas multiselect main, contrib, non-free, non-free-firmware
compute-tools container/packages string knot-resolver openssh-server
diff --git a/share/doc/host-setup.old.txt b/share/doc/host-setup.old.txt
new file mode 100644
index 0000000..69368d1
--- /dev/null
+++ b/share/doc/host-setup.old.txt
@@ -0,0 +1,230 @@
+compute-tools: Host Setup (with ifupdown)
+=========================================
+
+
+1. Debian Packages
+-------------------
+
+apt install bridge-utils ifenslave vlan
+
+
+2. Boot Parameters
+------------------
+
+2.1 CGroup Memory Controller (optional)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In order to enable the memory controller the following boot parameter needs to be used:
+
+ cgroup_enable=memory
+
+
+2.2 CGroup Swap Controller (optional)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In order to enable the swap controller the following boot parameter needs to be used:
+
+ swapaccount=1
+
+2.3 vsyscall (legacy)
+~~~~~~~~~~~~~~~~~~~~~
+
+In order to be able to execute binaries linked to older libc versions
+(<= wheezy) on newer linux versions (>= buster), add the following boot
+parameter (see #881813 for more information):
+
+ vsyscall=emulate
+
+
+3. Networking
+~~~~~~~~~~~~~
+
+3.1 Configure Network Bridge
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+3.1.1 Bridge: 1 Interface, standalone, DHCP
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+cat > /etc/network/interfaces << EOF
+# /etc/network/interfaces
+
+source /etc/network/interfaces.d/*
+
+auto lo
+iface lo inet loopback
+
+iface eno1 inet manual
+
+auto bridge0
+iface bridge0 inet dhcp
+ bridge_ports eno1
+ bridge_fd 0
+ bridge_maxwait 0
+ bridge_stp 0
+EOF
+
+
+3.1.2 Bridge: 1 Interface, standalone, static
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+cat > /etc/network/interfaces << EOF
+# /etc/network/interfaces
+
+source /etc/network/interfaces.d/*
+
+auto lo
+iface lo inet loopback
+
+iface eno1 inet manual
+
+auto bridge0
+iface bridge0 inet static
+ address 10.0.0.2
+ gateway 10.0.0.1
+ netmask 24
+
+ pre-up ip link set eno1 down
+ pre-up ip link set eno1 up
+
+ bridge_ports eno1
+ bridge_fd 0
+ bridge_maxwait 0
+ bridge_stp 0
+EOF
+
+
+3.1.3 Bridge: 2 logical Interfaces, subnet, static
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+cat > /etc/network/interfaces << EOF
+# /etc/network/interfaces
+
+source /etc/network/interfaces.d/*
+
+auto lo
+iface lo inet loopback
+
+allow-hotplug eno1
+iface eno1 inet dhcp
+
+auto bridge0
+iface bridge0 inet static
+ address 10.0.0.1
+ netmask 24
+
+ pre-up ip link add name bridge0 type bridge
+ post-down ip link delete bridge0 type bridge
+
+ bridge_fd 0
+ bridge_maxwait 0
+ bridge_stp 0
+EOF
+
+
+3.1.4 Bridge: 3 physical Interfaces, vlan, bonding, static
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+cat > /etc/network/interfaces << EOF
+# /etc/network/interfaces
+
+source /etc/network/interfaces.d/*
+
+auto lo
+iface lo inet loopback
+
+allow-hotplug eno1
+iface eno1 inet dhcp
+
+iface eno2 inet manual
+
+iface eno3 inet manual
+
+auto bond0
+iface bond0 inet manual
+ up ip link set bond0 up
+ down ip link set bond0 down
+
+ slaves eno2 eno3
+
+ bond-mode 4
+ bond-miimon 100
+ bond-downdelay 200
+ bond-updelay 200
+ bond-lacp-rate 1
+ bond-xmit-hash-policy layer2+3
+
+iface bond0.100 inet manual
+ vlan-raw-device bond0
+
+auto bridge-100
+iface bridge-100 inet static
+ address 10.100.0.2
+ netmask 24
+
+ bridge_ports bond0.100
+ bridge_fd 0
+ bridge_maxwait 0
+ bridge_stp 0
+EOF
+
+
+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 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 "compute-tools,,," \
+ --home /var/lib/open-infrastructure/container-shell \
+ --shell /usr/bin/container-shell
+
+
+6. IPv4 and IPv6 dual-stack
+---------------------------
+
+Examples for /etc/network/interfaces above work for IPv6 too when using correct
+IPv6 addresses and netmasks.
+
+In order to use dual-stack, bridges must have a IPv4 address assigned
+(can be a dummy one from a privacy range or 127.0.0.0/8).
+
+Let me repeat: dual-stack only works when you assign a primary IPv6 address
+(private or public, doesn't matter) *and* add an additional IPv4 address.
+Yes, the IPv4 address can be a private address, the containers can still
+have a public IPv4 address.
+
+A complete example looks like this:
+
+auto bridge0
+iface bridge0 inet6 static
+ address 2a07:6b47:4::4:1
+ netmask 48
+
+ up ip addr add 127.4.4.1 dev $IFACE
+ down ip addr del 127.4.4.1 dev $IFACE
+
+ bridge_fd 0
+ bridge_maxwait 0
+ bridge_stp 0
+ bridge-mcquerier 1
diff --git a/share/doc/host-setup.txt b/share/doc/host-setup.txt
index 9a9ec94..083e1aa 100644
--- a/share/doc/host-setup.txt
+++ b/share/doc/host-setup.txt
@@ -1,11 +1,14 @@
-compute-tools: Host Setup
-=========================
+compute-tools: Host Setup (with systemd-networkd)
+=================================================
1. Debian Packages
-------------------
-apt install bridge-utils ifenslave vlan
+apt install systemd-networkd bridge-utils
+
+Make sure to enable networkd (sudo systemctl enable systemd-networkd)
+and convert /etc/network/interfaces (see systemd-networkd documentation).
2. Boot Parameters
@@ -45,126 +48,110 @@ parameter (see #881813 for more information):
3.1.1 Bridge: 1 Interface, standalone, DHCP
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-cat > /etc/network/interfaces << EOF
-# /etc/network/interfaces
-
-source /etc/network/interfaces.d/*
-
-auto lo
-iface lo inet loopback
+cat > /etc/systemd/network/bridge0.netdev << EOF
+[NetDev]
+Name=bridge0
+Kind=bridge
+EOF
-iface eno1 inet manual
+cat > /etc/systemd/network/bridge0.network << EOF
+[Match]
+Name=bridge-0
-auto bridge0
-iface bridge0 inet dhcp
- bridge_ports eno1
- bridge_fd 0
- bridge_maxwait 0
- bridge_stp 0
+[Network]
+DHCP=yes
EOF
3.1.2 Bridge: 1 Interface, standalone, static
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-cat > /etc/network/interfaces << EOF
-# /etc/network/interfaces
-
-source /etc/network/interfaces.d/*
-
-auto lo
-iface lo inet loopback
-
-iface eno1 inet manual
-
-auto bridge0
-iface bridge0 inet static
- address 10.0.0.2
- gateway 10.0.0.1
- netmask 24
-
- pre-up ip link set eno1 down
- pre-up ip link set eno1 up
-
- bridge_ports eno1
- bridge_fd 0
- bridge_maxwait 0
- bridge_stp 0
+cat > /etc/systemd/network/bridge0.netdev << EOF
+[NetDev]
+Name=bridge0
+Kind=bridge
EOF
+cat > /etc/systemd/network/bridge0.network << EOF
+[Match]
+Name=bridge-0
-3.1.3 Bridge: 2 logical Interfaces, subnet, static
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-cat > /etc/network/interfaces << EOF
-# /etc/network/interfaces
-
-source /etc/network/interfaces.d/*
-
-auto lo
-iface lo inet loopback
+[Network]
+Address=10.0.0.2/24
+Gateway=10.0.0.1
+EOF
-allow-hotplug eno1
-iface eno1 inet dhcp
-auto bridge0
-iface bridge0 inet static
- address 10.0.0.1
- netmask 24
+3.1.3 Bridge: 3 physical Interfaces, vlan, bonding, static
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- pre-up ip link add name bridge0 type bridge
- post-down ip link delete bridge0 type bridge
+cat > /etc/systemd/network/eno2.network<< EOF
+[Match]
+Name=eno2
- bridge_fd 0
- bridge_maxwait 0
- bridge_stp 0
+[Network]
+Bond=bond0
EOF
+cat > /etc/systemd/network/eno3.network<< EOF
+[Match]
+Name=eno3
-3.1.4 Bridge: 3 physical Interfaces, vlan, bonding, static
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-cat > /etc/network/interfaces << EOF
-# /etc/network/interfaces
-
-source /etc/network/interfaces.d/*
+[Network]
+Bond=bond0
+EOF
-auto lo
-iface lo inet loopback
+cat > /etc/systemd/network/bond0.netdev << EOF
+[NetDev]
+Name=bond0
+Kind=bond
+
+[Bond]
+Mode=802.3ad
+TransmitHashPolicy=layer3+4
+MIIMonitorSec=0.1
+UpDelaySec=0.2
+DownDelaySec=0.2
+EOF
-allow-hotplug eno1
-iface eno1 inet dhcp
+cat > /etc/systemd/network/bond0.network << EOF
+[Match]
+Name=bond0
-iface eno2 inet manual
+[Network]
+VLAN=100
+EOF
-iface eno3 inet manual
+cat > /etc/systemd/network/vlan-100.netdev << EOF
+[NetDev]
+Name=vlan-100
+Kind=vlan
-auto bond0
-iface bond0 inet manual
- up ip link set bond0 up
- down ip link set bond0 down
+[VLAN]
+Id=100
+EOF
- slaves eno2 eno3
+cat > /etc/systemd/network/vlan-100.netdev << EOF
+[Match]
+Name=vlan-100
- bond-mode 4
- bond-miimon 100
- bond-downdelay 200
- bond-updelay 200
- bond-lacp-rate 1
- bond-xmit-hash-policy layer2+3
+[Network]
+Bridge=bridge-100
+EOF
-iface bond0.100 inet manual
- vlan-raw-device bond0
+cat > /etc/systemd/network/bridge-100.netdev << EOF
+[NetDev]
+Name=bridge-100
+Kind=bridge
+EOF
-auto bridge-100
-iface bridge-100 inet static
- address 10.100.0.2
- netmask 24
+cat > /etc/systemd/network/bridge-100.network << EOF
+[Match]
+Name=bridge-100
- bridge_ports bond0.100
- bridge_fd 0
- bridge_maxwait 0
- bridge_stp 0
+[Network]
+Address=10.100.0.2/24
+Gateway=10.100.0.1
EOF
diff --git a/share/get-scripts/curl b/share/get-scripts/curl
index 4accea2..00a8d73 100755
--- a/share/get-scripts/curl
+++ b/share/get-scripts/curl
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -231,13 +231,6 @@ done
# FIXME: default server via configuration file
-CURL_OPTIONS=""
-
-if curl -V | grep -qs http2
-then
- CURL_OPTIONS="${CURL_OPTIONS} --http2"
-fi
-
if [ -z "${SYSTEM}" ]
then
# Downloading container list
@@ -259,7 +252,7 @@ then
GREP_PATTERN="${GREP_PATTERN:-${ARCHITECTURE}}"
echo "Downloading $(echo ${SERVER} | awk -F/ '{ print $3 }') container list"
- curl --fail --location --progress-bar --user-agent ${SOFTWARE}/${VERSION} ${CURL_OPTIONS} \
+ curl --fail --location --progress-bar --user-agent ${SOFTWARE}/${VERSION} --http2 \
"${SERVER}/container-list.txt" | grep -E "${GREP_PATTERN}" > "${DEBCONF_TMPDIR}/container-list.txt"
umask 0022
@@ -320,7 +313,7 @@ do
fi
echo "Downloading ${FILE}"
- curl --fail --location --progress-bar --user-agent ${SOFTWARE}/${VERSION} ${CURL_OPTIONS} ${CURL_TIME_COND} \
+ curl --fail --location --progress-bar --user-agent ${SOFTWARE}/${VERSION} --http2 ${CURL_TIME_COND} \
"${SERVER}/${FILE}" -o "${CACHE}/${FILE}"
fi
done
diff --git a/share/get-scripts/curl.d/0001-debconf b/share/get-scripts/curl.d/0001-debconf
index 083d469..5c5936e 100755
--- a/share/get-scripts/curl.d/0001-debconf
+++ b/share/get-scripts/curl.d/0001-debconf
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
diff --git a/share/hooks/post-start.chown-nvidia.sh b/share/hooks/post-start.chown-nvidia.sh
index 2a99bd3..225f13b 100755
--- a/share/hooks/post-start.chown-nvidia.sh
+++ b/share/hooks/post-start.chown-nvidia.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
diff --git a/share/hooks/pre-build.git-pull.sh b/share/hooks/pre-build.git-pull.sh
index d2cc152..f1ae24b 100755
--- a/share/hooks/pre-build.git-pull.sh
+++ b/share/hooks/pre-build.git-pull.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
diff --git a/share/hooks/pre-get.git-pull.sh b/share/hooks/pre-get.git-pull.sh
index d2cc152..f1ae24b 100755
--- a/share/hooks/pre-get.git-pull.sh
+++ b/share/hooks/pre-get.git-pull.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
diff --git a/share/hooks/pre-start.unlink-console.sh b/share/hooks/pre-start.unlink-console.sh
index b44491e..cebbe03 100755
--- a/share/hooks/pre-start.unlink-console.sh
+++ b/share/hooks/pre-start.unlink-console.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
diff --git a/share/man/Makefile b/share/man/Makefile
index a8af58d..a878dbd 100644
--- a/share/man/Makefile
+++ b/share/man/Makefile
@@ -1,6 +1,6 @@
# Open Infrastructure: compute-tools
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
diff --git a/share/man/compute-tools.7.rst b/share/man/compute-tools.7.rst
index 3252f05..33e6aea 100644
--- a/share/man/compute-tools.7.rst
+++ b/share/man/compute-tools.7.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
@@ -119,6 +119,12 @@ See container(1) for a list of all container commands.
Links
=====
+| * Linux Weekly News: Kernel / Containers
+| (https://lwn.net/Kernel/Index/#Containers)
+
+| * Linux Weekly News: Security / Containers
+| (https://lwn.net/Security/Index/#Containers)
+
| * 2016-02-24: Systemd vs. Docker
| (https://lwn.net/Articles/676831/)
diff --git a/share/man/container-auto.1.rst b/share/man/container-auto.1.rst
index 530d64c..68836eb 100644
--- a/share/man/container-auto.1.rst
+++ b/share/man/container-auto.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-build-debconf.1.rst b/share/man/container-build-debconf.1.rst
index 1649071..6543140 100644
--- a/share/man/container-build-debconf.1.rst
+++ b/share/man/container-build-debconf.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-build-debootstrap.1.rst b/share/man/container-build-debootstrap.1.rst
index 853b4dc..10538c5 100644
--- a/share/man/container-build-debootstrap.1.rst
+++ b/share/man/container-build-debootstrap.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
@@ -61,7 +61,7 @@ The following script options are available:
Specify the Debian architecture, defaults to the host systems architecture.
-d, --distribution='DISTRIBUTION':
- Specify the Debian distribution, defaults to 'bullseye'.
+ Specify the Debian distribution, defaults to 'bookworm'.
-m, --mirror='MIRROR':
Specify the Debian mirror, defaults to 'https://deb.debian.org/debian'.
@@ -72,15 +72,15 @@ The following script options are available:
Examples
========
-Build a Debian 11 (bullseye) based container with same architecture as the host
+Build a Debian 12 (bookworm) based container with same architecture as the host
system using debootstrap:
- sudo container build -s debootstrap -n bullseye.example.net
+ sudo container build -s debootstrap -n bookworm.example.net
-Build a Debian 11 (bullseye) based container with different architecture as the
+Build a Debian 12 (bookworm) based container with different architecture as the
host system using mmdebstrap:
- sudo container build -s mmdebstrap -n bullseye-i386.example.net -- -a i386
+ sudo container build -s mmdebstrap -n bookworm-i386.example.net -- -a i386
See also
========
diff --git a/share/man/container-build.1.rst b/share/man/container-build.1.rst
index 38a4aed..faa0e16 100644
--- a/share/man/container-build.1.rst
+++ b/share/man/container-build.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-console.1.rst b/share/man/container-console.1.rst
index b07ba95..a3afd51 100644
--- a/share/man/container-console.1.rst
+++ b/share/man/container-console.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-enter.1.rst b/share/man/container-enter.1.rst
index 4948e3a..65961f5 100644
--- a/share/man/container-enter.1.rst
+++ b/share/man/container-enter.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-get-curl.1.rst b/share/man/container-get-curl.1.rst
index ba44ba0..01ae592 100644
--- a/share/man/container-get-curl.1.rst
+++ b/share/man/container-get-curl.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
@@ -82,22 +82,22 @@ The following script options are available:
--system='SYSTEM':
Specify the system image name to download, defaults to
- debian-bullseye-current_${ARCHITECTURE}.system.tar.${COMPRESSION} (where
+ debian-bookworm-current_${ARCHITECTURE}.system.tar.${COMPRESSION} (where
${ARCHITECTURE} is the host systems architecture and ${COMPRESSION} either
lz, xz, or gz depending on compressor availability on the host system).
Examples
========
-Download a Debian 11 (bullseye) based container with same architecture as the host
+Download a Debian 12 (bookworm) based container with same architecture as the host
system:
- sudo container get -s curl -n bullseye.example.net
+ sudo container get -s curl -n bookworm.example.net
-Download a Debian 11 (bullseye) based container with different architecture as the
+Download a Debian 12 (bookworm) based container with different architecture as the
host system:
- sudo container get -s curl -n bullseye-i386.example.net -- --system debian-bullseye-current_i386.system.tar.xz
+ sudo container get -s curl -n bookworm-i386.example.net -- --system debian-bookworm-current_i386.system.tar.xz
Files
=====
diff --git a/share/man/container-get.1.rst b/share/man/container-get.1.rst
index edcb1de..8ec61de 100644
--- a/share/man/container-get.1.rst
+++ b/share/man/container-get.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-info.1.rst b/share/man/container-info.1.rst
index c3c8e7d..99ccb55 100644
--- a/share/man/container-info.1.rst
+++ b/share/man/container-info.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
@@ -44,6 +44,9 @@ Options
The following **container info** options are available, defaults to '--status
--os --ip':
+-n, --name='NAME':
+ Specify container name. Specifying 'ALL' will start all stopped container.
+
--status:
Show container status (started|stopped|other).
diff --git a/share/man/container-key.1.rst b/share/man/container-key.1.rst
index d21956a..d02fc3b 100644
--- a/share/man/container-key.1.rst
+++ b/share/man/container-key.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
@@ -59,6 +59,7 @@ Examples
Add a key to the keyring manually:
gpg --keyserver hkps://keys.openpgp.org --recv 0x55CF1BF986ABB9C7
+
gpg --armor --export 0x55CF1BF986ABB9C7 | sudo container key --add -
Assisted adding of the same key:
diff --git a/share/man/container-limit.1.rst b/share/man/container-limit.1.rst
index 67fad3d..715314e 100644
--- a/share/man/container-limit.1.rst
+++ b/share/man/container-limit.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-list.1.rst b/share/man/container-list.1.rst
index 6cd516f..674bacf 100644
--- a/share/man/container-list.1.rst
+++ b/share/man/container-list.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
@@ -106,6 +106,7 @@ Create a SVG image via nwdiag of all started and stopped containers:
Create a shell export of all started and stopped containers:
sudo container list -f shell
+
sudo container list -f sh
Create a YAML export of all started and stopped containers:
diff --git a/share/man/container-log.1.rst b/share/man/container-log.1.rst
index 7984aa0..5e72184 100644
--- a/share/man/container-log.1.rst
+++ b/share/man/container-log.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-move.1.rst b/share/man/container-move.1.rst
index 550f1db..ecbea6b 100644
--- a/share/man/container-move.1.rst
+++ b/share/man/container-move.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-rebuild.1.rst b/share/man/container-rebuild.1.rst
new file mode 100644
index 0000000..4f7bbd8
--- /dev/null
+++ b/share/man/container-rebuild.1.rst
@@ -0,0 +1,93 @@
+.. Open Infrastructure: compute-tools
+
+.. Copyright (C) 2014-2022 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 <https://www.gnu.org/licenses/>.
+
+=================
+container-rebuild
+=================
+
+-------------------
+Restart a container
+-------------------
+
+:manual section: 1
+:manual group: Open Infrastructure
+
+Synopsis
+========
+
+| **container rebuild** ['OPTIONS']
+| **cnt rb** ['OPTIONS']
+
+Description
+===========
+
+The **container rebuild** command rebuilds a container by stopping, removing, building, and starting an existing container.
+
+Options
+=======
+
+The following **container rebuild** options are available:
+
+-n, --name='NAME':
+ Specify container name. Specifying 'ALL' will rebuild all started container.
+
+-f, --force:
+ Do not fail if container is running.
+
+-v, --verbose:
+ Explain what is being done.
+
+Examples
+========
+
+Rebuild example.net container:
+
+ sudo container rebuild -n example.net
+
+Restart all container:
+
+ sudo container rebuild -n ALL
+
+See also
+========
+
+| compute-tools(7),
+| container(1).
+
+Homepage
+========
+
+More information about compute-tools and the Open Infrastructure project can be
+found on the homepage (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
+(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-remove.1.rst b/share/man/container-remove.1.rst
index d62f527..00f1ad1 100644
--- a/share/man/container-remove.1.rst
+++ b/share/man/container-remove.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-restart.1.rst b/share/man/container-restart.1.rst
index fb98a78..c52353d 100644
--- a/share/man/container-restart.1.rst
+++ b/share/man/container-restart.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
@@ -47,6 +47,12 @@ The following **container restart** options are available:
-n, --name='NAME':
Specify container name. Specifying 'ALL' will restart all started container.
+-f, --force:
+ Do not prompt before every restarting.
+
+-i, --interactive:
+ Prompt before every restarting (default).
+
-v, --verbose:
Explain what is being done.
diff --git a/share/man/container-run.1.rst b/share/man/container-run.1.rst
index 9759811..0fb923d 100644
--- a/share/man/container-run.1.rst
+++ b/share/man/container-run.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-shell.1.rst b/share/man/container-shell.1.rst
index a41bd2a..b12958f 100644
--- a/share/man/container-shell.1.rst
+++ b/share/man/container-shell.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-start.1.rst b/share/man/container-start.1.rst
index b444c6e..65d4af7 100644
--- a/share/man/container-start.1.rst
+++ b/share/man/container-start.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-status.1.rst b/share/man/container-status.1.rst
index 79675be..ad51ba7 100644
--- a/share/man/container-status.1.rst
+++ b/share/man/container-status.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container-stop.1.rst b/share/man/container-stop.1.rst
index 29bfa3d..bf668be 100644
--- a/share/man/container-stop.1.rst
+++ b/share/man/container-stop.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
@@ -49,6 +49,12 @@ The following **container stop** options are available:
Specify container name. Specifying 'ALL' will stop all started container.
-f, --force:
+ Do not prompt before every stopping.
+
+-i, --interactive:
+ Prompt before every stopping (default).
+
+-k, --kill:
Instead of running the proper shutdown sequence, terminate all processes of the container imediatly.
-v, --verbose:
@@ -61,9 +67,13 @@ Shutdown example.net container:
sudo container stop -n example.net
+Shutdown example.net container without prompting:
+
+ sudo container stop -n example.net -f
+
Immediately stop example.net container:
- sudo container stop -n example.net -f
+ sudo container stop -n example.net -k
Stop all container:
diff --git a/share/man/container-top.1.rst b/share/man/container-top.1.rst
index 8d1493c..7349b60 100644
--- a/share/man/container-top.1.rst
+++ b/share/man/container-top.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
@@ -50,6 +50,7 @@ Examples
========
Dynamically list containers of the local system:
+
sudo container top
See also
diff --git a/share/man/container-update.1.rst b/share/man/container-update.1.rst
index 7b17ae2..ec64f6b 100644
--- a/share/man/container-update.1.rst
+++ b/share/man/container-update.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
@@ -50,6 +50,9 @@ The following **container update** options are available:
-f, --full-upgrade:
Runs an additional 'apt full-upgrade' after 'apt upgrade'.
+-i, --interactive:
+ Prompt before every container update.
+
-r, --autoremove:
Runs an additional 'apt autoremove' after 'apt upgrade'.
diff --git a/share/man/container-version.1.rst b/share/man/container-version.1.rst
index 3a57999..3f0266d 100644
--- a/share/man/container-version.1.rst
+++ b/share/man/container-version.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
diff --git a/share/man/container.1.rst b/share/man/container.1.rst
index 3fff87b..c08cbd9 100644
--- a/share/man/container.1.rst
+++ b/share/man/container.1.rst
@@ -1,6 +1,6 @@
.. Open Infrastructure: compute-tools
-.. Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.. Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
..
.. SPDX-License-Identifier: GPL-3.0+
..
@@ -59,6 +59,9 @@ build:
start:
Start a container, see container-start(1).
+rebuild:
+ Rebuild a container, see container-rebuild(1).
+
restart:
Restart a container, see container-restart(1).
diff --git a/share/man/man.in b/share/man/man.in
index 9e8de0e..45a5f40 100644
--- a/share/man/man.in
+++ b/share/man/man.in
@@ -1,6 +1,6 @@
.\" Open Infrastructure: compute-tools
.\"
-.\" Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+.\" Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
.\"
.\" SPDX-License-Identifier: GPL-3.0+
.\"
diff --git a/share/needrestart/container-tools.conf b/share/needrestart/container-tools.conf
new file mode 100644
index 0000000..cd1c76b
--- /dev/null
+++ b/share/needrestart/container-tools.conf
@@ -0,0 +1,6 @@
+# Open Infrastructure: compute-tools
+
+$nrconf{blacklist_rc} = [
+ # container-tools
+ qr(^container@(.*).service) => 0,
+];