summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--share/bash-completion/container18
-rw-r--r--share/config/container.conf.in1
-rw-r--r--share/man/container-create.1.txt3
-rw-r--r--share/man/container-info.1.txt87
-rw-r--r--share/man/container.1.txt3
-rwxr-xr-xshare/scripts/debconf32
-rw-r--r--share/systemd/container-auto.service4
-rw-r--r--share/systemd/container@.service1
8 files changed, 140 insertions, 9 deletions
diff --git a/share/bash-completion/container b/share/bash-completion/container
index 540f162..d966d7a 100644
--- a/share/bash-completion/container
+++ b/share/bash-completion/container
@@ -81,7 +81,7 @@ _container()
esac
;;
- enter)
+ enter|run)
case "${prev}" in
-n|--name)
opts="$(container list -s -f shell)"
@@ -97,6 +97,22 @@ _container()
esac
;;
+ info)
+ case "${prev}" in
+ -n|--name)
+ opts="$(container list -t -f shell)"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ opts="--status --os --ip"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+
key)
opts="-a --add -l --list -r --remove"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
diff --git a/share/config/container.conf.in b/share/config/container.conf.in
index d930803..3ab014d 100644
--- a/share/config/container.conf.in
+++ b/share/config/container.conf.in
@@ -6,6 +6,7 @@ cnt.container-server=@CNT_CONTAINER_SERVER@
cnt.network-bridge=@CNT_NETWORK_BRIDGE@
cnt.overlay=@CNT_OVERLAY@
cnt.overlay-options=@CNT_OVERLAY_OPTIONS@
+cnt.start=@CNT_START@
bind=@BIND@
bind-ro=@BIND_RO@
boot=@BOOT@
diff --git a/share/man/container-create.1.txt b/share/man/container-create.1.txt
index c49ac9c..4de8171 100644
--- a/share/man/container-create.1.txt
+++ b/share/man/container-create.1.txt
@@ -70,6 +70,9 @@ The following container-create options are available:
*--cnt.overlay-options='OPTION1,OPTION2[;OPTION3,OPTION4]'*::
Specify container overlay mount options, see Documentation/filesystems/overlayfs.txt.
+*--cnt.start='OPTION1[,OPTION2,...]'*::
+ Specify container start options, see container-start(1).
+
SCRIPTS
-------
diff --git a/share/man/container-info.1.txt b/share/man/container-info.1.txt
new file mode 100644
index 0000000..125bdef
--- /dev/null
+++ b/share/man/container-info.1.txt
@@ -0,0 +1,87 @@
+// Copyright (C) 2014-2021 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-LIST(1)
+=================
+:doctype: manpage
+:man manual: Open Infrastructure
+:man source: compute-tools
+:man version: {revnumber}
+
+
+NAME
+----
+container-info - Show specific information of a container
+
+
+SYNOPSIS
+--------
+*container info* ['OPTIONS']
+
+
+DESCRIPTION
+-----------
+The container info command shows specific information of a container.
+
+
+OPTIONS
+-------
+The following container options are available, defaults to *--status --os --ip*:
+
+*--status*::
+ Show container status (started|stopped|other).
+
+*--os*::
+ Show container operating system (FIXME: Debian only).
+
+*--ip*::
+ Show container IP address.
+
+EXAMPLES
+--------
+*Show example.net container status:*::
+ sudo container info -n example.net --status
+
+*Show example.net container operating system:*::
+ sudo container info -n example.net --os
+
+*Show example.net container IP address:*::
+ sudo container info -n example.net --ip
+
+
+SEE ALSO
+--------
+compute-tools(7),
+container(1).
+
+
+HOMEPAGE
+--------
+More information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net.
+
+
+CONTACT
+-------
+Bug reports, feature requests, help, patches, support and everything else
+are welcome on the Open Infrastructure Software Mailing List <software@lists.open-infrastructure.net>.
+
+Debian specific bugs can also be reported in the Debian Bug Tracking System at https://bugs.debian.org.
+
+
+AUTHORS
+-------
+compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others.
diff --git a/share/man/container.1.txt b/share/man/container.1.txt
index 7edc1f4..d2734d2 100644
--- a/share/man/container.1.txt
+++ b/share/man/container.1.txt
@@ -78,6 +78,9 @@ The following container commands are available:
*run*::
Execute commands in a container namespace, see container-run(1).
+*info*::
+ Show specific information of a container, see container-info(1).
+
*key*::
Manage GnuPG keyring for container operations, see container-key(1).
diff --git a/share/scripts/debconf b/share/scripts/debconf
index 1994926..9a703e5 100755
--- a/share/scripts/debconf
+++ b/share/scripts/debconf
@@ -115,9 +115,14 @@ then
exit 1
fi
-if [ ! -x /usr/sbin/debootstrap ]
+if [ -x /usr/bin/mmdebstrap ]
then
- echo "'${NAME}': /usr/sbin/debootstrap - no such file." >&2
+ 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
@@ -390,8 +395,23 @@ Debootstrap ()
esac
mkdir -p "$(dirname ${DIRECTORY})"
- debootstrap --verbose --arch=${ARCHITECTURE} --components=${PARENT_ARCHIVE_AREAS} \
- --exclude=${EXCLUDE} --include=${INCLUDE} ${PARENT_DISTRIBUTION} "${DIRECTORY}" ${PARENT_MIRROR}
+
+ case "${BOOTSTRAP}" in
+ debootstrap)
+ debootstrap --verbose --arch=${ARCHITECTURE} --components=${PARENT_ARCHIVE_AREAS} \
+ --exclude=${EXCLUDE} --include=${INCLUDE} ${PARENT_DISTRIBUTION} "${DIRECTORY}" ${PARENT_MIRROR}
+ ;;
+
+ mmdebstrap)
+ mmdebstrap --arch=${ARCHITECTURE} --components=${PARENT_ARCHIVE_AREAS} \
+ --mode=root --include=${INCLUDE} ${PARENT_DISTRIBUTION} "${DIRECTORY}" ${PARENT_MIRROR}
+ ;;
+
+ *)
+ echo "'${NAME}': ${BOOTSTRAP} - not supported" >&2
+ exit 1
+ ;;
+ esac
}
Configure_apt ()
@@ -607,7 +627,7 @@ EOF
do
if grep -qs locales "${FILE}"
then
- if [ -e "${DIRECTORY}/var/lib/dpkg/info/locales.list" ]
+ if Chroot "${DIRECTORY}" dpkg --get-selections | awk '{ print $1 }' | grep -qs '^locales$'
then
rm -f "${DIRECTORY}/etc/default/locale" "${DIRECTORY}/etc/locale.gen"
Chroot "${DIRECTORY}" "DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=criticial dpkg-reconfigure locales"
@@ -650,7 +670,7 @@ EOF
fi
# Manual hack to regenerate ssh keys
- if [ -e "${DIRECTORY}/var/lib/dpkg/info/openssh-server.postinst" ] && \
+ if Chroot "${DIRECTORY}" dpkg --get-selections | awk '{ print $1 }' | grep -qs '^openssh-server$' && \
! ls "${DIRECTORY}"/etc/ssh/ssh_host_*_key > /dev/null 2>&1
then
Chroot "${DIRECTORY}" "DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=criticial dpkg-reconfigure openssh-server"
diff --git a/share/systemd/container-auto.service b/share/systemd/container-auto.service
index 4d7e10e..805bdc6 100644
--- a/share/systemd/container-auto.service
+++ b/share/systemd/container-auto.service
@@ -9,8 +9,8 @@ RemainAfterExit=yes
ExecStart=/usr/bin/container auto --start
ExecStop=/usr/bin/container auto --stop
Delegate=yes
-StandardOutput=syslog
-StandardError=syslog
+StandardOutput=journal
+StandardError=journal
[Install]
WantedBy=multi-user.target
diff --git a/share/systemd/container@.service b/share/systemd/container@.service
index 9e9f720..5d4425e 100644
--- a/share/systemd/container@.service
+++ b/share/systemd/container@.service
@@ -4,6 +4,7 @@ Documentation=man:compute-tools
[Service]
Type=simple
+Environment=TERM=xterm-256color
ExecStart=/usr/bin/container start --name %i --nspawn --no-notification
ExecStartPost=/usr/bin/container start --name %i --start --no-notification
ExecStopPost=/usr/bin/container stop -n %i --clean --no-notification