Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:advanced:sysupgrade_extras [2023/04/27 17:12] – [Instructions] vgaetera | docs:guide-user:advanced:sysupgrade_extras [2023/12/01 01:36] – [Instructions] minimize write operations vgaetera | ||
|---|---|---|---|
| Line 10: | Line 10: | ||
| * Download the firmware image and verify its checksum. | * Download the firmware image and verify its checksum. | ||
| * Allow to force/skip upgrade matching the current release. | * Allow to force/skip upgrade matching the current release. | ||
| + | * Save/ | ||
| ===== Options ===== | ===== Options ===== | ||
| Line 15: | Line 16: | ||
| | '' | | '' | ||
| | '' | | '' | ||
| + | | '' | ||
| + | | '' | ||
| ===== Instructions ===== | ===== Instructions ===== | ||
| Line 25: | Line 28: | ||
| case " | case " | ||
| (-A|-U) sysupgrade_proc " | (-A|-U) sysupgrade_proc " | ||
| + | (-S) service_save ;; | ||
| + | (-R) service_restore ;; | ||
| (*) command sysupgrade " | (*) command sysupgrade " | ||
| esac | esac | ||
| Line 42: | Line 47: | ||
| local SYSUP_TYPE=" | local SYSUP_TYPE=" | ||
| local SYSUP_EFI=" | local SYSUP_EFI=" | ||
| - | local SYSUP_JSON=" | ||
| local SYSUP_IMG=" | local SYSUP_IMG=" | ||
| sysupgrade " | sysupgrade " | ||
| Line 51: | Line 55: | ||
| case " | case " | ||
| (snapshot) echo " | (snapshot) echo " | ||
| - | (*) uclient-fetch | + | (*) wget -O - \ |
| " | " | ||
| | jsonfilter -e " | | jsonfilter -e " | ||
| Line 64: | Line 68: | ||
| sysupgrade_rev() { | sysupgrade_rev() { | ||
| - | uclient-fetch | + | wget -O - " |
| } | } | ||
| Line 97: | Line 101: | ||
| } | } | ||
| - | sysupgrade_json() { | + | sysupgrade_img() { |
| - | uclient-fetch | + | wget -O - " |
| - | | jsonfilter -e " | + | | jsonfilter -e " |
| - | [' | + | [' |
| - | && | + | && |
| } | } | ||
| - | sysupgrade_img() { | + | service_save() { |
| - | jsonfilter -e "$[' | + | local SVC_NAME="$(ls / |
| - | ${SYSUP_JSON} | + | local SVC_STATE |
| + | for SVC_NAME in ${SVC_NAME} | ||
| + | do if command service " | ||
| + | then SVC_STATE=" | ||
| + | else SVC_STATE=" | ||
| + | fi | ||
| + | uci -q batch << EOI | ||
| + | set system.service=' | ||
| + | del_list system.service.enable=' | ||
| + | del_list system.service.disable=' | ||
| + | add_list system.service.' | ||
| EOI | EOI | ||
| + | done | ||
| + | uci commit system | ||
| + | } | ||
| + | |||
| + | service_restore() { | ||
| + | local SVC_NAME | ||
| + | local SVC_STATE=" | ||
| + | for SVC_STATE in ${SVC_STATE} | ||
| + | do SVC_NAME=" | ||
| + | for SVC_NAME in ${SVC_NAME} | ||
| + | do command service " | ||
| + | done | ||
| + | done | ||
| } | } | ||
| EOF | EOF | ||
| . / | . / | ||
| + | |||
| + | # Configure startup scripts | ||
| + | cat << " | ||
| + | if [ ! -e / | ||
| + | then . / | ||
| + | sysupgrade -R | ||
| + | touch / | ||
| + | fi | ||
| + | exit 1 | ||
| + | EOF | ||
| + | cat << " | ||
| + | / | ||
| + | EOF | ||
| </ | </ | ||
| Line 124: | Line 164: | ||
| ===== Automated ===== | ===== Automated ===== | ||
| <code bash> | <code bash> | ||
| - | uclient-fetch -O sysupgrade-extras.sh " | + | wget -U "" |
| . ./ | . ./ | ||
| </ | </ | ||