From 1819fac32eeea5e5f6ae2392dce19a3dfc44fe57 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Tue, 15 Oct 2019 16:25:44 +0200 Subject: [PATCH] + created alias scripts for lgsm commands --- gmod/Dockerfile | 19 ++++++++++++++++++- lgsm/Dockerfile | 3 ++- lgsm/createAlias.sh | 22 ++++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 lgsm/createAlias.sh diff --git a/gmod/Dockerfile b/gmod/Dockerfile index c2d0f12..db5c490 100644 --- a/gmod/Dockerfile +++ b/gmod/Dockerfile @@ -81,4 +81,21 @@ RUN chown "$DOCKER_USER:$DOCKER_USER" /home/prepareServer.sh && \ chmod a=rx /home/prepareServer.sh && \ chmod a=rx /home/initConfig.sh && \ chmod a=rx /home/forceWorkshopDownload.sh && \ - chmod a=rx /home/installAndMountAddons.sh + chmod a=rx /home/installAndMountAddons.sh && \ + \ + /home/createAlias.sh "details" '/home/steam/gmodserver details' && \ + /home/createAlias.sh "backup" '/home/steam/gmodserver backup' && \ + /home/createAlias.sh "console" '/home/steam/gmodserver console' && \ + /home/createAlias.sh "debug" '/home/steam/gmodserver debug' && \ + /home/createAlias.sh "details" '/home/steam/gmodserver details' && \ + /home/createAlias.sh "force-update" '/home/steam/gmodserver force-update' && \ + /home/createAlias.sh "install" '/home/steam/gmodserver install' && \ + /home/createAlias.sh "monitor" '/home/steam/gmodserver monitor' && \ + /home/createAlias.sh "postdetails" '/home/steam/gmodserver postdetails' && \ + /home/createAlias.sh "restart" '/home/steam/gmodserver restart' && \ + /home/createAlias.sh "start" '/home/steam/gmodserver start' && \ + /home/createAlias.sh "stop" '/home/steam/gmodserver stop' && \ + /home/createAlias.sh "test-alert" '/home/steam/gmodserver test-alert' && \ + /home/createAlias.sh "update" '/home/steam/gmodserver update' && \ + /home/createAlias.sh "update-lgsm" '/home/steam/gmodserver update-lgsm' && \ + /home/createAlias.sh "validate" '/home/steam/gmodserver validate' diff --git a/lgsm/Dockerfile b/lgsm/Dockerfile index 8babb8b..cc9b6d7 100644 --- a/lgsm/Dockerfile +++ b/lgsm/Dockerfile @@ -34,7 +34,7 @@ ENTRYPOINT ["./home/entrypoint.sh"] #WORKDIR "$STEAM_PATH" -COPY ["entrypoint.sh", "initCron.sh", "/home/"] +COPY ["entrypoint.sh", "initCron.sh", "createAlias.sh", "/home/"] # procps needed for ps command # iproute2 needed because of "-slim" @@ -52,6 +52,7 @@ RUN dpkg --add-architecture i386 && \ chown -R "$DOCKER_USER:$DOCKER_USER" "$STEAM_PATH" && \ chmod a=rx /home/entrypoint.sh && \ chmod a=rx /home/initCron.sh && \ + chmod a=rx /home/createAlias.sh && \ \ ulimit -n 2048 && \ \ diff --git a/lgsm/createAlias.sh b/lgsm/createAlias.sh new file mode 100644 index 0000000..a33f6e9 --- /dev/null +++ b/lgsm/createAlias.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +if [ "${DEBUGGING}" = "true" ]; then + set -o xtrace +fi + +set -o errexit +set -o nounset + +name=$1 +command=$2 +file="/usr/local/bin/$name" + +echo "[createAlias.sh] $name = $command" + +if [ -f "$file" ]; then + echo "[createAlias.sh]error file already exists => cant create alias with this method" +else + echo '#!/bin/bash' > "$file" + echo "$command" >> "$file" && \ + chmod a=rx "$file" +fi