5 RAMFS_COPY_BIN
="" # extra programs for temporary ramfs root
6 RAMFS_COPY_DATA
="" # extra data files
17 -i) export INTERACTIVE
=1;;
18 -d) export DELAY
="$2"; shift;;
19 -v) export VERBOSE
="$(($VERBOSE + 1))";;
20 -q) export VERBOSE
="$(($VERBOSE - 1))";;
21 -n) export SAVE_CONFIG
=0;;
22 -c) export SAVE_OVERLAY
=1;;
23 -f) export CONF_IMAGE
="$2"; shift;;
25 echo "Invalid option: $1"
33 export CONFFILES
=/tmp
/sysupgrade.conffiles
34 export CONF_TAR
=/tmp
/sysupgrade.tgz
41 Usage: $0 [options] <image file or URL>
44 -d <delay> add a delay before rebooting
45 -f <config> restore configuration from .tar.gz (file or url)
47 -c attempt to preserve all changed files in /etc/
48 -n do not save configuration over reflash
58 ( find /etc
/config
/etc
/passwd
/etc
/group
/etc
/dropbear \
59 /etc
/firewall.user
/etc
/rc.
local -type f
;
60 opkg list-changed-conffiles
) |
sort -u > "$file"
66 find /overlay
/etc
/ -type f |
sed \
67 -e 's,^/overlay/,/,' \
68 -e '\,/META_[a-zA-Z0-9]*$,d' \
69 -e '\,/functions.sh$,d' \
70 -e '\,/[^/]*-opkg$,d' \
76 sysupgrade_image_check
="platform_check_image"
77 [ $SAVE_OVERLAY = 0 -o ! -d /overlay
/etc
] && \
78 sysupgrade_init_conffiles
="add_uci_conffiles" || \
79 sysupgrade_init_conffiles
="add_overlayfiles"
84 [ -z "$(rootfs_type)" ] && {
85 echo "Cannot save config while running from ramdisk."
86 ask_bool
0 "Abort" && exit
89 run_hooks
"$CONFFILES" $sysupgrade_init_conffiles
90 ask_bool
0 "Edit config file list" && vi
"$CONFFILES"
92 v
"Saving config files..."
93 [ "$VERBOSE" -gt 1 ] && TAR_V
="v" || TAR_V
=""
94 tar c
${TAR_V}zf
"$CONF_TAR" -T "$CONFFILES" 2>/dev
/null
97 type platform_check_image
>/dev
/null
2>/dev
/null ||
{
98 echo "Firmware upgrade is not implemented for this platform."
102 for check
in $sysupgrade_image_check; do
103 ( eval "$check \"\$ARGV\"" ) ||
{
104 echo "Image check '$check' failed."
109 if [ -n "$CONF_IMAGE" ]; then
110 case "$(get_magic_word $CONF_IMAGE cat)" in
114 echo "Invalid config file. Please use only .tar.gz files"
118 get_image
"$CONF_IMAGE" "cat" > "$CONF_TAR"
120 elif ask_bool
$SAVE_CONFIG "Keep config files over reflash"; then
126 run_hooks
"" $sysupgrade_pre_upgrade
128 if [ -n "$(rootfs_type)" ]; then
129 v
"Switching to ramdisk..."
130 run_ramfs
'. /etc/functions.sh; include /lib/upgrade; do_upgrade'