]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
fort_setup.sh: Don’t write config to the current dir and check if the directory used...
authoralarig <alarig@swordarmor.fr>
Tue, 25 Feb 2020 19:11:42 +0000 (20:11 +0100)
committerGitHub <noreply@github.com>
Tue, 25 Feb 2020 19:11:42 +0000 (13:11 -0600)
fort_setup.sh

index 9ddbf0f808dc9f1da7f13e400f256e1db52887d7..23e3f70f58547b3ab85fcc7d8c33df728f06e0a9 100755 (executable)
@@ -78,11 +78,20 @@ if [ "$?" = "0" ] ; then
   TMP=""
 fi
 
+# Get the configuration directory
+CONF_DIR="$(dirname "${TALS_LOC}")"
+if [ ! -w "${CONF_DIR}" ]; then
+  CONF_DIR="/tmp/fort"
+  if [ ! -d "${CONF_DIR}" ]; then
+    mkdir -p "${CONF_DIR}"
+  fi
+fi
+
 # Declare variables
 GITHUB_TALS="https://raw.githubusercontent.com/NICMx/FORT-validator/master/examples/tal"
 ACCEPT="no"
 REPO_DIR="/var/cache/fort/repository"
-CONF_FILE="fort-config.json"
+CONF_FILE="${CONF_DIR}/fort-config.json"
 ARIN_TAL="https://www.arin.net/resources/manage/rpki/arin-rfc7730.tal"
 
 # Agree ARIN RPA. Exit on denial or unknown response, download otherwise.