summaryrefslogtreecommitdiffstats
path: root/updater.sh
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2011-05-18 21:51:40 -0700
committerKoushik Dutta <koushd@gmail.com>2011-05-18 21:51:40 -0700
commite983ccfc09be626ebf5615cfe59d32fe3960d18f (patch)
tree90baa24830fb24f8ffc280a91564ed1f63e4a3a6 /updater.sh
parent5283a35f48ea04f547011849ff1c5e9cb43dfba7 (diff)
downloaddevice_samsung_aries-common-e983ccfc09be626ebf5615cfe59d32fe3960d18f.zip
device_samsung_aries-common-e983ccfc09be626ebf5615cfe59d32fe3960d18f.tar.gz
device_samsung_aries-common-e983ccfc09be626ebf5615cfe59d32fe3960d18f.tar.bz2
fix formatting and some redundancy
Change-Id: I68b8d52c8df0750e5f0f1070971a3bce9476d245
Diffstat (limited to 'updater.sh')
-rw-r--r--updater.sh221
1 files changed, 113 insertions, 108 deletions
diff --git a/updater.sh b/updater.sh
index eabbed6..51630fe 100644
--- a/updater.sh
+++ b/updater.sh
@@ -11,118 +11,123 @@ export PATH=/:/sbin:/system/xbin:/system/bin:/tmp:$PATH
if /tmp/busybox test -e /dev/block/bml7 ; then
# we're running on a bml device
- # make sure sdcard is mounted
- if ! /tmp/busybox grep -q /mnt/sdcard /proc/mounts ; then
- /tmp/busybox mkdir -p /mnt/sdcard
- /tmp/busybox umount -l /dev/block/mmcblk0p1
- if ! /tmp/busybox mount -t vfat /dev/block/mmcblk0p1 /mnt/sdcard ; then
- /tmp/busybox echo "Cannot mount sdcard."
- exit 1
- fi
- fi
-
- # remove old log
- rm -rf /mnt/sdcard/cyanogenmod_bml.log
-
- # everything is logged into /sdcard/cyanogenmod.log
- exec >> /mnt/sdcard/cyanogenmod_bml.log 2>&1
-
- # make sure efs is mounted
- if ! /tmp/busybox grep -q /efs /proc/mounts ; then
- /tmp/busybox mkdir -p /efs
- /tmp/busybox umount -l /dev/block/stl3
- if ! /tmp/busybox mount -t rfs /dev/block/stl3 /efs ; then
- /tmp/busybox echo "Cannot mount efs."
- exit 1
- fi
- fi
-
- # create a backup of efs
- /tmp/busybox rm -rf /mnt/sdcard/backup/efs
- /tmp/busybox mkdir -p /mnt/sdcard/backup/efs
- /tmp/busybox cp -R /efs/ /mnt/sdcard/backup
-
- # write the package path to sdcard cyanogenmod.cfg
- if /tmp/busybox test -n "$UPDATE_PACKAGE" ; then
- PACKAGE_LOCATION=${UPDATE_PACKAGE#/mnt}
- /tmp/busybox echo "$PACKAGE_LOCATION" > /mnt/sdcard/cyanogenmod.cfg
+ # make sure sdcard is mounted
+ if ! /tmp/busybox grep -q /mnt/sdcard /proc/mounts ; then
+ /tmp/busybox mkdir -p /mnt/sdcard
+ /tmp/busybox umount -l /dev/block/mmcblk0p1
+ if ! /tmp/busybox mount -t vfat /dev/block/mmcblk0p1 /mnt/sdcard ; then
+ /tmp/busybox echo "Cannot mount sdcard."
+ exit 1
fi
+ fi
- # write new kernel to boot partition
- /tmp/flash_image boot /tmp/boot.img
-
- /sbin/reboot now
- exit 0
+ # remove old log
+ rm -rf /mnt/sdcard/cyanogenmod_bml.log
+
+ # everything is logged into /sdcard/cyanogenmod.log
+ exec >> /mnt/sdcard/cyanogenmod_bml.log 2>&1
+
+ # make sure efs is mounted
+ if ! /tmp/busybox grep -q /efs /proc/mounts ; then
+ /tmp/busybox mkdir -p /efs
+ /tmp/busybox umount -l /dev/block/stl3
+ if ! /tmp/busybox mount -t rfs /dev/block/stl3 /efs ; then
+ /tmp/busybox echo "Cannot mount efs."
+ exit 1
+ fi
+ fi
+
+ # create a backup of efs
+ if /tmp/busybox test -e /mnt/sdcard/backup/efs ; then
+ /tmp/busybox/mv /mnt/sdcard/backup/efs /mnt/sdcard/backup/efs-$$
+ fi
+ /tmp/busybox rm -rf /mnt/sdcard/backup/efs
+
+ /tmp/busybox mkdir -p /mnt/sdcard/backup/efs
+ /tmp/busybox cp -R /efs/ /mnt/sdcard/backup
+
+ # write the package path to sdcard cyanogenmod.cfg
+ if /tmp/busybox test -n "$UPDATE_PACKAGE" ; then
+ PACKAGE_LOCATION=${UPDATE_PACKAGE#/mnt}
+ /tmp/busybox echo "$PACKAGE_LOCATION" > /mnt/sdcard/cyanogenmod.cfg
+ fi
+
+ # write new kernel to boot partition
+ /tmp/flash_image boot /tmp/boot.img
+ /tmp/busybox sync
+
+ /sbin/reboot now
+ exit 0
elif /tmp/busybox test -e /dev/block/mtdblock0 ; then
# we're running on a mtd device
- # make sure sdcard is mounted
- /tmp/busybox mkdir -p /sdcard
-
- if ! /tmp/busybox grep -q /sdcard /proc/mounts ; then
- /tmp/busybox umount -l /dev/block/mmcblk0p1
- if ! /tmp/busybox mount -t vfat /dev/block/mmcblk0p1 /sdcard ; then
- /tmp/busybox echo "Cannot mount sdcard."
- exit 1
- fi
- fi
-
- # remove old log
- rm -rf /sdcard/cyanogenmod_mtd.log
-
- # everything is logged into /sdcard/cyanogenmod.log
- exec >> /sdcard/cyanogenmod_mtd.log 2>&1
-
- # if a cyanogenmod.cfg exists, then this is a first time install
- # let's format the volumes and restore radio and efs
- if ! /tmp/busybox test -e /sdcard/cyanogenmod.cfg ; then
- exit 1
- fi
- # remove the cyanogenmod.cfg to prevent this from looping
- /tmp/busybox rm -f /sdcard/cyanogenmod.cfg
-
- # unmount, format and mount system
- /tmp/busybox umount -l /system
- /tmp/erase_image system
- /tmp/busybox mount -t yaffs2 /dev/block/mtdblock2 /system
-
- # unmount and format cache
- /tmp/busybox umount -l /cache
- /tmp/erase_image cache
-
- # unmount and format data
- tmp/make_ext4fs -b 4096 -g 32768 -i 8192 -I 256 -a /data /dev/block/mmcblk0p2
-
- # unmount and format datadata
- /tmp/busybox umount -l /datadata
- /tmp/erase_image datadata
-
- # flash radio image
- /tmp/erase_image radio
- /tmp/flash_image radio /tmp/modem.bin
-
- # restore efs backup
- if /tmp/busybox test -e /sdcard/backup/efs/nv_data.bin ; then
- /tmp/busybox umount -l /efs
- /tmp/erase_image efs
- /tmp/busybox mkdir -p /efs
-
- if ! /tmp/busybox grep -q /efs /proc/mounts ; then
- if ! /tmp/busybox mount -t yaffs2 /dev/block/mtdblock4 /efs ; then
- /tmp/busybox echo "Cannot mount efs."
- exit 1
- fi
- fi
-
- /tmp/busybox cp -R /sdcard/backup/efs /
- /tmp/busybox umount -l /efs
- else
- /tmp/busybox echo "Cannot restore efs."
- fi
-
- # flash boot image
- /tmp/bml_over_mtd.sh boot 72 reservoir 2004 /tmp/boot.img
-
- exit 0
+ # make sure sdcard is mounted
+ /tmp/busybox mkdir -p /sdcard
+
+ if ! /tmp/busybox grep -q /sdcard /proc/mounts ; then
+ /tmp/busybox umount -l /dev/block/mmcblk0p1
+ if ! /tmp/busybox mount -t vfat /dev/block/mmcblk0p1 /sdcard ; then
+ /tmp/busybox echo "Cannot mount sdcard."
+ exit 1
+ fi
+ fi
+
+ # remove old log
+ rm -rf /sdcard/cyanogenmod_mtd.log
+
+ # everything is logged into /sdcard/cyanogenmod.log
+ exec >> /sdcard/cyanogenmod_mtd.log 2>&1
+
+ # if a cyanogenmod.cfg exists, then this is a first time install
+ # let's format the volumes and restore radio and efs
+ if ! /tmp/busybox test -e /sdcard/cyanogenmod.cfg ; then
+ exit 1
+ fi
+ # remove the cyanogenmod.cfg to prevent this from looping
+ /tmp/busybox rm -f /sdcard/cyanogenmod.cfg
+
+ # unmount, format and mount system
+ /tmp/busybox umount -l /system
+ /tmp/erase_image system
+ /tmp/busybox mount -t yaffs2 /dev/block/mtdblock2 /system
+
+ # unmount and format cache
+ /tmp/busybox umount -l /cache
+ /tmp/erase_image cache
+
+ # unmount and format data
+ tmp/make_ext4fs -b 4096 -g 32768 -i 8192 -I 256 -a /data /dev/block/mmcblk0p2
+
+ # unmount and format datadata
+ /tmp/busybox umount -l /datadata
+ /tmp/erase_image datadata
+
+ # flash radio image
+ /tmp/erase_image radio
+ /tmp/flash_image radio /tmp/modem.bin
+
+ # restore efs backup
+ if /tmp/busybox test -e /sdcard/backup/efs/nv_data.bin ; then
+ /tmp/busybox umount -l /efs
+ /tmp/erase_image efs
+ /tmp/busybox mkdir -p /efs
+
+ if ! /tmp/busybox grep -q /efs /proc/mounts ; then
+ if ! /tmp/busybox mount -t yaffs2 /dev/block/mtdblock4 /efs ; then
+ /tmp/busybox echo "Cannot mount efs."
+ exit 1
+ fi
+ fi
+
+ /tmp/busybox cp -R /sdcard/backup/efs /
+ /tmp/busybox umount -l /efs
+ else
+ /tmp/busybox echo "Cannot restore efs."
+ fi
+
+ # flash boot image
+ /tmp/bml_over_mtd.sh boot 72 reservoir 2004 /tmp/boot.img
+
+ exit 0
fi