summaryrefslogtreecommitdiffstats
path: root/bin/container
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-23 15:36:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-23 16:30:59 +0000
commit93d59c3176876b0990b27375458cf6518459bb07 (patch)
tree85403b3d9ac7f9df4b91195124b342dee81ec640 /bin/container
parentReleasing debian version 20180825-3. (diff)
downloadopen-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 'bin/container')
-rwxr-xr-xbin/container19
1 files changed, 9 insertions, 10 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}"