mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
fwbank: add copy_config method to fwbank API
Implemented copy_config handler to create and copy a system upgrade backup
This commit is contained in:
parent
2a1323bfd0
commit
b6e5749b7f
1 changed files with 24 additions and 1 deletions
|
|
@ -22,7 +22,7 @@ fwbank_get_bootbank() {
|
|||
|
||||
case "$1" in
|
||||
list)
|
||||
echo '{ "dump" : {}, "set_bootbank" : {"bank":32} , "upgrade": {"path":"String","auto_activate":true,"bank":32,"keep_settings":true}}'
|
||||
echo '{ "dump" : {}, "set_bootbank" : {"bank":32}, "copy_config" : {}, "upgrade": {"path":"String","auto_activate":true,"bank":32,"keep_settings":true}}'
|
||||
;;
|
||||
call)
|
||||
case "$2" in
|
||||
|
|
@ -124,6 +124,29 @@ case "$1" in
|
|||
echo '{"success": false}'
|
||||
fi
|
||||
;;
|
||||
copy_config)
|
||||
if [ -z "$UPGRADE_BACKUP" ]; then
|
||||
UPGRADE_BACKUP=/tmp/sysupgrade.tgz
|
||||
fi
|
||||
|
||||
ret=0
|
||||
|
||||
sysupgrade -b "$UPGRADE_BACKUP" || ret=1
|
||||
|
||||
if [ "$ret" -eq 0 ]; then
|
||||
if command -v platform_copy_config >/dev/null 2>&1; then
|
||||
platform_copy_config 1>&2 || ret=1
|
||||
else
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ret" -eq 0 ]; then
|
||||
echo '{"success": true}'
|
||||
else
|
||||
echo '{"success": false}'
|
||||
fi
|
||||
;;
|
||||
upgrade)
|
||||
# Read the JSON object provided for the arguments
|
||||
read -r input
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue