summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt8
-rw-r--r--Makefile20
-rw-r--r--README.txt7
-rw-r--r--VERSION.txt2
-rwxr-xr-xlib/container/list91
-rw-r--r--share/bash-completion/container-tools215
-rw-r--r--share/doc/examples/cairon-backports.cfg4
-rw-r--r--share/man/container-limit.1.txt6
-rw-r--r--share/man/container-list.1.txt6
-rw-r--r--share/man/container-tools.7.txt7
-rwxr-xr-xshare/scripts/debconf4
-rwxr-xr-xshare/scripts/debconf.d/0003-debconf4
-rw-r--r--share/systemd/container-auto.service1
-rw-r--r--share/systemd/container@.service1
14 files changed, 344 insertions, 32 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 4ff1721..36d9293 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,11 @@
+2016-06-15 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20160615.
+ * Adding support for shared storage setups.
+ * Adding bash-completion, thanks to Andreas Kreuzer.
+ * Improved looks of container list command.
+ * Correcting and updating existing documentation.
+
2016-06-01 Daniel Baumann <daniel.baumann@open-infrastructure.net>
* Releasing version 20160601.
diff --git a/Makefile b/Makefile
index 0deb81e..d22c32c 100644
--- a/Makefile
+++ b/Makefile
@@ -53,8 +53,8 @@ build: share/man/*.txt
$(MAKE) -C share/man
install: build
- mkdir -p $(DESTDIR)/etc/container-tools/config
- mkdir -p $(DESTDIR)/etc/container-tools/debconf
+ mkdir -p $(DESTDIR)/etc/${SOFTWARE}/config
+ mkdir -p $(DESTDIR)/etc/${SOFTWARE}/debconf
mkdir -p $(DESTDIR)/usr/bin
cp -r bin/* $(DESTDIR)/usr/bin
@@ -65,6 +65,9 @@ install: build
mkdir -p $(DESTDIR)/usr/share/$(SOFTWARE)
cp -r VERSION.txt share/config share/scripts ${DESTDIR}/usr/share/$(SOFTWARE)
+ mkdir -p $(DESTDIR)/usr/share/bash-completion/completions
+ cp -r share/bash-completion/* $(DESTDIR)/usr/share/bash-completion/completions
+
mkdir -p $(DESTDIR)/usr/share/doc/$(SOFTWARE)
cp -r share/doc $(DESTDIR)/usr/share/doc/$(SOFTWARE)
@@ -118,6 +121,11 @@ uninstall:
rm -f $(DESTDIR)/usr/bin/cntsh
rm -f $(DESTDIR)/usr/share/man/man1/cntsh.1
+ for FILE in share/bash-completion/*; \
+ do \
+ rm -f $(DESTDIR)/usr/share/bash-completion/completions/$$(basename $${FILE}); \
+ done
+
rm -rf $(DESTDIR)/usr/share/doc/$(SOFTWARE)
rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/usr/share/doc || true
@@ -133,8 +141,12 @@ uninstall:
done
rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/usr/bin || true
- rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/container-tools/config || true
- rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/container-tools/debconf || true
+ rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/${SOFTWARE}/config || true
+ rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/${SOFTWARE}/debconf || true
+ rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/${SOFTWARE} || true
+ rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc || true
+
+ rmdir --ignore-fail-on-non-empty --parents $(DESTDIR) || true
clean:
$(MAKE) -C share/man clean
diff --git a/README.txt b/README.txt
index efc225d..f71f560 100644
--- a/README.txt
+++ b/README.txt
@@ -18,7 +18,10 @@ systemd-nspawn.
2. Download
-----------
- * https://github.com/open-infrastructure/container-tools
+ * Upstream Releases: https://files.open-infrastructure.net/software/container-tools/upstream
+ * Upstream Sources: https://sources.open-infrastructure.net/software/container-tools
+ * Debian Releases: https://files.open-infrastructure.net/software/container-tools/debian
+ * Debian Sources: https://sources.progress-linux.org/users/daniel/debian/packages/open-infrastructure-container-tools
3. Installation
@@ -27,7 +30,7 @@ systemd-nspawn.
3.1 Source
----------
- 1. sudo apt instal asciidoc git docbook-xml docbook-xsl libxml2-utils make xsltproc
+ 1. sudo apt install asciidoc git docbook-xml docbook-xsl libxml2-utils make xsltproc
2. git clone https://github.com/open-infrastructure/container-tools
3. cd container-tools && sudo make install
diff --git a/VERSION.txt b/VERSION.txt
index 64fa36a..8cee680 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-20160601
+20160615
diff --git a/lib/container/list b/lib/container/list
index 8b55e09..7f64a18 100755
--- a/lib/container/list
+++ b/lib/container/list
@@ -20,12 +20,13 @@ set -e
COMMAND="$(basename ${0})"
+CONFIG="/etc/container-tools/config"
MACHINES="/var/lib/machines"
Parameters ()
{
- LONG_OPTIONS="all,format:,started,stopped"
- OPTIONS="a,f:,s,t"
+ LONG_OPTIONS="all,format:,host:,other,started,stopped"
+ OPTIONS="a,f:,h:,o,s,t"
PARAMETERS="$(getopt --longoptions ${LONG_OPTIONS} --name=${COMMAND} --options ${OPTIONS} --shell sh -- ${@})"
@@ -50,6 +51,16 @@ Parameters ()
shift 2
;;
+ -h|--host)
+ HOST="${2}"
+ shift 2
+ ;;
+
+ -o|--other)
+ LIST="other"
+ shift 1
+ ;;
+
-s|--started)
LIST="started"
shift 1
@@ -83,6 +94,7 @@ Parameters "${@}"
LIST="${LIST:-all}"
FORMAT="${FORMAT:-full}"
+HOST="${HOST:-$(hostname -f)}"
# Run
case "${FORMAT}" in
@@ -91,10 +103,11 @@ case "${FORMAT}" in
GREEN="$(tput setaf 2)$(tput bold)"
YELLOW="$(tput setaf 3)$(tput bold)"
BLUE="$(tput setaf 4)$(tput bold)"
+ WHITE="$(tput setaf 7)$(tput bold)"
NORMAL="$(tput sgr0)"
cat << EOF
-Container IPv4 Address(es) Status
+ Container IPv4 Address(es)
--------------------------------------------------------------------------------
EOF
@@ -104,7 +117,7 @@ EOF
;;
esac
-CONTAINERS="$(cd "${MACHINES}" && find -maxdepth 1 -type d -and -not -name 'lost+found' -and -not -name '.snap' -and -not -name '.snapshot' -printf '%P\n' | sort)"
+CONTAINERS="$(cd "${MACHINES}" 2>/dev/null && find -maxdepth 1 -type d -and -not -name '.container-tools' -and -not -name 'container-tools' -and -not -name 'lost+found' -and -not -name '.snap' -and -not -name '.snapshot' -printf '%P\n' | sort)"
for CONTAINER in ${CONTAINERS}
do
@@ -116,21 +129,41 @@ do
STATE="$(machinectl show ${CONTAINER} 2>&1 | awk -F= '/^State=/ { print $2 }')"
+ if [ -e "${CONFIG}/${CONTAINER}.conf" ]
+ then
+ AUTO="$(awk -F= '/^cnt.auto=/ { print $2 }' ${CONFIG}/${CONTAINER}.conf)"
+ AUTO="${AUTO:-false}"
+
+ case "${AUTO}" in
+ ${HOST}|true)
+ ;;
+
+ *)
+ STATE="other"
+ ;;
+ esac
+ else
+ STATE="other"
+ fi
+
if [ -e "${MACHINES}/${CONTAINER}/etc/network/interfaces" ]
then
ADDRESSES="$(awk '/address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/network/interfaces)"
- else
- ADDRESSES="n/a"
fi
+ ADDRESSES="${ADDRESSES:-n/a}"
+
case "${STATE}" in
running)
- STATUS="${GREEN}started${NORMAL}"
+ STATUS="${GREEN}✔${NORMAL}"
+ ;;
+ other)
+ STATUS="${WHITE}○${NORMAL}"
;;
*)
- STATUS="${RED}stopped${NORMAL}"
+ STATUS="${RED}✘${NORMAL}"
;;
esac
@@ -149,11 +182,11 @@ do
case "${FIRST_LINE}" in
true)
FIRST_LINE="false"
- printf "%-69s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" " ${STATUS}"
+ printf "%-80s %-29s\n" "${STATUS} ${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}"
;;
*)
- printf "%-54s %-29s\n" "" "${ADDRESS}"
+ printf "%-80s %-29s\n" "" "${ADDRESS}"
;;
esac
done
@@ -161,6 +194,36 @@ do
esac
;;
+ other)
+ case "${STATE}" in
+ other)
+ case "${FORMAT}" in
+ short)
+ printf "${CONTAINER}\n"
+ ;;
+
+ full)
+ FIRST_LINE="true"
+
+ for ADDRESS in ${ADDRESSES}
+ do
+ case "${FIRST_LINE}" in
+ true)
+ FIRST_LINE="false"
+ printf "%-80s %-29s\n" "${STATUS} ${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}"
+ ;;
+
+ *)
+ printf "%-80s %-29s\n" "" "${ADDRESS}"
+ ;;
+ esac
+ done
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
started)
case "${STATE}" in
running)
@@ -177,11 +240,11 @@ do
case "${FIRST_LINE}" in
true)
FIRST_LINE="false"
- printf "%-69s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" " ${STATUS}"
+ printf "%-80s %-29s\n" "${STATUS} ${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}"
;;
*)
- printf "%-54s %-29s\n" "" "${ADDRESS}"
+ printf "%-80s %-29s\n" "" "${ADDRESS}"
;;
esac
done
@@ -210,11 +273,11 @@ do
case "${FIRST_LINE}" in
true)
FIRST_LINE="false"
- printf "%-69s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" " ${STATUS}"
+ printf "%-80s %-29s\n" "${STATUS} ${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}"
;;
*)
- printf "%-54s %-29s\n" "" "${ADDRESS}"
+ printf "%-80s %-29s\n" "" "${ADDRESS}"
;;
esac
done
diff --git a/share/bash-completion/container-tools b/share/bash-completion/container-tools
new file mode 100644
index 0000000..219fd2f
--- /dev/null
+++ b/share/bash-completion/container-tools
@@ -0,0 +1,215 @@
+# Open Infrastructure: container-tools
+# Copyright (C) 2016 Andreas Kreuzer <andreas.kreuzer@open-infrastructure.net>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+_container()
+{
+ local cur prev cmd opts
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+ if [ ${COMP_CWORD} -gt 0 ]
+ then
+ cmd="${COMP_WORDS[1]}"
+ fi
+
+ if [ "${prev}" = "--" ]
+ then
+ compopt -o bashdefault
+ COMPREPLY=( $(compgen -c -- $cur) )
+ return 0
+ fi
+
+ case "${cmd}" in
+ console)
+ case "${cur}" in
+ -*)
+ opts="-n --name"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ case "${prev}" in
+ -n|--name)
+ opts=$(container list -s -f short)
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ create)
+ case "${cur}" in
+ -*)
+ opts="-n --name -c --capability -d --drop-capability -s --script -b --bind"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ case "${prev}" in
+ -n|--name)
+ opts=$(cd /srv/container/container-tools/debconf 2>/dev/null && ls *.cfg 2>/dev/null | sed -e 's/.cfg$//g')
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ -s|--script)
+ opts="debootstrap debconf default"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ limit)
+ case "${cur}" in
+ -*)
+ opts="-n --name --blockio-device-weight --blockio-read-bandwith -b --blockio-weight --blockio-write-bandwith -c --cpu-quota --cpu-shares -m --memory-limit -t --tasks-max"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ case "${prev}" in
+ -n|--name)
+ opts=$(container list -a -f short)
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ list)
+ case "${cur}" in
+ -*)
+ opts="-a --all -f --format -h --host -s --started -t --stopped"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ case "${prev}" in
+ -h|--host)
+ opts="true false $(hostname -f)"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ remove)
+ case "${cur}" in
+ -*)
+ opts="-n --name -f --force"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ case "${prev}" in
+ -n|--name)
+ opts=$(container list -a -f short)
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ restart)
+ case "${cur}" in
+ -*)
+ opts="-n --name"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ case "${prev}" in
+ -n|--name)
+ opts=$(container list -s -f short)
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ start)
+ case "${cur}" in
+ -*)
+ opts="-n --name"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ case "${prev}" in
+ -n|--name)
+ opts=$(container list -t -f short)
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ stop)
+ case "${cur}" in
+ -*)
+ opts="-n --name -f --force"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ case "${prev}" in
+ -n|--name)
+ opts=$(container list -s -f short)
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ *)
+ local commands=$(ls /usr/lib/container-tools/container/)
+ COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+
+complete -F _container container cnt
diff --git a/share/doc/examples/cairon-backports.cfg b/share/doc/examples/cairon-backports.cfg
index 713d902..eed9fd6 100644
--- a/share/doc/examples/cairon-backports.cfg
+++ b/share/doc/examples/cairon-backports.cfg
@@ -14,8 +14,8 @@ container-tools cnt-debconf/architecture select auto
container-tools cnt-debconf/archives multiselect cairon-security, cairon-updates, cairon-extras, cairon-backports, cairon-backports-extras
#container-tools cnt-debconf/parent-archives multiselect
-container-tools cnt-debconf/mirror string http://cdn.archive.progress-linux.org/packages
-container-tools cnt-debconf/mirror-security string http://cdn.archive.progress-linux.org/packages
+container-tools cnt-debconf/mirror string https://cdn.archive.progress-linux.org/packages
+container-tools cnt-debconf/mirror-security string https://cdn.archive.progress-linux.org/packages
container-tools cnt-debconf/parent-mirror string http://ftp.debian.org/debian
container-tools cnt-debconf/parent-mirror-security string http://security.debian.org
diff --git a/share/man/container-limit.1.txt b/share/man/container-limit.1.txt
index d7a060f..8538fe3 100644
--- a/share/man/container-limit.1.txt
+++ b/share/man/container-limit.1.txt
@@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-CONTAINER-STOP(1)
-=================
+CONTAINER-LIMIT(1)
+==================
:doctype: manpage
:man manual: Open Infrastructure
:man source: container-tools
@@ -24,7 +24,7 @@ CONTAINER-STOP(1)
NAME
----
-container-stop - Limit ressources of a container
+container-limit - Limit ressources of a container
SYNOPSIS
diff --git a/share/man/container-list.1.txt b/share/man/container-list.1.txt
index 4d8bc72..5474da4 100644
--- a/share/man/container-list.1.txt
+++ b/share/man/container-list.1.txt
@@ -47,6 +47,12 @@ The following container options are available:
*-f, --format='FORMAT'*::
Use format to list container. Currently available formats are 'short' or 'full' (default).
+*-h, --host='HOSTNAME'*::
+ List only container that are enabled for automatic start on the specified hostname. Defaults to list containers of the local system only. Using 'all' shows all container regardless of any automatic start configuration.
+
+*-h, --other*::
+ List only container that are not enable for automatic start on the current system.
+
*-s, --started*::
List only started container.
diff --git a/share/man/container-tools.7.txt b/share/man/container-tools.7.txt
index 0e3e44d..95d09c8 100644
--- a/share/man/container-tools.7.txt
+++ b/share/man/container-tools.7.txt
@@ -38,7 +38,10 @@ container-tools provides the system integration for managing containers using sy
DOWNLOAD
--------
- * https://github.com/open-infrastructure/container-tools
+ * Upstream Releases: https://files.open-infrastructure.net/software/container-tools/upstream
+ * Upstream Sources: https://sources.open-infrastructure.net/software/container-tools
+ * Debian Releases: https://files.open-infrastructure.net/software/container-tools/debian
+ * Debian Sources: https://sources.progress-linux.org/users/daniel/debian/packages/open-infrastructure-container-tools
INSTALLATION
@@ -47,7 +50,7 @@ INSTALLATION
SOURCE
~~~~~~
- 1. sudo apt instal asciidoc git docbook-xml docbook-xsl libxml2-utils make xsltproc
+ 1. sudo apt install asciidoc git docbook-xml docbook-xsl libxml2-utils make xsltproc
2. git clone https://github.com/open-infrastructure/container-tools
3. cd container-tools && sudo make install
diff --git a/share/scripts/debconf b/share/scripts/debconf
index 4f29238..c08444a 100755
--- a/share/scripts/debconf
+++ b/share/scripts/debconf
@@ -227,11 +227,11 @@ Debootstrap ()
# FIXME: trim down, debootstrap variants?
case "${MODE}" in
debian)
- INCLUDE="--include=ifupdown,locales,libui-dialog-perl,dialog,isc-dhcp-client,netbase,net-tools,iproute,wget,dbus"
+ INCLUDE="--include=ifupdown,locales,libui-dialog-perl,dialog,isc-dhcp-client,netbase,net-tools,iproute,wget,dbus,systemd-sysv"
;;
progress-linux)
- INCLUDE="--include=apt-utils,ifupdown,locales-all,libui-dialog-perl,dialog,isc-dhcp-client,netbase,net-tools,iproute,openssh-server,wget,dbus,libpam-systemd"
+ INCLUDE="--include=apt-transport-https,ca-certificates,apt-utils,ifupdown,locales-all,libui-dialog-perl,dialog,isc-dhcp-client,netbase,net-tools,iproute,openssh-server,wget,dbus,libpam-systemd,systemd-sysv"
;;
esac
diff --git a/share/scripts/debconf.d/0003-debconf b/share/scripts/debconf.d/0003-debconf
index baf6879..05c9eb5 100755
--- a/share/scripts/debconf.d/0003-debconf
+++ b/share/scripts/debconf.d/0003-debconf
@@ -303,7 +303,7 @@ Mirror ()
;;
progress-linux)
- db_set cnt-debconf/mirror http://cdn.archive.progress-linux.org/packages
+ db_set cnt-debconf/mirror https://cdn.archive.progress-linux.org/packages
db_fset cnt-debconf/mirror seen false
;;
esac
@@ -323,7 +323,7 @@ Mirror ()
;;
progress-linux)
- MIRROR="http://cdn.archive.progress-linux.org/packages"
+ MIRROR="https://cdn.archive.progress-linux.org/packages"
;;
esac
fi
diff --git a/share/systemd/container-auto.service b/share/systemd/container-auto.service
index e9addd7..b3384df 100644
--- a/share/systemd/container-auto.service
+++ b/share/systemd/container-auto.service
@@ -1,5 +1,6 @@
[Unit]
Description=container-tools automatic start
+Documentation=man:container-auto
After=network.target
[Service]
diff --git a/share/systemd/container@.service b/share/systemd/container@.service
index 0bd6766..539139e 100644
--- a/share/systemd/container@.service
+++ b/share/systemd/container@.service
@@ -1,5 +1,6 @@
[Unit]
Description="Container: %i"
+Documentation=man:container-tools
[Service]
Type=simple