UpdateController/update_psa

90 lines
2.4 KiB
Plaintext
Raw Normal View History

#! /bin/bash -
# Implementing update functionality for an PSA.
2022-06-03 20:42:26 +02:00
###############################################################################
#
# UPDATE PSA
# Usage:
# update_psa [ --? ]
# [ --help ]
# [ --wdir "working_directory" ]
# [ --file "config_file" ]
# [ --dbg ]
# [ --version ]
2022-06-03 20:42:26 +02:00
#
# ./update_psa --file $PWD/update_psa.conf --wdir $PWD
#
2022-06-03 20:42:26 +02:00
###############################################################################
2023-03-30 14:56:49 +02:00
# if [ $# -eq 0 ]; then
# no parameters given -> nothing to do
2023-03-30 14:56:49 +02:00
# exit 0
#fi
2022-06-03 20:42:26 +02:00
2022-06-06 18:21:34 +02:00
if [ -z $IFS ]; then
IFS=$'\n'
fi
# parse commandline parameters
2022-06-06 18:21:34 +02:00
while test $# -gt 0; do
case $1 in
--file | --fil | --fi | --f | -file | -fil | -fi | -f )
shift
CONFIGFILENAME="$1"
;;
2022-06-02 17:42:35 +02:00
--zone | --zon | --zo | --z | -zone | -zon | -zo | -z )
shift
ZONE="$1"
;;
--wdir | --wdi | --wd | --w | -wdir | -wdi | -wd | -w )
shift
WORKING_DIRECTORY="$1"
2022-06-06 18:21:34 +02:00
;;
--help | -hel | --he | --h | '--?' | -help | -hel | -he | -h | '-?' )
usage_and_exit 0
;;
--version | --versio | --versi | --vers | --ver | --ve | --v | \
-version | -versio | -versi | -vers | -ver | -ve | -v )
version
exit 0
2022-06-06 18:21:34 +02:00
;;
--dbg | --db | --d | -dbg | -db | -d )
set_dbg_level $DEBUG
;;
-*)
error "Unrecognized option: $1"
;;
*)
break
;;
esac
shift
done
2023-03-30 14:56:49 +02:00
if cd "$WORKING_DIRECTORY"; then
source ./update_psa_impl
2023-03-30 14:56:49 +02:00
if read_config
then
check_default_route
check_route_to_repository "185.191.219.134" # git.mimbach.de
check_for_apism
2023-03-30 14:56:49 +02:00
if clone_customer_repository ${CUSTOMER_REPOSITORY_PATH}
then
check_sanity_of_repository
2022-06-06 19:07:03 +02:00
2023-03-30 14:56:49 +02:00
#set_updates_available
#while :
#do
# sleep 5
# updates_available && break
#done
2022-06-03 21:52:40 +02:00
# update_psa "testing"
2023-03-30 14:56:49 +02:00
update_psa
fi
2022-06-03 20:42:26 +02:00
fi
2023-03-31 12:17:08 +02:00
exit 0
2022-06-03 20:42:26 +02:00
fi
2023-03-30 14:56:49 +02:00
exit -1
###############################################################################