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))";;
20 echo "Invalid option: $1"
28 export CONFFILES=/tmp/sysupgrade.conffiles
29 export CONF_TAR=/tmp/sysupgrade.tgz
36 Usage: $0 [options] <image file or URL>
39 -d <delay> add a delay before rebooting
50 find /etc/config /etc/passwd /etc/group /etc/dropbear /etc/firewall.user > "$file"
55 sysupgrade_image_check="platform_check_image"
56 sysupgrade_init_conffiles="add_uci_conffiles"
61 [ -z "$(rootfs_type)" ] && {
62 echo "Cannot save config while running from ramdisk."
63 ask_bool 0 "Abort" && exit
66 run_hooks "$CONFFILES" $sysupgrade_init_conffiles
67 ask_bool 0 "Edit config file list" && vi "$CONFFILES"
69 v "Saving config files..."
70 [ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V=""
71 tar c${TAR_V}zf "$CONF_TAR" -T "$CONFFILES" 2>/dev/null
74 type platform_check_image >/dev/null 2>/dev/null || {
75 echo "Firmware upgrade is not implemented for this platform."
79 for check in $sysupgrade_image_check; do
80 ( eval "$check \"\$ARGV\"" ) || {
81 echo "Image check '$check' failed."
86 if ask_bool $SAVE_CONFIG "Keep config files over reflash"; then
92 run_hooks "" $sysupgrade_pre_upgrade
94 v "Switching to ramdisk..."
95 run_ramfs '. /etc/functions.sh; include /lib/upgrade; do_upgrade'