Moved changing to WORKING_DIRECTORY here

This commit is contained in:
Gerhard Hoffmann 2023-05-24 17:29:15 +02:00
parent 847c58afc8
commit 8f50f62a52

View File

@ -25,6 +25,7 @@ if [ -z $IFS ]; then
fi fi
MAINTENANCE="NO" MAINTENANCE="NO"
WORKING_DIRECTORY=${PWD}
# parse commandline parameters # parse commandline parameters
while test $# -gt 0; do while test $# -gt 0; do
@ -66,42 +67,46 @@ while test $# -gt 0; do
esac esac
shift shift
done done
source ./update_psa_impl
if cd "$WORKING_DIRECTORY"; then if [ -z "$WORKING_DIRECTORY" ]; then
source ./update_psa_impl log_fatal "update_psa:${LINENO}: empty WORKING_DIRECTORY"
if read_config
then
check_default_route
check_route_to_repository "185.191.219.134" # git.mimbach.de
check_for_running_apism
if clone_customer_repository ${CUSTOMER_REPOSITORY_PATH}
then
check_sanity_of_repository
if [ "$MAINTENANCE" = "NO" ]; then
log_info "update_psa:${LINENO}: MAINTENANCE OFF. Checking for updates..."
# someone must have activated the WAIT-button in ISMAS.
# Request the status of this button in updates_available().
if ! updates_available; then
update_psa_false_alarm "update requested, but no WAIT state detected !!!"
log_fatal "update_psa:${LINENO}: update requested, but no WAIT state detected !!!"
fi
else
# simulate an activated WAIT-button
set_updates_available
while :
do
sleep 5
updates_available && break
done
fi
# updates available
update_psa
fi
fi
exit 0
fi fi
exit -1 if ! cd "$WORKING_DIRECTORY"; then
log_fatal "update_psa:${LINENO}: cannot cd to $WORKING_DIRECTORY"
fi
log_info "update_psa:${LINENO}: cd to $WORKING_DIRECTORY"
if read_config; then
check_default_route
check_route_to_repository "185.191.219.134" # git.mimbach.de
check_for_running_apism
if clone_customer_repository ${CUSTOMER_REPOSITORY_PATH}; then
check_sanity_of_repository
if [ "$MAINTENANCE" = "NO" ]; then
log_info "update_psa:${LINENO}: MAINTENANCE OFF. Checking for updates..."
# someone must have activated the WAIT-button in ISMAS.
# Request the status of this button in updates_available().
if ! updates_available; then
update_psa_false_alarm "update requested, but no WAIT state detected !!!"
log_fatal "update_psa:${LINENO}: update requested, but no WAIT state detected !!!"
fi
else
# simulate an activated WAIT-button
set_updates_available
while :
do
sleep 5
updates_available && break
done
fi
# updates available
update_psa
fi
fi
exit 0
############################################################################### ###############################################################################