From 13175dfc19dbac8d7024f3f5fb3d838a4bc7a0a1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 17 Feb 2019 18:40:15 +0100 Subject: Adding upstream version 20190222. Signed-off-by: Daniel Baumann --- bin/container | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'bin/container') 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 +# Copyright (C) 2014-2019 Daniel Baumann # # 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}" -- cgit v1.2.3