From: alarig Date: Tue, 25 Feb 2020 19:11:42 +0000 (+0100) Subject: fort_setup.sh: Don’t write config to the current dir and check if the directory used... X-Git-Tag: v1.2.1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6415c6f96524ba07e8f8382f5803966565e680b2;p=thirdparty%2FFORT-validator.git fort_setup.sh: Don’t write config to the current dir and check if the directory used is writable (#24) --- diff --git a/fort_setup.sh b/fort_setup.sh index 9ddbf0f8..23e3f70f 100755 --- a/fort_setup.sh +++ b/fort_setup.sh @@ -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.