diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-02-23 15:36:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-02-23 16:30:59 +0000 |
commit | 93d59c3176876b0990b27375458cf6518459bb07 (patch) | |
tree | 85403b3d9ac7f9df4b91195124b342dee81ec640 /bin | |
parent | Releasing debian version 20180825-3. (diff) | |
download | open-infrastructure-compute-tools-93d59c3176876b0990b27375458cf6518459bb07.tar.xz open-infrastructure-compute-tools-93d59c3176876b0990b27375458cf6518459bb07.zip |
Merging upstream version 20190222.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | bin/container | 19 | ||||
-rwxr-xr-x | bin/container-shell | 10 |
2 files changed, 14 insertions, 15 deletions
diff --git a/bin/container b/bin/container index 849bbec..ac8feff 100755 --- a/bin/container +++ b/bin/container @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,10 +19,10 @@ set -e -SOFTWARE="container-tools" +PROJECT="open-infrastructure" PROGRAM="container" -HOOKS="/etc/${SOFTWARE}/hooks" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" # Parameter PARAMETER="${1}" @@ -44,7 +43,7 @@ OPTIONS="${@}" for COMMAND in $(echo ${COMMANDS} | sed -e 's|,| |g') do - if [ ! -e "/usr/lib/${SOFTWARE}/${PROGRAM}/${COMMAND}" ] + if [ ! -e "/usr/lib/${PROJECT}/${PROGRAM}/${COMMAND}" ] then echo "'${COMMAND}': no such ${PROGRAM} command" >&2 exit 1 @@ -68,15 +67,15 @@ do create|remove|rm|restart|start|stop) USER="${SUDO_USER:-${USER}}" DATE="$(date +%Y-%m-%d\ %H:%M:%S)" - HOST="$(hostname -f)" + HOST="$(hostname -f 2> /dev/null || hostname)" # logfile - echo "${DATE} ${HOST} ${USER} ${PROGRAM} ${COMMAND} ${OPTIONS}" >> "/var/log/${SOFTWARE}/${PROGRAM}.log" + echo "${DATE} ${HOST} ${USER} ${PROGRAM} ${COMMAND} ${OPTIONS}" >> "/var/log/${PROJECT}/${PROGRAM}.log" # irc - if [ -e /usr/bin/irk ] && [ -e "/etc/default/${SOFTWARE}" ] + if [ -e /usr/bin/irk ] && [ -e "/etc/${PROJECT}/${PROGRAM}.conf" ] then - . /etc/default/${SOFTWARE} + . "/etc/${PROJECT}/${PROGRAM}.conf" if [ -n "${IRK_TARGETS}" ] then @@ -91,7 +90,7 @@ do fi # Run - "/usr/lib/${SOFTWARE}/${PROGRAM}/${COMMAND}" "${OPTIONS}" + "/usr/lib/${PROJECT}/${PROGRAM}/${COMMAND}" "${OPTIONS}" # Post hooks for FILE in "${HOOKS}/post-${PROGRAM}".* "${HOOKS}/${NAME}.post-${PROGRAM}" diff --git a/bin/container-shell b/bin/container-shell index 2ca5cd3..fe113d3 100755 --- a/bin/container-shell +++ b/bin/container-shell @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -20,7 +19,8 @@ set -e -SOFTWARE="container-tools" +PROJECT="open-infrastructure" +SOFTWARE="compute-tools" PROGRAM="container" COMMAND="$(basename ${0})" @@ -64,7 +64,7 @@ Shell () echo "The following ${PROGRAM} commands are available:" echo - cd "/usr/lib/${SOFTWARE}/${PROGRAM}" + cd "/usr/lib/${PROJECT}/${PROGRAM}" find . -type f -printf " %f\n" | sort cd "${OLDPWD}" @@ -97,7 +97,7 @@ Shell () ;; esac - if [ ! -e "/usr/lib/${SOFTWARE}/${PROGRAM}/${COMMAND}" ] + if [ ! -e "/usr/lib/${PROJECT}/${PROGRAM}/${COMMAND}" ] then echo "'${COMMAND}': no such ${PROGRAM} command" >&2 return |