From ff2ea6b8f225cd26c83416159a682e5d3a6c676f Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Tue, 20 Jun 2023 09:14:20 +0200 Subject: [PATCH] Check sanity of WORKING_DIRECTORY variable. cd into $WORKING_DIRECTORY before sourcing other scripts. --- update_psa | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/update_psa b/update_psa index 75a34b6..cb6c10f 100755 --- a/update_psa +++ b/update_psa @@ -70,7 +70,19 @@ while test $# -gt 0; do esac shift done - + +if [ -z "$WORKING_DIRECTORY" ]; then + echo "WORKING_DIRECTORY empty. exiting..." + exit 1 +fi + +if [ ! -d "$WORKING_DIRECTORY" ]; then + echo "WORKING_DIRECTORY $WORKING_DIRECTORY does not exist! exiting..." + exit 1 +fi + +cd "$WORKING_DIRECTORY" + source ./update_psa_impl if read_config; then