-
Notifications
You must be signed in to change notification settings - Fork 42
/
updater.sh
103 lines (85 loc) · 2.84 KB
/
updater.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/tmp/busybox sh
#
# Filsystem Conversion Script for Samsung Galaxy SL
# (c) 2011 by Teamhacksung
#
set -x
export PATH=/:/sbin:/system/xbin:/system/bin:/tmp:$PATH
# create directories
/tmp/busybox mkdir -p /system
/tmp/busybox mkdir -p /cache
/tmp/busybox mkdir -p /data
/tmp/busybox mkdir -p /datadata
/tmp/busybox mkdir -p /efs
# 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.log
# everything is logged into /sdcard/cyanogenmod.log
exec >> /mnt/sdcard/cyanogenmod.log 2>&1
# efs backup
if ! /tmp/busybox test -e /sdcard/backup/efs/nv_data.bin ; then
# 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 2
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
fi
#
# filesystem conversion
#
# format system if not ext4
if ! /tmp/busybox mount -t ext4 /dev/block/stl9 /system ; then
/tmp/busybox umount /system
/tmp/make_ext4fs -b 4096 -g 32768 -i 8192 -I 256 -a /data /dev/block/stl9
fi
# format datadata if not ext4
if ! /tmp/busybox mount -t ext4 /dev/block/stl10 /datadata ; then
/tmp/busybox umount /datadata
/tmp/make_ext4fs -b 4096 -g 32768 -i 8192 -I 256 -a /data /dev/block/stl10
fi
# format cache if not ext4
if ! /tmp/busybox mount -t ext4 /dev/block/stl11 /cache ; then
/tmp/busybox umount /cache
/tmp/make_ext4fs -b 4096 -g 32768 -i 8192 -I 256 -a /data /dev/block/stl11
fi
# format data if not ext4
if ! /tmp/busybox mount -t ext4 /dev/block/mmcblk0p3 /data ; then
/tmp/busybox umount /data
/tmp/make_ext4fs -b 4096 -g 32768 -i 8192 -I 256 -a /data /dev/block/mmcblk0p3
fi
# restore efs backup
#if /tmp/busybox test -e /sdcard/backup/efs/nv_data.bin ; then
# /tmp/busybox umount -l /efs
# /tmp/busybox mkdir -p /efs
# if ! /tmp/busybox grep -q /efs /proc/mounts ; then
# if ! /tmp/busybox mount -t ext4 /dev/block/stl3 /efs ; then
# /tmp/busybox echo "Cannot mount efs."
# exit 8
# fi
# fi
# /tmp/busybox cp -R /sdcard/backup/efs /
# /tmp/busybox umount -l /efs
#else
# /tmp/busybox echo "Cannot restore efs."
# exit 9
#fi
exit 0