diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2017-11-01 08:17:07 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2017-11-01 08:17:36 +0000 |
commit | a62718068b63b230ad1d038e124b15d3b7d1e22f (patch) | |
tree | a59e9dbb6a25913f82687152ec7a362b3cba73db /share | |
parent | Releasing debian version 20171013-1. (diff) | |
download | open-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>
Diffstat (limited to 'share')
-rw-r--r-- | share/bash-completion/container | 6 | ||||
-rwxr-xr-x | share/hooks/pre-create.git-pull.sh | 40 | ||||
-rw-r--r-- | share/man/container-list.1.txt | 3 | ||||
-rwxr-xr-x | share/scripts/debconf | 25 | ||||
-rwxr-xr-x | share/scripts/debconf.d/0001-preseed-file | 4 | ||||
-rwxr-xr-x | share/scripts/debconf.d/0002-preseed-debconf | 25 |
6 files changed, 95 insertions, 8 deletions
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" |