mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-14 21:10:11 +01:00
Sulu: Extract firmware and opconf version in preset file
This commit is contained in:
parent
7d595c7842
commit
eea5697cf7
1 changed files with 20 additions and 2 deletions
|
|
@ -4,7 +4,11 @@ if ! command -v obuspa >/dev/null 2>&1; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# source jshn shell library
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
USP_PATH="/tmp/sulu/"
|
||||
VERSIONS_PRESET_FILE="/sulu/presets/versions.json"
|
||||
|
||||
log() {
|
||||
logger -t sulu_watcher "$*"
|
||||
|
|
@ -20,10 +24,24 @@ wait_for_obuspa() {
|
|||
done
|
||||
}
|
||||
|
||||
mark_usp_ready() {
|
||||
extract_versions() {
|
||||
IOWRT_VERSION="$(obuspa -c get 'Device.DeviceInfo.FirmwareImage.[Status==Active].Name' | awk '{print $3}')"
|
||||
OPCONF_VERSION="$(obuspa -c get 'Device.X_GENEXIS_EU_OpConf.Version' | awk '{print $3}')"
|
||||
|
||||
json_init
|
||||
json_pretty
|
||||
json_add_object 'versions'
|
||||
json_add_string 'firmwareVersion' "$IOWRT_VERSION"
|
||||
json_add_string 'opconfVersion' "$OPCONF_VERSION"
|
||||
json_close_object
|
||||
json_dump > ${VERSIONS_PRESET_FILE}
|
||||
}
|
||||
|
||||
mark_sulu_ready() {
|
||||
mkdir -p "${USP_PATH}"
|
||||
touch ${USP_PATH}/ready
|
||||
}
|
||||
|
||||
wait_for_obuspa
|
||||
mark_usp_ready
|
||||
extract_versions
|
||||
mark_sulu_ready
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue