diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2019-02-17 10:52:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2019-02-23 15:22:19 +0000 |
commit | 0f0239db45cbd40ff79f301bbade2f2dcb005931 (patch) | |
tree | d66fc84e20c05d71a083b4020ab549a7fd277d22 /lib/container | |
parent | Removing manpage symlinks in uninstall target too. (diff) | |
download | compute-tools-0f0239db45cbd40ff79f301bbade2f2dcb005931.tar.xz compute-tools-0f0239db45cbd40ff79f301bbade2f2dcb005931.zip |
Renaming container-tools to compute-tools.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rwxr-xr-x | lib/container/auto | 9 | ||||
-rwxr-xr-x | lib/container/console | 7 | ||||
-rwxr-xr-x | lib/container/create | 18 | ||||
-rwxr-xr-x | lib/container/enter | 7 | ||||
-rwxr-xr-x | lib/container/key | 7 | ||||
-rwxr-xr-x | lib/container/limit | 7 | ||||
-rwxr-xr-x | lib/container/list | 23 | ||||
-rwxr-xr-x | lib/container/log | 7 | ||||
-rwxr-xr-x | lib/container/move | 11 | ||||
-rwxr-xr-x | lib/container/remove | 15 | ||||
-rwxr-xr-x | lib/container/restart | 11 | ||||
-rwxr-xr-x | lib/container/start | 15 | ||||
-rwxr-xr-x | lib/container/status | 11 | ||||
-rwxr-xr-x | lib/container/stop | 13 | ||||
-rwxr-xr-x | lib/container/top | 7 | ||||
-rwxr-xr-x | lib/container/version | 7 |
16 files changed, 96 insertions, 79 deletions
diff --git a/lib/container/auto b/lib/container/auto index 6c0e0cc..d6a76b7 100755 --- a/lib/container/auto +++ b/lib/container/auto @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" Parameters () { @@ -73,7 +74,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -f|--force -s|--start -t|--stop" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -f|--force -s|--start -t|--stop" >&2 exit 1 } diff --git a/lib/container/console b/lib/container/console index 0b7ec7a..0b49058 100755 --- a/lib/container/console +++ b/lib/container/console @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,9 +19,11 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -HOOKS="/etc/container-tools/hooks" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -63,7 +64,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME" >&2 exit 1 } diff --git a/lib/container/create b/lib/container/create index ac977d6..469ba4d 100755 --- a/lib/container/create +++ b/lib/container/create @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,12 +19,15 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" -SCRIPTS="/usr/share/container-tools/scripts" +SCRIPTS="/usr/share/${PROJECT}/${PROGRAM}/scripts" +CONFIG_TEMPLATE="/usr/share/${PROJECT}/${PROGRAM}/config/container.conf.in" Parameters () { @@ -110,7 +112,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME [--cnt.container-server=true|false|FQDN] [--cnt.overlay=DIRECTORY_LOWER:DIRECTORY_UPPER:DIRECTORY_WORK:DIRECTORY_MERGED] [-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.container-server=true|false|FQDN] [--cnt.overlay=DIRECTORY_LOWER:DIRECTORY_UPPER:DIRECTORY_WORK:DIRECTORY_MERGED] [-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 exit 1 } @@ -141,8 +143,8 @@ then TARGET="$(basename $(readlink ${SCRIPTS}/default))" case "${TARGET}" in - container-tools_script) - TARGET="$(basename $(readlink /etc/alternatives/container-tools_script))" + container_script) + TARGET="$(basename $(readlink /etc/alternatives/container_script))" ;; esac @@ -251,7 +253,7 @@ sed -e "s|@CNT_AUTO@|${CNT_AUTO}|g" \ -e "s|@NETWORK_VETH_EXTRA@|${NETWORK_VETH_EXTRA}|g" \ -e "s|@PRIVATE_USERS@|no|g" \ -e "s|@REGISTER@|yes|g" \ -/usr/share/container-tools/config/container.conf.in > "${CONFIG}/${NAME}.conf" +"${CONFIG_TEMPLATE}" > "${CONFIG}/${NAME}.conf" # Run "${SCRIPTS}/${SCRIPT}" $(echo "${@}" | sed -e 's| -- | |') diff --git a/lib/container/enter b/lib/container/enter index 5c0aabc..9c9ebfa 100755 --- a/lib/container/enter +++ b/lib/container/enter @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,9 +19,11 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -HOOKS="/etc/container-tools/hooks" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -63,7 +64,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME" >&2 exit 1 } diff --git a/lib/container/key b/lib/container/key index 46c6130..1b59555 100755 --- a/lib/container/key +++ b/lib/container/key @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,9 +19,11 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -KEYS="/etc/container-tools/keys" +KEYS="/etc/${PROJECT}/${PROGRAM}/keys" Parameters () { @@ -74,7 +75,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} [-a|--add KEY] [-l|--list] [-r|--remove KEY]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} [-a|--add KEY] [-l|--list] [-r|--remove KEY]" >&2 exit 1 } diff --git a/lib/container/limit b/lib/container/limit index 641ee2f..b1ec170 100755 --- a/lib/container/limit +++ b/lib/container/limit @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,9 +19,11 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -HOOKS="/etc/container-tools/hooks" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -103,7 +104,7 @@ Parameters () Usage () { - echo "Usage: container ${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 "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 exit 1 } diff --git a/lib/container/list b/lib/container/list index 8e6f5bc..57d0d2d 100755 --- a/lib/container/list +++ b/lib/container/list @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,13 +19,15 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" -VERSION="$(container version)" +VERSION="$(${PROGRAM} version)" Parameters () { @@ -106,7 +107,7 @@ Parameters () Usage () { - echo "Usage: container ${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 "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 exit 1 } @@ -233,7 +234,7 @@ EOF csv) cat << EOF -# container-tools version ${VERSION} +# compute-tools ${VERSION} Host${CSV_SEPARATOR}Container${CSV_SEPARATOR}Status${CSV_SEPARATOR}IPv4-Address EOF @@ -243,7 +244,7 @@ EOF cat << EOF { - "container-tools": { + "compute-tools": { "version": "${VERSION}", }, "host": { @@ -258,7 +259,7 @@ EOF NETWORK="$(echo ${HOST} | sed -e 's|\.|_|g')" cat << EOF -# container-tools ${VERSION} +# compute-tools ${VERSION} nwdiag { external_connector = none; network ${NETWORK} { @@ -294,7 +295,7 @@ EOF cat << EOF --- -container_tools: +compute_tools: version: ${VERSION} host: @@ -308,9 +309,9 @@ EOF xml) cat << EOF -<container-tools> +<compute-tools> <version>${VERSION}</version> -</container-tools> +</compute-tools> <host> <name>${HOST}</name> </host> diff --git a/lib/container/log b/lib/container/log index 41ac087..200177c 100755 --- a/lib/container/log +++ b/lib/container/log @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,9 +19,11 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -LOG="/var/log/container-tools/container.log" +LOG="/var/log/${PROJECT}/${PROGRAM}.log" Parameters () { @@ -72,7 +73,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} [-n|--name NAME] [-d|--date DATE|today|today-N|yesterday] [-u|--user USER]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} [-n|--name NAME] [-d|--date DATE|today|today-N|yesterday] [-u|--user USER]" >&2 exit 1 } diff --git a/lib/container/move b/lib/container/move index 40542de..278f972 100755 --- a/lib/container/move +++ b/lib/container/move @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -74,7 +75,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} [-f|--force] -n|--new NAME -o|--old NAME" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} [-f|--force] -n|--new NAME -o|--old NAME" >&2 exit 1 } @@ -111,7 +112,7 @@ case "${FORCE}" in ;; *) - if container list --other | grep -qs "^${OLD}$" + if ${PROGRAM} list --other | grep -qs "^${OLD}$" then echo -n "'${OLD}': rename container to '${NEW}' [y|N]? " read FORCE diff --git a/lib/container/remove b/lib/container/remove index 7b59ed1..13a9bd8 100755 --- a/lib/container/remove +++ b/lib/container/remove @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -87,7 +88,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME [--allow-stop] [-f|--force] [-v|--verbose]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [--allow-stop] [-f|--force] [-v|--verbose]" >&2 exit 1 } @@ -121,7 +122,7 @@ fi case "${NAME}" in ALL) - NAMES="$(container list --format shell --stopped)" + NAMES="$(${PROGRAM} list --format shell --stopped)" for NAME in ${NAMES} do @@ -131,7 +132,7 @@ case "${NAME}" in ;; esac - container remove --name ${NAME} ${OPTIONS_ALL} || true + ${PROGRAM} remove --name ${NAME} ${OPTIONS_ALL} || true done exit 0 @@ -151,7 +152,7 @@ case "${STATE}" in case "${ALLOW_STOP}" in true) echo "'${NAME}': container is started, stopping it now" >&2 - container stop -n ${NAME} + ${PROGRAM} stop -n ${NAME} ;; *) diff --git a/lib/container/restart b/lib/container/restart index 3ed9968..5b78dda 100755 --- a/lib/container/restart +++ b/lib/container/restart @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,9 +19,11 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -HOOKS="/etc/container-tools/hooks" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -65,7 +66,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME" >&2 exit 1 } @@ -78,7 +79,7 @@ fi case "${NAME}" in ALL) - NAMES="$(container list --format shell --started)" + NAMES="$(${PROGRAM} list --format shell --started)" for NAME in ${NAMES} do @@ -88,7 +89,7 @@ case "${NAME}" in ;; esac - container restart --name ${NAME} || true + ${PROGRAM} restart --name ${NAME} || true done exit 0 diff --git a/lib/container/start b/lib/container/start index d73e328..a63c861 100755 --- a/lib/container/start +++ b/lib/container/start @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" START="false" @@ -89,7 +90,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME [-f|--force]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force]" >&2 exit 1 } @@ -102,7 +103,7 @@ fi case "${NAME}" in ALL) - NAMES="$(container list --format shell --stopped)" + NAMES="$(${PROGRAM} list --format shell --stopped)" for NAME in ${NAMES} do @@ -112,7 +113,7 @@ case "${NAME}" in ;; esac - container start --name ${NAME} ${OPTIONS_ALL} || true + ${PROGRAM} start --name ${NAME} ${OPTIONS_ALL} || true done exit 0 @@ -465,7 +466,7 @@ fi case "${SYSTEMCTL}" in true) - systemctl start container@${NAME}.service + systemctl start ${PROGRAM}@${NAME}.service # FIXME start console .. after sleep? + configuration option exit 0 ;; diff --git a/lib/container/status b/lib/container/status index 9c5ab20..a4b49e1 100755 --- a/lib/container/status +++ b/lib/container/status @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2016 Simon Spöehel <simon.spoehel@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -64,7 +65,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME" >&2 exit 1 } @@ -91,7 +92,7 @@ do done # Run -systemctl status container@${NAME}.service --full +systemctl status ${PROGRAM}@${NAME}.service --full # Post hooks for FILE in "${HOOKS}/post-${COMMAND}".* "${HOOKS}/${NAME}.post-${COMMAND}" diff --git a/lib/container/stop b/lib/container/stop index a5f0065..3a0de2a 100755 --- a/lib/container/stop +++ b/lib/container/stop @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" CLEAN="false" @@ -83,7 +84,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME [-f|--force]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force]" >&2 exit 1 } @@ -117,7 +118,7 @@ fi case "${NAME}" in ALL) - NAMES="$(container list --format shell --started)" + NAMES="$(${PROGRAM} list --format shell --started)" for NAME in ${NAMES} do @@ -127,7 +128,7 @@ case "${NAME}" in ;; esac - container stop --name ${NAME} ${OPTIONS_ALL} || true + ${PROGRAM} stop --name ${NAME} ${OPTIONS_ALL} || true done exit 0 diff --git a/lib/container/top b/lib/container/top index 5a0bb0d..7e757c8 100755 --- a/lib/container/top +++ b/lib/container/top @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,6 +19,8 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" Parameters () @@ -60,7 +61,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} [-d|--delay DELAY]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} [-d|--delay DELAY]" >&2 exit 1 } @@ -105,7 +106,7 @@ Top () trap 'clear' EXIT HUP INT QUIT TERM -Top "container list && printf '%-59s %-19s\n' \" Host: ${HOST}\" \"\$(date +%Y-%m-%d\ %H:%M:%S)\"" +Top "${PROGRAM} list && printf '%-59s %-19s\n' \" Host: ${HOST}\" \"\$(date +%Y-%m-%d\ %H:%M:%S)\"" # Post hooks for FILE in "${HOOKS}/post-${COMMAND}".* "${HOOKS}/${NAME}.post-${COMMAND}" diff --git a/lib/container/version b/lib/container/version index 06941c0..d356c3e 100755 --- a/lib/container/version +++ b/lib/container/version @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,10 +19,12 @@ set -e +PROJECT="open-infrastructure" +PROGRAM="container" COMMAND="$(basename ${0})" -HOOKS="/etc/container-tools/hooks" -SHARE="/usr/share/container-tools" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" +SHARE="/usr/share/${PROJECT}/${PROGRAM}" # Pre hooks for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}" |