summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2017-11-01 08:17:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2017-11-01 08:17:36 +0000
commita62718068b63b230ad1d038e124b15d3b7d1e22f (patch)
treea59e9dbb6a25913f82687152ec7a362b3cba73db
parentReleasing debian version 20171013-1. (diff)
downloadopen-infrastructure-compute-tools-a62718068b63b230ad1d038e124b15d3b7d1e22f.tar.xz
open-infrastructure-compute-tools-a62718068b63b230ad1d038e124b15d3b7d1e22f.zip
Merging upstream version 20171101.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--CHANGELOG.txt14
-rw-r--r--Makefile3
-rw-r--r--VERSION.txt2
-rwxr-xr-xlib/container/list4
-rw-r--r--share/bash-completion/container6
-rwxr-xr-xshare/hooks/pre-create.git-pull.sh40
-rw-r--r--share/man/container-list.1.txt3
-rwxr-xr-xshare/scripts/debconf25
-rwxr-xr-xshare/scripts/debconf.d/0001-preseed-file4
-rwxr-xr-xshare/scripts/debconf.d/0002-preseed-debconf25
10 files changed, 113 insertions, 13 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index cc4bada..f5d5e73 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,17 @@
+2017-11-01 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20171101.
+
+ [ Daniel Baumann ]
+ * Removing fallback TERM in container list, not needed anymore.
+ * Adding con shortcut for container console command.
+ * Adding sh shortcut for shell format in container list command.
+ * Adding ver shortcut for container version command in bash-completion.
+ * Adding container create pre-hook that can be used to automatically git pull /etc/container-tools/debconf.
+ * Avoiding to display .cfg extension for preseed files in container debconf create script.
+ * Supporting using IP address from DNS lookup of the container name in preseed files for container debconf create script.
+ * Supporting using IP address parts of the container name in preseed files for container debconf create script.
+
2017-10-13 Daniel Baumann <daniel.baumann@open-infrastructure.net>
* Releasing version 20171013.
diff --git a/Makefile b/Makefile
index ab17e80..6ee40cb 100644
--- a/Makefile
+++ b/Makefile
@@ -66,7 +66,7 @@ install: build
cp -r lib/* $(DESTDIR)/usr/lib/$(SOFTWARE)
mkdir -p $(DESTDIR)/usr/share/$(SOFTWARE)
- cp -r VERSION.txt share/config share/scripts ${DESTDIR}/usr/share/$(SOFTWARE)
+ cp -r VERSION.txt share/config share/hooks 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
@@ -106,6 +106,7 @@ install: build
ln -sf debconf.d ${DESTDIR}/usr/share/$(SOFTWARE)/scripts/progress-linux.d
ln -sf container-create-debconf.1 $(DESTDIR)/usr/share/man/man1/container-create-progress-linux.1
+ ln -sf console $(DESTDIR)/usr/lib/$(SOFTWARE)/container/con
ln -sf list $(DESTDIR)/usr/lib/$(SOFTWARE)/container/ls
ln -sf move $(DESTDIR)/usr/lib/$(SOFTWARE)/container/mv
ln -sf remove $(DESTDIR)/usr/lib/$(SOFTWARE)/container/rm
diff --git a/VERSION.txt b/VERSION.txt
index 9635449..0c5aadd 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-20171013
+20171101
diff --git a/lib/container/list b/lib/container/list
index 80e4e35..3e1f981 100755
--- a/lib/container/list
+++ b/lib/container/list
@@ -26,8 +26,6 @@ MACHINES="/var/lib/machines"
VERSION="$(container version)"
-TERM="${TERM:-linux}"
-
Parameters ()
{
GETOPT_LONGOPTIONS="all,csv-separator:,format:,host:,nwdiag-color:,nwdiag-label:,other,started,stopped,"
@@ -171,7 +169,7 @@ EOF
echo " ${CONTAINER} [address = \"${ADDRESS}\", color = \"${COLOR}\", shape = \"flowchart.terminator\", width = \"${WIDTH}\"];"
;;
- shell)
+ shell|sh)
echo "${CONTAINER}"
;;
diff --git a/share/bash-completion/container b/share/bash-completion/container
index ffa042d..e2fa4d3 100644
--- a/share/bash-completion/container
+++ b/share/bash-completion/container
@@ -43,7 +43,7 @@ _container()
return 0
;;
- console)
+ console|con)
case "${prev}" in
-n|--name)
opts=$(container list -s -f shell)
@@ -128,7 +128,7 @@ _container()
;;
-f|--format)
- opts="cli csv json nwdiag shell yaml xml"
+ opts="cli csv json nwdiag shell sh yaml xml"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
@@ -243,7 +243,7 @@ _container()
return 0
;;
- version)
+ version|ver)
return 0
;;
diff --git a/share/hooks/pre-create.git-pull.sh b/share/hooks/pre-create.git-pull.sh
new file mode 100755
index 0000000..cb1d09c
--- /dev/null
+++ b/share/hooks/pre-create.git-pull.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# container-tools - Manage systemd-nspawn containers
+# Copyright (C) 2014-2017 Daniel Baumann <daniel.baumann@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/>.
+
+set -e
+
+if [ -e /etc/container-tools/debconf/.git ] && [ -e /usr/bin/git ]
+then
+ echo "Updating /etc/container-tools/debconf..."
+
+ if [ -e /etc/default/container-tools ]
+ then
+ . /etc/default/container-tools
+ fi
+
+ DEBCONF_ID="${DEBCONF_ID:-HEAD}"
+
+ cd /etc/container-tools/debconf
+
+ git clean -dfx
+ git checkout -f ${DEBCONF_ID}
+ git pull --rebase
+ echo
+
+ cd "${OLDPWD}"
+fi
diff --git a/share/man/container-list.1.txt b/share/man/container-list.1.txt
index abb4c8f..f629e33 100644
--- a/share/man/container-list.1.txt
+++ b/share/man/container-list.1.txt
@@ -50,7 +50,7 @@ The following container options are available, defaults to *--started --stopped*
Specify custom CSV separator, defaults to ','.
*-f, --format='FORMAT'*::
- Use format to list container. Currently available formats are 'cli' (default), 'csv', 'json', 'nwdiag', 'shell', 'yaml', or 'xml'.
+ Use format to list container. Currently available formats are 'cli' (default), 'csv', 'json', 'nwdiag', 'shell', 'sh', 'yaml', or 'xml'.
*-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.
@@ -92,6 +92,7 @@ EXAMPLES
*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:*::
sudo container list -f yaml
diff --git a/share/scripts/debconf b/share/scripts/debconf
index 19e6e65..3bc3b43 100755
--- a/share/scripts/debconf
+++ b/share/scripts/debconf
@@ -618,7 +618,30 @@ EOF
then
for FILE in ${PRESEED_FILE}
do
- sed -e "s|@NAME@|${NAME}|g" "${FILE}" >> "${DIRECTORY}/preseed.cfg"
+ if [ -e /usr/bin/kdig ]
+ then
+ DIG="/usr/bin/kdig"
+ elif [ -e /usr/bin/dig ]
+ then
+ DIG="/usr/bin/dig"
+ fi
+
+ if [ -n "${DIG}" ]
+ then
+ IPV4_ADDRESS1="$(${DIG} +short ${NAME} | tail -n1)"
+ IPV4_ADDRESS1_PART1="$(echo ${IPV4_ADDRESS1} | cut -d. -f1)"
+ IPV4_ADDRESS1_PART2="$(echo ${IPV4_ADDRESS1} | cut -d. -f2)"
+ IPV4_ADDRESS1_PART3="$(echo ${IPV4_ADDRESS1} | cut -d. -f3)"
+ IPV4_ADDRESS1_PART4="$(echo ${IPV4_ADDRESS1} | cut -d. -f4)"
+ fi
+
+ sed -e "s|@NAME@|${NAME}|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" \
+ -e "s|@IPV4_ADDRESS1_PART3@|${IPV4_ADDRESS1_PART3}|g" \
+ -e "s|@IPV4_ADDRESS1_PART4@|${IPV4_ADDRESS1_PART4}|g" \
+ "${FILE}" >> "${DIRECTORY}/preseed.cfg"
done
Chroot "${DIRECTORY}" "debconf-set-selections preseed.cfg"
diff --git a/share/scripts/debconf.d/0001-preseed-file b/share/scripts/debconf.d/0001-preseed-file
index 663fdc8..d3cc49d 100755
--- a/share/scripts/debconf.d/0001-preseed-file
+++ b/share/scripts/debconf.d/0001-preseed-file
@@ -36,7 +36,7 @@ then
# showing debconf selection dialog for global preseed file.
FILES="$(cd ${CONFIG} && find . -type f -name '*.cfg' -printf '%P\n' | sort)"
- PRESEED_FILES="$(for FILE in ${FILES}; do echo -n "${FILE}, "; done | sed -e 's|, $||')"
+ PRESEED_FILES="$(for FILE in ${FILES}; do echo -n "$(basename ${FILE} .cfg), "; done | sed -e 's|, $||')"
if [ -n "${PRESEED_FILES}" ]
then
@@ -55,7 +55,7 @@ then
*)
# user specified preseed file through debconf select
- db_set cnt-debconf/preseed-file "${CONFIG}/${PRESEED_FILE}"
+ db_set cnt-debconf/preseed-file "${CONFIG}/${PRESEED_FILE}.cfg"
db_fset cnt-debconf/preseed-file seen true
;;
esac
diff --git a/share/scripts/debconf.d/0002-preseed-debconf b/share/scripts/debconf.d/0002-preseed-debconf
index 48fa6a1..d46121c 100755
--- a/share/scripts/debconf.d/0002-preseed-debconf
+++ b/share/scripts/debconf.d/0002-preseed-debconf
@@ -72,7 +72,30 @@ done
for DEBCONF_PRESEED_FILE in ${DEBCONF_PRESEED_FILES}
do
- sed -e "s|@NAME@|${NAME}|g" "${DEBCONF_PRESEED_FILE}" > "${DIRECTORY}/preseed.cfg"
+ if [ -e /usr/bin/kdig ]
+ then
+ DIG="/usr/bin/kdig"
+ elif [ -e /usr/bin/dig ]
+ then
+ DIG="/usr/bin/dig"
+ fi
+
+ if [ -n "${DIG}" ]
+ then
+ IPV4_ADDRESS1="$(${DIG} +short ${NAME} | tail -n1)"
+ IPV4_ADDRESS1_PART1="$(echo ${IPV4_ADDRESS1} | cut -d. -f1)"
+ IPV4_ADDRESS1_PART2="$(echo ${IPV4_ADDRESS1} | cut -d. -f2)"
+ IPV4_ADDRESS1_PART3="$(echo ${IPV4_ADDRESS1} | cut -d. -f3)"
+ IPV4_ADDRESS1_PART4="$(echo ${IPV4_ADDRESS1} | cut -d. -f4)"
+ fi
+
+ sed -e "s|@NAME@|${NAME}|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" \
+ -e "s|@IPV4_ADDRESS1_PART3@|${IPV4_ADDRESS1_PART3}|g" \
+ -e "s|@IPV4_ADDRESS1_PART4@|${IPV4_ADDRESS1_PART4}|g" \
+ "${DEBCONF_PRESEED_FILE}" > "${DIRECTORY}/preseed.cfg"
# Apply user specified preseed files
debconf-set-selections "${DIRECTORY}/preseed.cfg"