82 lines
2.2 KiB
Bash
Executable File
82 lines
2.2 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"
|
|
;;
|
|
--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
|
|
|
|
source ./update_psa_impl
|
|
|
|
if read_config
|
|
then
|
|
if clone_customer_repository $CUSTOMER_REPOSITORY_PATH
|
|
then
|
|
check_sanity_of_repository
|
|
reset_update_trigger
|
|
set_updates_available
|
|
sleep 10
|
|
if updates_available
|
|
then
|
|
update_psa_started
|
|
sleep 5
|
|
update_psa_in_progress
|
|
sleep 5
|
|
update_status
|
|
fi
|
|
# update_psa
|
|
fi
|
|
fi
|
|
|
|
exit $EXIT_CODE
|
|
###############################################################################
|