Skip to content

Commit

Permalink
fix handling no webapps parameter value
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias krause committed Dec 19, 2023
1 parent 2348397 commit 7d7bf1f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions import-studio-export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
## thus git considers every file as modified. To prevent this, the script undoes the changes to ownership and permissions.
##

function cleanup {
rm -rf "$WEBAPPS_DIR"
echo "Deleted temp $WEBAPPS_DIR"
}


# default parameters
IRIS_OWNER_ID=51773
Expand All @@ -21,7 +26,7 @@ XML_TO_UDL_IMAGE="ghcr.io/hbtgmbh/xml-to-udl/converter:latest"
DELETE_EXTRANEOUS_FILES=false

# get script arguments
ARGS=$(getopt -o 'dx:s:i:w:' --long 'delete,xml-file:,source-folder:,image::webapps-folder::' -- "$@") || exit
ARGS=$(getopt -o 'dx:s:i:w:' --long 'delete,xml-file:,source-folder:,image::,webapps-folder::' -- "$@") || exit
eval "set -- $ARGS"

# handle script arguments
Expand Down Expand Up @@ -82,13 +87,15 @@ else
check_for_abspath_to_dir "source folder" $SOURCE_DIR
fi


# check for webapps folder path
if [[ ! $WEBAPPS_DIR ]]; then
echo -e "Argument -w,--webapps-folder is missing. Please provide a path to a source directory." >&2
exit 1
else
check_for_abspath_to_dir "webapps folder" $WEBAPPS_DIR
# create empty temp dir
WEBAPPS_DIR=`mktemp -d`
trap cleanup EXIT
fi
check_for_abspath_to_dir "webapps folder" $WEBAPPS_DIR


# store current owner of source directory
USER=`ls -ld $SOURCE_DIR | awk '{print $3}'`
Expand Down

0 comments on commit 7d7bf1f

Please sign in to comment.