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
|
|
|
###############################################################################
|
2022-06-03 21:48:41 +02:00
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
# no parameters given -> nothing to do
|
2022-06-03 20:42:26 +02:00
|
|
|
exit 0
|
2022-06-03 21:48:41 +02:00
|
|
|
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
|
|
|
|
|
2022-06-03 21:48:41 +02:00
|
|
|
source ./update_psa_impl
|
|
|
|
|
|
|
|
if read_config
|
|
|
|
then
|
|
|
|
if clone_customer_repository $CUSTOMER_REPOSITORY_PATH
|
|
|
|
then
|
|
|
|
check_sanity_of_repository
|
2022-06-06 19:07:03 +02:00
|
|
|
|
|
|
|
#set_updates_available
|
|
|
|
#while :
|
|
|
|
#do
|
2022-06-04 21:48:58 +02:00
|
|
|
# sleep 5
|
|
|
|
# updates_available && break
|
2022-06-06 19:07:03 +02:00
|
|
|
#done
|
2022-06-03 21:52:40 +02:00
|
|
|
|
|
|
|
update_psa
|
2022-06-03 20:42:26 +02:00
|
|
|
fi
|
|
|
|
fi
|
2022-06-03 21:48:41 +02:00
|
|
|
|
|
|
|
exit $EXIT_CODE
|
|
|
|
###############################################################################
|