Compare commits
9 Commits
8b5cda7f73
...
szeged_pre
Author | SHA1 | Date | |
---|---|---|---|
c229f7072c | |||
7a35039dad | |||
42fb74a041 | |||
d69f767002 | |||
7c2d78e6db | |||
9dd7eb7a3c | |||
87be571e43 | |||
2045dcedf5 | |||
9d6bb99963 |
@@ -85,21 +85,24 @@ if [ "${general_utils_sourced:-1}" = "1" ]; then # include only once
|
||||
# if [ -z ${!1} ]; then
|
||||
# log_fatal "$1 not set"
|
||||
# fi
|
||||
log_debug "$1=${!1}"
|
||||
# log_debug "$1=${!1}"
|
||||
:
|
||||
}
|
||||
|
||||
assert_d () {
|
||||
# if [ ! -d ${!1} ]; then
|
||||
# log_fatal "$1 does not exist"
|
||||
# fi
|
||||
log_debug "$1=${!1}"
|
||||
# log_debug "$1=${!1}"
|
||||
:
|
||||
}
|
||||
|
||||
assert_f () {
|
||||
# if [ ! -f ${!1} ]; then
|
||||
# log_fatal "$1 does not exist"
|
||||
# fi
|
||||
log_debug "$1=${!1}"
|
||||
#log_debug "$1=${!1}"
|
||||
:
|
||||
}
|
||||
|
||||
assert_a () {
|
||||
@@ -109,6 +112,7 @@ if [ "${general_utils_sourced:-1}" = "1" ]; then # include only once
|
||||
# if [ $__len -eq 0 ]; then
|
||||
# log_fatal "$1 not set"
|
||||
# fi
|
||||
log_debug "$1=$__n"
|
||||
# log_debug "$1=$__n"
|
||||
:
|
||||
}
|
||||
fi
|
||||
|
@@ -82,6 +82,8 @@ clone_customer_repository () {
|
||||
if [ $? -eq 0 ]; then
|
||||
log_debug "$func:${LINENO} cloning ${1} done"
|
||||
GIT_CLONE_EXECUTED=1
|
||||
rm -f $GIT_PULL_TMP
|
||||
rm -f $OPKG_CMDS_TMP
|
||||
# after cloning, cd into repository, and re-initialize,
|
||||
# setting the work-tree as "/". This has the effect that
|
||||
# a "git pull" will automatically fetched files in the
|
||||
|
16
log_helpers
16
log_helpers
@@ -1,6 +1,10 @@
|
||||
#!/bin/bash
|
||||
# set -x
|
||||
|
||||
RED='\e[0;31m'
|
||||
GREEN='\e[0;32m'
|
||||
NC='\e[0m' # No Color
|
||||
|
||||
if [ "${log_helpers_sourced:-1}" = "1" ]; then # include only once
|
||||
readonly log_helpers_sourced=${BASH_SOURCE[0]}
|
||||
|
||||
@@ -47,32 +51,32 @@ if [ "${log_helpers_sourced:-1}" = "1" ]; then # include only once
|
||||
|
||||
log_info() {
|
||||
if [ $log_level -le $INFO ]; then
|
||||
log "INFO $*"
|
||||
log "${GREEN}INFO $*"
|
||||
fi
|
||||
}
|
||||
|
||||
log_warn() {
|
||||
if [ $log_level -le $WARN ]; then
|
||||
log "WARN $*"
|
||||
log "${RED}WARN $*"
|
||||
fi
|
||||
}
|
||||
|
||||
log_crit() {
|
||||
if [ $log_level -le $CRIT ]; then
|
||||
log "CRIT $*"
|
||||
log "${RED}CRIT $*"
|
||||
fi
|
||||
}
|
||||
|
||||
log_error() {
|
||||
if [ $log_level -le $ERROR ]; then
|
||||
log "ERROR $*"
|
||||
log "${RED}ERROR $*"
|
||||
fi
|
||||
}
|
||||
|
||||
log_fatal() {
|
||||
if [ $log_level -le $FATAL ]; then
|
||||
log "FATAL $*"
|
||||
log "exiting ..."
|
||||
log "${RED}FATAL $*"
|
||||
log "${RED}exiting ..."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
16
read_config
16
read_config
@@ -37,17 +37,13 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
||||
read_config() {
|
||||
local func="${FUNCNAME[0]}"
|
||||
|
||||
WORKING_DIRECTORY=${WORKING_DIRECTORY:-$UPDATEPSAHOME}
|
||||
WORKING_DIRECTORY=${PWD}
|
||||
CONFIGFILENAME=${CONFIGFILENAME:-'update_psa.conf'}
|
||||
|
||||
if ! [ -f "$CONFIGFILENAME" ]; then
|
||||
log_fatal "$func:${LINENO}: $CONFIGFILENAME not found"
|
||||
fi
|
||||
|
||||
if ! [ -d "$WORKING_DIRECTORY" ]; then
|
||||
log_fatal "$func:${LINENO}: $WORKING_DIRECTORY not found"
|
||||
fi
|
||||
|
||||
log_debug "$func:${LINENO}: CONFIGFILENAME=$CONFIGFILENAME"
|
||||
log_debug "$func:${LINENO}: WORKING_DIRECTORY=$WORKING_DIRECTORY"
|
||||
|
||||
@@ -383,11 +379,11 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
||||
${DC_PSA_DC_FILE##*${CUSTOMER_ID}/} \
|
||||
${OPKG_CMDS_PSA_FILE##*${CUSTOMER_ID}/})
|
||||
|
||||
log_debug "known json/ini/hex_files ->"
|
||||
for (( i=0; i < ${#KNOWN_FILES[@]}; ++i )); do
|
||||
tab=$'\t'
|
||||
log_debug "$tab$tab ${KNOWN_FILES[$i]}"
|
||||
done
|
||||
# log_debug "known json/ini/hex_files ->"
|
||||
# for (( i=0; i < ${#KNOWN_FILES[@]}; ++i )); do
|
||||
# tab=$'\t'
|
||||
# log_debug "$tab$tab ${KNOWN_FILES[$i]}"
|
||||
# done
|
||||
log_debug "sanity of ${CUSTOMER_REPOSITORY_PATH} OK"
|
||||
|
||||
# compute version string for current (i.e. previous) version
|
||||
|
38
update_psa
38
update_psa
@@ -14,10 +14,10 @@
|
||||
# ./update_psa --file $PWD/update_psa.conf --wdir $PWD
|
||||
#
|
||||
###############################################################################
|
||||
if [ $# -eq 0 ]; then
|
||||
# if [ $# -eq 0 ]; then
|
||||
# no parameters given -> nothing to do
|
||||
exit 0
|
||||
fi
|
||||
# exit 0
|
||||
#fi
|
||||
|
||||
if [ -z $IFS ]; then
|
||||
IFS=$'\n'
|
||||
@@ -59,24 +59,28 @@ while test $# -gt 0; do
|
||||
shift
|
||||
done
|
||||
|
||||
source ./update_psa_impl
|
||||
if cd "$WORKING_DIRECTORY"; then
|
||||
source ./update_psa_impl
|
||||
|
||||
if read_config
|
||||
then
|
||||
if clone_customer_repository $CUSTOMER_REPOSITORY_PATH
|
||||
then
|
||||
check_sanity_of_repository
|
||||
if read_config
|
||||
then
|
||||
if clone_customer_repository ${CUSTOMER_REPOSITORY_PATH}
|
||||
then
|
||||
check_sanity_of_repository
|
||||
|
||||
#set_updates_available
|
||||
#while :
|
||||
#do
|
||||
# sleep 5
|
||||
# updates_available && break
|
||||
#done
|
||||
#set_updates_available
|
||||
#while :
|
||||
#do
|
||||
# sleep 5
|
||||
# updates_available && break
|
||||
#done
|
||||
|
||||
update_psa
|
||||
# update_psa "testing"
|
||||
update_psa
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exit $EXIT_CODE
|
||||
exit -1
|
||||
###############################################################################
|
||||
|
@@ -28,11 +28,13 @@ collect_current_configuration () {
|
||||
#done
|
||||
}
|
||||
|
||||
update_psa() {
|
||||
update_psa() { # calling with a parameter is used for testing
|
||||
|
||||
if ! updates_available; then # check for false alarm
|
||||
update_psa_false_alarm "update requested, but no WAIT state detected"
|
||||
exit $?
|
||||
if [ $# -eq 0 ]; then
|
||||
if ! updates_available; then # check for false alarm
|
||||
update_psa_false_alarm "update requested, but no WAIT state detected"
|
||||
exit $EXITCODE
|
||||
fi
|
||||
fi
|
||||
|
||||
update_psa_activated # message to ISMAS
|
||||
|
Reference in New Issue
Block a user