Compare commits
No commits in common. "bc4977bf7f76216cfe25186d680c7d86b1669a38" and "7b01bcf45603a8727512b60ea5e6b608d668b52b" have entirely different histories.
bc4977bf7f
...
7b01bcf456
@ -1,30 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# set -x
|
|
||||||
|
|
||||||
source ./log_helpers
|
|
||||||
|
|
||||||
exec_process_substitution () {
|
|
||||||
local func="${FUNCNAME[0]}"
|
|
||||||
log_debug "$func:${LINENO} exec-ing [$*]"
|
|
||||||
|
|
||||||
exec {fd}< <(eval "$@")
|
|
||||||
|
|
||||||
local __result_code=$?
|
|
||||||
local ps_pid=$! # remember pid of process substitution
|
|
||||||
|
|
||||||
local __result=""
|
|
||||||
while read __tmp <&$fd; do
|
|
||||||
if ! [ -z "$__tmp" ]; then
|
|
||||||
__result="${__result}$__tmp"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
exec {fd}>&- # close fd (i.e. process substitution)
|
|
||||||
wait $ps_pid # wait for the subshell to finish
|
|
||||||
|
|
||||||
__result=${__result//[$'\r\n\t']/ } # remove \r\n\t from __result
|
|
||||||
|
|
||||||
log_debug "$func:${LINENO} result=$__result"
|
|
||||||
printf '%s' $__result
|
|
||||||
return $__result_code
|
|
||||||
}
|
|
28
git.sh
Executable file
28
git.sh
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -x
|
||||||
|
commit_before_pull=""
|
||||||
|
|
||||||
|
save_commit_before_pull () {
|
||||||
|
commit_before_pull=$(git reflog | grep "HEAD@{0}" | cut -d" " -f1)
|
||||||
|
if ! [ -z "$commit_before_pull" ]; then
|
||||||
|
if grep -qE "^[[:xdigit:]]{6,}$" <<< $commit_before_pull; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
commit_before_pull=""
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
# save_commit_before_pull
|
||||||
|
|
||||||
|
revert_to_commit_before_pull () {
|
||||||
|
if ! [ -z "$commit_before_pull" ]; then
|
||||||
|
if grep -qE "^[[:xdigit:]]{6,}$" <<< $commit_before_pull; then
|
||||||
|
`git reset --hard "$commit_before_pull"`
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
# revert_to_commit_before_pull
|
49
git_helpers
49
git_helpers
@ -1,14 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# set -x
|
# set -x
|
||||||
|
|
||||||
source ./log_helpers
|
|
||||||
source ./general_utils
|
|
||||||
|
|
||||||
|
|
||||||
# if [ ${git_helpers_sourced:-1} = "1" ]; then
|
# if [ ${git_helpers_sourced:-1} = "1" ]; then
|
||||||
# readonly git_helpers_sourced=${BASH_SOURCE[0]}
|
# readonly git_helpers_sourced=${BASH_SOURCE[0]}
|
||||||
|
#else
|
||||||
|
# return 0
|
||||||
|
#fi
|
||||||
|
|
||||||
|
|
||||||
|
# source ./log_helpers
|
||||||
|
|
||||||
readonly GIT_SSL_NO_VERIFY=true
|
readonly GIT_SSL_NO_VERIFY=true
|
||||||
readonly repository_already_up_to_date=2
|
readonly repository_already_up_to_date=2
|
||||||
@ -16,18 +16,36 @@ readonly repository_already_up_to_date=2
|
|||||||
#
|
#
|
||||||
exec_git_command () {
|
exec_git_command () {
|
||||||
local func="${FUNCNAME[0]}"
|
local func="${FUNCNAME[0]}"
|
||||||
|
|
||||||
log_debug "$func:${LINENO} exec-ing [$*]"
|
log_debug "$func:${LINENO} exec-ing [$*]"
|
||||||
|
|
||||||
local __git_result=$(exec_process_substitution $*)
|
exec {fd}< <(eval "$@")
|
||||||
log_debug "$func:${LINENO} result=$__git_result"
|
|
||||||
|
|
||||||
printf '%s' "$__git_result"
|
# if [ "$*" = "git pull" ]; then
|
||||||
|
# else
|
||||||
|
# exec {fd}< <($@)
|
||||||
|
# fi
|
||||||
|
|
||||||
|
local ps_pid=$! # remember pid of process substitution
|
||||||
|
|
||||||
|
local git_result=""
|
||||||
|
while read t <&$fd; do
|
||||||
|
if ! [ -z "$t" ]; then
|
||||||
|
git_result="${git_result}$t"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exec {fd}>&- # close fd (i.e. process substitution)
|
||||||
|
wait $ps_pid # wait for the subshell to finish
|
||||||
|
|
||||||
|
git_result=$(printf "$git_result" | tr '\n' ' ')
|
||||||
|
printf "%s\n" $git_result
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
latest_commit () {
|
latest_commit () {
|
||||||
local func="${FUNCNAME[0]}"
|
local func="${FUNCNAME[0]}"
|
||||||
# git reflog -> 46c5896 HEAD@{0}: commit: Made update_helpers executable
|
# git reflog -> 46c5896 HEAD@{0}: commit: Made update_helpers.sh executable
|
||||||
local c=$(git reflog | grep "HEAD@{0}" | cut -d" " -f1)
|
local c=$(git reflog | grep "HEAD@{0}" | cut -d" " -f1)
|
||||||
if ! [ -z "$c" ]; then
|
if ! [ -z "$c" ]; then
|
||||||
if grep -qE "^[[:xdigit:]]{6,}$" <<< $c; then
|
if grep -qE "^[[:xdigit:]]{6,}$" <<< $c; then
|
||||||
@ -81,14 +99,14 @@ clone_customer_repository () {
|
|||||||
cd -
|
cd -
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# the directory is not empty, so we assume the
|
# the directory is not empty, so we assume the customer-repository
|
||||||
# customer-repository has been cloned already
|
# has been cloned alread
|
||||||
if ! [[ -d ./${workspace_dir}/$customer_id ]]; then
|
if ! [[ -d ./${workspace_dir}/$customer_id ]]; then
|
||||||
log_fatal "$func:${LINENO} "\
|
local m="wrong repository: $(ls -d './${workspace_dir}/*')"
|
||||||
"wrong repository: $(ls -d './${workspace_dir}/*')"
|
log_fatal "$func:${LINENO} $m"
|
||||||
else
|
else
|
||||||
local __m= "./${workspace_dir}/$customer_id exists"
|
log_debug \
|
||||||
log_debug "$func:${LINENO} $__m"
|
"$func:${LINENO} ./${workspace_dir}/$customer_id exists"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -111,7 +129,7 @@ cd_customer_repository () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! { cd $repository_dir; } ; then
|
if ! { cd $repository_dir; } ; then
|
||||||
log_crit "$func:${LINENO}: cannot cd to $repository_dir!"
|
log_crit "$func:${LINENO}: cannot change to $repository_dir!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -250,4 +268,3 @@ changed_file_names () {
|
|||||||
"while in $PWD"
|
"while in $PWD"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# fi
|
|
||||||
|
11
log_helpers
11
log_helpers
@ -1,8 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# set -x
|
# set -x
|
||||||
|
|
||||||
if [ ${log_helpers_sourced:-1} = "1" ]; then # include ony once
|
#if [ ${log_helpers_sourced:-1} = "1" ]; then
|
||||||
readonly log_helpers_sourced=${BASH_SOURCE[0]}
|
# readonly log_helpers_sourced=${BASH_SOURCE[0]}
|
||||||
|
#else
|
||||||
|
# return 0
|
||||||
|
#fi
|
||||||
|
|
||||||
readonly log_file=/var/log/update_controller.log
|
readonly log_file=/var/log/update_controller.log
|
||||||
if ! [ -f "$log_file" ]; then
|
if ! [ -f "$log_file" ]; then
|
||||||
@ -76,5 +79,5 @@ if [ ${log_helpers_sourced:-1} = "1" ]; then # include ony once
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
###############################################################################
|
|
||||||
fi ### include guard
|
# log "test message1" "test message2"
|
||||||
|
24
read_config
24
read_config
@ -1,10 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# set -x
|
# set -x
|
||||||
|
|
||||||
source ./log_helpers
|
#if [ ${read_config_sourced:-1} = "1" ]; then
|
||||||
|
# readonly read_config_sourced=${BASH_SOURCE[0]}
|
||||||
|
#else
|
||||||
|
# return 0
|
||||||
|
#fi
|
||||||
|
|
||||||
if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
# source ./log_helpers
|
||||||
readonly read_config_sourced=${BASH_SOURCE[0]}
|
|
||||||
|
|
||||||
# read config file (JSON syntax)
|
# read config file (JSON syntax)
|
||||||
#
|
#
|
||||||
@ -40,34 +43,27 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# check customer_location
|
# check customer_location
|
||||||
local customer_location=$(cat "$1" | jq -r .customer_location)
|
local customer_location="$(cat "$1" | jq -r .customer_location)"
|
||||||
if [ -z "$customer_location" ]; then
|
if [ -z "$customer_location" ]; then
|
||||||
log_fatal "$func:${LINENO}: customer_location not set in $1"
|
log_fatal "$func:${LINENO}: customer_location not set in $1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
readonly working_directory="$(cat "$1" | jq -r .working_directory)"
|
readonly working_directory="$(cat "$1" | jq -r .working_directory)"
|
||||||
|
|
||||||
log_info "$func:${LINENO}: working_directory is $working_directory"
|
log_info "$func:${LINENO}: working_directory is $working_directory"
|
||||||
|
|
||||||
readonly workspace_dir="$(cat "$1" | jq -r .workspace_dir)"
|
readonly workspace_dir="$(cat "$1" | jq -r .workspace_dir)"
|
||||||
|
|
||||||
local __customer_base_dir="$working_directory/${workspace_dir}"
|
local __customer_base_dir="$working_directory/${workspace_dir}"
|
||||||
__customer_base_dir="${__customer_base_dir}/${customer_id}"
|
__customer_base_dir="${__customer_base_dir}/${customer_id}"
|
||||||
__customer_base_dir="${__customer_base_dir}/${customer_location}"
|
__customer_base_dir="${__customer_base_dir}/${customer_location}"
|
||||||
|
|
||||||
readonly customer_location_dir="$__customer_base_dir"
|
|
||||||
|
|
||||||
log_info "$func:${LINENO}: customer-location-dir is $customer_location_dir"
|
|
||||||
|
|
||||||
readonly customer_base_dir="${__customer_base_dir}/${zone_group}/${zone}"
|
readonly customer_base_dir="${__customer_base_dir}/${zone_group}/${zone}"
|
||||||
|
|
||||||
log_info "$func:${LINENO}: customer-base-dir is $customer_base_dir"
|
log_info "$func:${LINENO}: customer-base-dir is $customer_base_dir"
|
||||||
|
|
||||||
readonly opkg_cmds_file="${customer_base_dir}/etc/psa_update/opkg_commands"
|
readonly opkg_cmds_file="${customer_base_dir}/etc/psa_update/opkg_commands"
|
||||||
|
|
||||||
log_info "$func:${LINENO}: opkg_cmds_file is $opkg_cmds_file"
|
log_info "$func:${LINENO}: opkg_cmds_file is $opkg_cmds_file"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
# read_config UpdateController.conf
|
|
||||||
fi
|
# read_config UpdateController.conf
|
||||||
|
|
||||||
|
31
update_psa
31
update_psa
@ -82,14 +82,12 @@ update() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# TODO: backup implementieren
|
|
||||||
# Backup before any updates in case some previous test was wrong
|
# Backup before any updates in case some previous test was wrong
|
||||||
if ! backup_previous_version; then
|
if ! backup_previous_version; then
|
||||||
log_error "$func:${LINENO}: backup failed"
|
log_error "$func:${LINENO}: backup failed"
|
||||||
revert_customer_repository ; exit 1
|
revert_customer_repository ; exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: implementieren, opkg pakete ausschliessen
|
|
||||||
files=$(changed_file_names)
|
files=$(changed_file_names)
|
||||||
if ! check_md5_for_changed_customer_files $files ; then
|
if ! check_md5_for_changed_customer_files $files ; then
|
||||||
log_error "$func:${LINENO}: new customer files wrong"
|
log_error "$func:${LINENO}: new customer files wrong"
|
||||||
@ -99,40 +97,31 @@ update() {
|
|||||||
if grep -qE ".*opkg_commands.*?" <<< $files; then
|
if grep -qE ".*opkg_commands.*?" <<< $files; then
|
||||||
# read opkg_cmds: each line respresents an opkg-command
|
# read opkg_cmds: each line respresents an opkg-command
|
||||||
readarray opkg_commands < <(cat $opkg_cmds_file)
|
readarray opkg_commands < <(cat $opkg_cmds_file)
|
||||||
for opkg_c in "${opkg_commands[@]}"; do
|
for opkg_command in "${opkg_commands[@]}"; do
|
||||||
if grep -qE "^\s*[#]+.*$" <<< $opkg_c; then
|
if grep -qE "^\s*[#]+.*?$" <<< $opkg_command; then
|
||||||
continue # found comment line
|
continue # found comment line
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# package manipulation commands without package:
|
# FIXME: sollte nicht gebraucht werden
|
||||||
local cwp="update|upgrade|clean"
|
opkg_command=${opkg_command//[$'\r\n\t']/ }
|
||||||
# informational commands without package:
|
local package=$(printf '%s' "$opkg_command" | awk '{ print $NF }')
|
||||||
cwp="${cwp}|list|list-installed|list-upgradable"
|
|
||||||
|
|
||||||
if grep -qE "^.*\s+($cwp)\s+.*$" <<< $opkg_c; then
|
|
||||||
local p=$(printf '%s' "$opkg_c" | awk '{ print $NF }')
|
|
||||||
local opkg_output=()
|
local opkg_output=()
|
||||||
if ! exec_opkg_info "$p" opkg_output; then
|
if ! exec_opkg_info "$package" opkg_output; then
|
||||||
log_error "$func:${LINENO}: opkg info $opkg_c failed"
|
log_error "$func:${LINENO}: opkg --noaction $opkg_command failed"
|
||||||
revert_customer_repository ; exit 1
|
revert_customer_repository ; exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! check_md5_for_opkg_packages opkg_output; then
|
if ! check_md5_for_opkg_packages opkg_output; then
|
||||||
log_error "$func:${LINENO}: "\
|
log_error "$func:${LINENO}: wrong md5sum for some opkg packages"
|
||||||
"wrong md5sum for opkg packages"
|
|
||||||
revert_customer_repository ; exit 1
|
revert_customer_repository ; exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# perform a dry-run and check if everything might work as expected.
|
# perform a dry-run and check if everything might work as expected.
|
||||||
if ! exec_opkg_no_action $opkg_c; then
|
|
||||||
log_error "$func:${LINENO}: "\
|
|
||||||
"opkg --noaction $opkg_c failed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Actually execute the opkg command
|
# Actually execute the opkg command
|
||||||
if ! exec_opkg $opkg_c; then
|
if ! exec_opkg $opkg_command; then
|
||||||
log_error "$func:${LINENO}: exec_opkg $opkg_c failed"
|
log_error "$func:${LINENO}: exec_opkg $opkg_command failed"
|
||||||
fallback_to_previous_version
|
fallback_to_previous_version
|
||||||
revert_customer_repository ; exit 1
|
revert_customer_repository ; exit 1
|
||||||
fi
|
fi
|
||||||
|
67
update_psa_helpers
Executable file → Normal file
67
update_psa_helpers
Executable file → Normal file
@ -6,19 +6,25 @@
|
|||||||
# return 0
|
# return 0
|
||||||
#fi
|
#fi
|
||||||
|
|
||||||
source ./general_utils
|
|
||||||
|
|
||||||
exec_opkg_command () {
|
exec_opkg_command () {
|
||||||
local func="${FUNCNAME[0]}"
|
local func="${FUNCNAME[0]}"
|
||||||
|
|
||||||
log_debug "$func:${LINENO} exec-ing [$*]"
|
log_debug "$func:${LINENO} exec-ing [$*]"
|
||||||
|
|
||||||
local __result=$(exec_process_substitution $*)
|
exec {fd}< <(eval "$@")
|
||||||
local __result_code=$?
|
local ps_pid=$! # remember pid of process substitution
|
||||||
|
|
||||||
log_debug "$func:${LINENO} result=$__result"
|
local opkg_result=""
|
||||||
|
while read tmp <&$fd; do
|
||||||
|
if ! [ -z "$tmp" ]; then
|
||||||
|
opkg_result="${opkg_result}$tmp"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
printf '%s' "$__result"
|
exec {fd}>&- # close fd (i.e. process substitution)
|
||||||
return $__result_code
|
wait $ps_pid # wait for the subshell to finish
|
||||||
|
|
||||||
|
printf '%s' "$opkg_result"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fetch/merge updates from predefined repository using git.
|
# Fetch/merge updates from predefined repository using git.
|
||||||
@ -49,34 +55,23 @@ check_md5_for_opkg_packages () {
|
|||||||
local func="${FUNCNAME[0]}"
|
local func="${FUNCNAME[0]}"
|
||||||
local -n opkg_output_ref=$1
|
local -n opkg_output_ref=$1
|
||||||
local package=""
|
local package=""
|
||||||
local md5sum_opkg_info=""
|
local md5sum=""
|
||||||
local filename=""
|
local filename=""
|
||||||
for line in ${opkg_output_ref[@]}; do
|
for line in ${opkg_output_ref[@]}; do
|
||||||
log_info "$func:${LINENO}: line=$line"
|
|
||||||
if grep -qE "^\s*Package\s*:.*?$" <<< "$line"; then
|
if grep -qE "^\s*Package\s*:.*?$" <<< "$line"; then
|
||||||
package=${line#*:* }
|
package=${line#*:* }
|
||||||
|
printf 'package=%s\n' "$package"
|
||||||
elif grep -qE "^\s*MD5Sum\s*:.*?$" <<< "$line"; then
|
elif grep -qE "^\s*MD5Sum\s*:.*?$" <<< "$line"; then
|
||||||
md5sum_opkg_info=${line#*:* }
|
md5sum=${line#*:* }
|
||||||
|
printf 'md5sum=%s\n' "$md5sum"
|
||||||
elif grep -qE "^\s*Filename\s*:.*?$" <<< "$line"; then
|
elif grep -qE "^\s*Filename\s*:.*?$" <<< "$line"; then
|
||||||
filename=${line#*:* }
|
filename=${line#*:* }
|
||||||
|
printf 'filename=%s\n' "$filename"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
local __update_conf="${customer_location_dir}/update.conf"
|
log_debug "$func:${LINENO}: $package | $md5sum | $filename"
|
||||||
md5sum_repo=$(cat $__update_conf | jq -r .opkg.${package}.MD5Sum)
|
|
||||||
if ! [ -z $md5sum_repo ]; then
|
|
||||||
if [ "$md5sum_opkg_info" = "$md5sum_repo" ]; then
|
|
||||||
log_info "$func:${LINENO}: md5 $md5sum_repo OK for $package"
|
|
||||||
return 0
|
return 0
|
||||||
else
|
|
||||||
log_error "$func:${LINENO}: md5sum_repo [$md5sum_repo] "\
|
|
||||||
"!= md5sum_opkg_info [$md5sum_opkg_info] for $package"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
log_error "$func:${LINENO}: md5sum_repo empty"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# In case the new checked-out files are not correct, revert the git
|
# In case the new checked-out files are not correct, revert the git
|
||||||
@ -96,10 +91,10 @@ backup_previous_version () {
|
|||||||
|
|
||||||
exec_opkg_info () {
|
exec_opkg_info () {
|
||||||
local func="${FUNCNAME[0]}"
|
local func="${FUNCNAME[0]}"
|
||||||
log_info "$func:${LINENO}: executing info $1"
|
log_info "$func:${LINENO}: executing $opkg_command"
|
||||||
|
|
||||||
opkg_result=$(exec_opkg_command "opkg info $1")
|
opkg_result=$(exec_opkg_command "opkg info $1")
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
# make sure the keywords start with '\n'
|
# make sure the keywords start with '\n'
|
||||||
opkg_result=$(sed -E -e "s/(^.*)(Package)(.*$)/\n\2\3/g"\
|
opkg_result=$(sed -E -e "s/(^.*)(Package)(.*$)/\n\2\3/g"\
|
||||||
-e "s/(^.*)(Version)(.*$)/\1\n\2\3/g"\
|
-e "s/(^.*)(Version)(.*$)/\1\n\2\3/g"\
|
||||||
@ -114,8 +109,7 @@ exec_opkg_info () {
|
|||||||
-e "s/(^.*)(Installed-Size)(.*$)/\1\n\2\3/g"\
|
-e "s/(^.*)(Installed-Size)(.*$)/\1\n\2\3/g"\
|
||||||
-e "s/(^.*)(Section)(.*$)/\1\n\2\3/g"\
|
-e "s/(^.*)(Section)(.*$)/\1\n\2\3/g"\
|
||||||
-e "s/(^.*[^-])(Size)(.*$)/\1\n\2\3/g"\
|
-e "s/(^.*[^-])(Size)(.*$)/\1\n\2\3/g"\
|
||||||
-e "s/(^.*)(Installed-Time)(.*$)/\1\n\2\3/g"
|
-e "s/(^.*)(Installed-Time)(.*$)/\1\n\2\3/g" <<< "$opkg_result")
|
||||||
<<< "$opkg_result")
|
|
||||||
|
|
||||||
local -n output_ref=$2
|
local -n output_ref=$2
|
||||||
|
|
||||||
@ -126,12 +120,8 @@ exec_opkg_info () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log_info "$func:${LINENO}: ... done"
|
log_info "$func:${LINENO}: ... done"
|
||||||
# log_info "$func:${LINENO}: opkg_result=${output_ref[@]}"
|
log_info "$func:${LINENO}: opkg_result=${output_ref[@]}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
log_error "$func:${LINENO}: executing info $1"
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Try to install new opkg-packages (in case the are some
|
# Try to install new opkg-packages (in case the are some
|
||||||
@ -148,16 +138,11 @@ exec_opkg_no_action() {
|
|||||||
#
|
#
|
||||||
exec_opkg () {
|
exec_opkg () {
|
||||||
local func="${FUNCNAME[0]}"
|
local func="${FUNCNAME[0]}"
|
||||||
log_debug "$func:${LINENO}: executing $1"
|
log_info "$func:${LINENO}: executing $opkg_command"
|
||||||
|
|
||||||
|
local opkg_result=$(exec_opkg_command "opkg $1")
|
||||||
|
|
||||||
local __opkg_result=$(exec_opkg_command "opkg $1")
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
log_info "$func:${LINENO}: opkg_result=$__opkg_result"
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
log_error "$func:${LINENO}: error executing $1"
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# In case there was some error, re-install the previous package(s)
|
# In case there was some error, re-install the previous package(s)
|
||||||
|
Loading…
Reference in New Issue
Block a user