5 RAMFS_COPY_BIN
="" # extra programs for temporary ramfs root
6 RAMFS_COPY_DATA
="" # extra data files
15 -i) export INTERACTIVE
=1;;
16 -d) export DELAY
="$2"; shift;;
17 -v) export VERBOSE
="$(($VERBOSE + 1))";;
18 -q) export VERBOSE
="$(($VERBOSE - 1))";;
19 -n) export SAVE_CONFIG
=0;;
20 -f) export CONF_IMAGE
="$2"; shift;;
22 echo "Invalid option: $1"
30 export CONFFILES
=/tmp
/sysupgrade.conffiles
31 export CONF_TAR
=/tmp
/sysupgrade.tgz
38 Usage: $0 [options] <image file or URL>
41 -d <delay> add a delay before rebooting
42 -f <config> restore configuration from .tar.gz (file or url)
44 -n do not save configuration over reflash
54 find /etc
/config
/httpd
/etc
/config
/network
/etc
/config
/system
/etc
/config
/wireless
/etc
/config
/fstab \
55 /etc
/firewall.user
/etc
/rc.
local /etc
/passwd
/etc
/group
/etc
/hosts
-type f
> "$file"
56 find `cat /usr/lib/opkg/status | grep "Conffiles:" | grep -v -e "/etc/banner" -e "/etc/opkg.conf" |cut -d':' -f2` -type f
>> "$file"
61 sysupgrade_image_check
="platform_check_image"
62 sysupgrade_init_conffiles
="add_uci_conffiles"
67 [ -z "$(rootfs_type)" ] && {
68 echo "Cannot save config while running from ramdisk."
69 ask_bool
0 "Abort" && exit
72 run_hooks
"$CONFFILES" $sysupgrade_init_conffiles
73 ask_bool
0 "Edit config file list" && vi
"$CONFFILES"
75 v
"Saving config files..."
76 [ "$VERBOSE" -gt 1 ] && TAR_V
="v" || TAR_V
=""
77 tar c
${TAR_V}zf
"$CONF_TAR" -T "$CONFFILES" 2>/dev
/null
80 type platform_check_image
>/dev
/null
2>/dev
/null ||
{
81 echo "Firmware upgrade is not implemented for this platform."
85 for check
in $sysupgrade_image_check; do
86 ( eval "$check \"\$ARGV\"" ) ||
{
87 echo "Image check '$check' failed."
92 if [ -n "$CONF_IMAGE" ]; then
93 case "$(get_magic_word $CONF_IMAGE cat)" in
97 echo "Invalid config file. Please use only .tar.gz files"
101 get_image
"$CONF_IMAGE" "cat" > "$CONF_TAR"
103 elif ask_bool
$SAVE_CONFIG "Keep config files over reflash"; then
109 run_hooks
"" $sysupgrade_pre_upgrade
111 if [ -n "$(rootfs_type)" ]; then
112 v
"Switching to ramdisk..."
113 run_ramfs
'. /etc/functions.sh; include /lib/upgrade; do_upgrade'