Ticket #3321: x86_ext2_sysupgrade_restore.patch

File x86_ext2_sysupgrade_restore.patch, 1.8 KB (added by hugelshofer2006@…, 7 years ago)

save configuration on /dev/hda1 and restore from preinit.arch

  • target/linux/x86/base-files/lib/upgrade/platform.sh

     
    1717        sync 
    1818} 
    1919 
    20 x86_prepare_ext2() { 
    21         # if we're running from ext2, we need to make sure that we have a mtd  
    22         # partition that points to the active rootfs partition. 
    23         # however this only matters if we actually need to preserve the config files 
    24         [ "$SAVE_CONFIG" -eq 1 ] || return 0 
    25         grep rootfs /proc/mtd >/dev/null || { 
    26                 echo /dev/hda2,65536,rootfs > /sys/module/block2mtd/parameters/block2mtd 
    27         } 
     20platform_refresh_partitions() { 
     21        if grep rootfs /proc/mtd >/dev/null 2>&1; then 
     22                refresh_mtd_partitions 
     23        fi 
    2824} 
    29 append sysupgrade_pre_upgrade x86_prepare_ext2 
     25 
     26platform_copy_config() { 
     27        if grep rootfs /proc/mtd >/dev/null 2>&1; then 
     28                jffs2_copy_config 
     29        else 
     30                v "Storing configuration in /dev/hda1..." 
     31                # is being restored on boot by preinit.arch 
     32                mount /dev/hda1 /mnt || return 
     33                cp "$CONF_TAR" /mnt/sysupgrade.tgz 
     34                umount /dev/hda1 
     35        fi 
     36} 
  • target/linux/x86/base-files/etc/preinit.arch

     
     1sysupgrade_restore() { 
     2        grep rootfs /proc/mtd >/dev/null 2>&1 && return 
     3        mount /dev/hda1 /mnt || return 
     4        if [ -f /mnt/sysupgrade.tgz ]; then 
     5                echo "- config restore -" 
     6                mount -o remount,rw /dev/root / 
     7                cd / 
     8                tar -xzf /mnt/sysupgrade.tgz 
     9                rm /mnt/sysupgrade.tgz 
     10        fi 
     11        umount /mnt 
     12} 
     13 
    114mount -t proc none /proc 
    215grep 'failsafe=' /proc/cmdline > /dev/null && export FAILSAFE=true 
     16 
     17sysupgrade_restore