UpdateController/update_psa
Gerhard Hoffmann 9b1549306d Added checks:
check_default_route -> exit if no route set
check_route_to_repository -> exit if no such route
check_for_apism
2022-06-25 15:08:44 +02:00

90 lines
2.4 KiB
Bash
Executable File

#! /bin/bash -
# Implementing update functionality for an PSA.
###############################################################################
#
# UPDATE PSA
# Usage:
# update_psa [ --? ]
# [ --help ]
# [ --wdir "working_directory" ]
# [ --file "config_file" ]
# [ --dbg ]
# [ --version ]
#
# ./update_psa --file $PWD/update_psa.conf --wdir $PWD
#
###############################################################################
# if [ $# -eq 0 ]; then
# no parameters given -> nothing to do
# exit 0
#fi
if [ -z $IFS ]; then
IFS=$'\n'
fi
# parse commandline parameters
while test $# -gt 0; do
case $1 in
--file | --fil | --fi | --f | -file | -fil | -fi | -f )
shift
CONFIGFILENAME="$1"
;;
--zone | --zon | --zo | --z | -zone | -zon | -zo | -z )
shift
ZONE="$1"
;;
--wdir | --wdi | --wd | --w | -wdir | -wdi | -wd | -w )
shift
WORKING_DIRECTORY="$1"
;;
--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
;;
--dbg | --db | --d | -dbg | -db | -d )
set_dbg_level $DEBUG
;;
-*)
error "Unrecognized option: $1"
;;
*)
break
;;
esac
shift
done
if cd "$WORKING_DIRECTORY"; then
source ./update_psa_impl
if read_config
then
check_default_route
check_route_to_repository "185.191.219.134" # git.mimbach.de
check_for_apism
if clone_customer_repository ${CUSTOMER_REPOSITORY_PATH}
then
check_sanity_of_repository
#set_updates_available
#while :
#do
# sleep 5
# updates_available && break
#done
# update_psa "testing"
update_psa
fi
fi
exit 0
fi
exit -1
###############################################################################