flasher: revise autoboot handling
[pandora-misc.git] / flasher / rootfs / etc / updater.sh
index 202f045..124c283 100755 (executable)
@@ -25,19 +25,6 @@ cleanup()
        fi
 }
 
-wait_for_file()
-{
-       for a in `seq 10`
-       do
-               if test -e "$1"
-               then
-                       return 0
-               fi
-               sleep .5
-       done
-       return 1
-}
-
 
 mkdir /mnt/ubifs 2> /dev/null || true
 
@@ -155,10 +142,6 @@ handle_kernels()
                return 0
        fi
 
-       # presence of uImage* is a sign that we can wipe whole boot partition,
-       # but first get rid of potentially bad autoboot.txt
-       rm -f /mnt/ubifs/autoboot.txt
-
        for kernel in $kernels
        do
                if ! cmp $kernel /mnt/ubifs/$kernel  2> /dev/null
@@ -180,6 +163,17 @@ handle_kernels()
                        cp -a bootmenu.txt /mnt/ubifs/bootmenu.txt || return 1
                fi
        fi
+       if [ -e autoboot.txt ]
+       then
+               if ! cmp autoboot.txt /mnt/ubifs/autoboot.txt  2> /dev/null
+               then
+                       log "updating autoboot.txt"
+                       cp -a autoboot.txt /mnt/ubifs/autoboot.txt || return 1
+               fi
+       else
+               # get rid of potentially bad autoboot.txt
+               rm -f /mnt/ubifs/autoboot.txt
+       fi
 }
 
 ubiattach /dev/ubi_ctrl -m 3 || true