From a58f310e6130e7c51e7c87c7d0152057cdf43262 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 12 Apr 2021 14:29:40 -0400 Subject: [PATCH] build: Address shellcheck warnings in run_appimage.sh --- deployment_scripts/appimage/run_appimage.sh | 25 +++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/deployment_scripts/appimage/run_appimage.sh b/deployment_scripts/appimage/run_appimage.sh index a903bc034..d7945765a 100644 --- a/deployment_scripts/appimage/run_appimage.sh +++ b/deployment_scripts/appimage/run_appimage.sh @@ -1,31 +1,32 @@ #!/bin/bash -PYTHON_CMD="$APPDIR/opt/python3.7/bin/python3.7" -DOT_MONKEY=$HOME/.monkey_island/ +PYTHON_CMD="$APPDIR"/opt/python3.7/bin/python3.7 +DOT_MONKEY="$HOME"/.monkey_island/ configure_default_logging() { - if [ ! -f $DOT_MONKEY/island_logger_config.json ]; then - cp $APPDIR/usr/src/island_logger_config.json $DOT_MONKEY + if [ ! -f "$DOT_MONKEY"/island_logger_config.json ]; then + cp "$APPDIR"/usr/src/island_logger_config.json "$DOT_MONKEY" fi } configure_default_server() { - if [ ! -f $DOT_MONKEY/server_config.json ]; then - cp $APPDIR/usr/src/monkey_island/cc/server_config.json.standard $DOT_MONKEY/server_config.json + if [ ! -f "$DOT_MONKEY"/server_config.json ]; then + cp "$APPDIR"/usr/src/monkey_island/cc/server_config.json.standard "$DOT_MONKEY"/server_config.json fi } -mkdir --mode=0700 --parents $DOT_MONKEY +# shellcheck disable=SC2174 +mkdir --mode=0700 --parents "$DOT_MONKEY" -DB_DIR=$DOT_MONKEY/db -mkdir -p $DB_DIR +DB_DIR="$DOT_MONKEY"/db +mkdir --parents "$DB_DIR" configure_default_logging configure_default_server -cd $APPDIR/usr/src -./monkey_island/bin/mongodb/bin/mongod --dbpath $DB_DIR & -${PYTHON_CMD} ./monkey_island.py --server-config $DOT_MONKEY/server_config.json --logger-config $DOT_MONKEY/island_logger_config.json +cd "$APPDIR"/usr/src || exit 1 +./monkey_island/bin/mongodb/bin/mongod --dbpath "$DB_DIR" & +${PYTHON_CMD} ./monkey_island.py --server-config "$DOT_MONKEY"/server_config.json --logger-config "$DOT_MONKEY"/island_logger_config.json