2022-06-03 21:48:41 +02:00
|
|
|
#! /bin/bash -
|
|
|
|
# Implementing update functionality for an PSA.
|
2022-06-03 20:42:26 +02:00
|
|
|
###############################################################################
|
|
|
|
#
|
2022-06-03 21:48:41 +02:00
|
|
|
# UPDATE PSA
|
|
|
|
# Usage:
|
|
|
|
# update_psa [ --? ]
|
|
|
|
# [ --help ]
|
|
|
|
# [ --wdir "working_directory" ]
|
|
|
|
# [ --file "config_file" ]
|
|
|
|
# [ --dbg ]
|
|
|
|
# [ --version ]
|
2022-06-03 20:42:26 +02:00
|
|
|
#
|
2022-06-03 21:48:41 +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
|
2022-06-03 21:48:41 +02:00
|
|
|
# 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
|
|
|
|
|
2022-06-03 21:48:41 +02:00
|
|
|
# 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 )
|
2022-06-03 21:48:41 +02:00
|
|
|
shift
|
|
|
|
CONFIGFILENAME="$1"
|
|
|
|
;;
|
2022-06-02 17:42:35 +02:00
|
|
|
--zone | --zon | --zo | --z | -zone | -zon | -zo | -z )
|
|
|
|
shift
|
|
|
|
ZONE="$1"
|
|
|
|
;;
|
2022-06-03 21:48:41 +02:00
|
|
|
--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
|
2022-06-03 21:48:41 +02:00
|
|
|
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
|
2022-06-03 21:48:41 +02:00
|
|
|
|
2023-03-30 14:56:49 +02:00
|
|
|
if read_config
|
|
|
|
then
|
2022-06-25 15:08:44 +02:00
|
|
|
check_default_route
|
|
|
|
check_route_to_repository "185.191.219.134" # git.mimbach.de
|
2022-06-25 15:22:34 +02:00
|
|
|
check_for_running_apism
|
2023-03-30 14:56:49 +02:00
|
|
|
if clone_customer_repository ${CUSTOMER_REPOSITORY_PATH}
|
2022-06-25 15:22:34 +02:00
|
|
|
then
|
2023-03-30 14:56:49 +02:00
|
|
|
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
|
|
|
|
2022-07-08 13:21:47 +02:00
|
|
|
update_psa "testing"
|
|
|
|
#update_psa
|
2023-03-30 14:56:49 +02:00
|
|
|
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
|
2022-06-03 21:48:41 +02:00
|
|
|
|
2023-03-30 14:56:49 +02:00
|
|
|
exit -1
|
2022-06-03 21:48:41 +02:00
|
|
|
###############################################################################
|