Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

1.7.0.1 version of scripts

  • Loading branch information...
commit 7055e8d9f26b2f0c32d153aa4993e5b7403804e9 1 parent 963ea79
Magnus Eriksson packetlss authored

Showing 6 changed files with 192 additions and 50 deletions. Show diff stats Hide diff stats

  1. +160 28 bart
  2. +3 3 fix_permissions
  3. +3 3 switchrom
  4. +1 1  um
  5. +13 13 utility
  6. +12 2 wipe
188 bart
... ... @@ -1,11 +1,13 @@
1 1 #!/sbin/sh
2   -VER="1.0.1"
  2 +VER="1.3.1"
3 3 MYFOLDER="bart"
4 4 SDCARD="/sdcard"
5 5 EXTPART="/system/sd"
  6 +CACHEPART="/cache"
6 7 NANDSH="nandroid-mobile.sh"
7 8 NANDLOG="nandroid.log"
8   -RECOVERY="foo"
  9 +CONFIGFILE="/system/sd/bart.config"
  10 +
9 11 alias _GREP_="busybox grep"
10 12 alias _AWK_="busybox awk"
11 13 alias _MOUNT_="busybox mount"
@@ -29,6 +31,7 @@ myecho=":"
29 31 ni=0
30 32 reboot=0
31 33 shutdown=0
  34 +docache=1
32 35
33 36 do_exit()
34 37 {
@@ -58,6 +61,7 @@ print_usage()
58 61 echo " -n --nandroid_only, use with -r or -s"
59 62 echo " -v --version"
60 63 echo " --verbose, verbose output during nandroid"
  64 + echo " --nocache, ignore the cache partition"
61 65 echo " --norecovery, ignore recovery partition"
62 66 echo " --noboot, ignore boot partition"
63 67 echo " --nodata, ignore data partition"
@@ -126,12 +130,68 @@ read_rom()
126 130 fi
127 131 }
128 132
  133 +# make sure /system/sd and /sdcard are mounted
  134 +
  135 +$myecho "check for /system/sd or /sd-etc"
  136 +
  137 +if [ -e "/sd-ext" ]
  138 +then
  139 + EXTPART="/sd-ext"
  140 + CONFIGFILE="/sd-ext/bart.config"
  141 +else
  142 + if [ -e "/system/sd" ]
  143 + then
  144 + EXTPART="/system/sd"
  145 + CONFIGFILE="/sd-ext/bart.config"
  146 + fi
  147 +fi
  148 +
  149 +$myecho "checking mount points..."
  150 +for i in ${SDCARD} ${EXTPART}
  151 +do
  152 + if [ "$i" == ${EXTPART} ] && [ $nandroid_only -eq 1 ]
  153 + then
  154 + $myecho "nandroid_only chosed ext partition not needed..."
  155 + else
  156 + $myecho "checking whether $i is mounted..."
  157 + mounted=`_GREP_ $i /proc/mounts | _AWK_ '{print $2}'`
  158 + if [ "$mounted" != "$i" ]
  159 + then
  160 + $myecho "$i is not mounted. mounting $i now..."
  161 + # not mounted, mount it
  162 + _MOUNT_ $i
  163 + if [ $? -ne 0 ]
  164 + then
  165 + echo "Unable to mount $i ..."
  166 + echo ""
  167 + do_exit 5
  168 + fi
  169 + fi
  170 + $myecho "$i is mounted..."
  171 + fi
  172 +done
  173 +
  174 +
129 175 # args processing
130 176 if [ $# -lt 1 ]
131 177 then
132 178 print_usage
133 179 exit 1
134 180 fi
  181 +
  182 +
  183 +
  184 +# check for config file
  185 +if [ -f $CONFIGFILE ]
  186 +then
  187 + $myecho "found $CONFIGFILE"
  188 +
  189 + . $CONFIGFILE
  190 +
  191 +fi
  192 +
  193 +
  194 +# get args from command line
135 195 while [ -n "$1" ]
136 196 do
137 197 case "$1" in
@@ -177,6 +237,11 @@ do
177 237 shutdown=1
178 238 shift
179 239 ;;
  240 + --nocache)
  241 + $myecho "setting cache option..."
  242 + docache=0
  243 + shift
  244 + ;;
180 245 -a|--app_s)
181 246 $myecho "setting app_s option..."
182 247 app_s=1
@@ -281,31 +346,6 @@ do
281 346 esac
282 347 done
283 348
284   -# make sure /system/sd and /sdcard are mounted
285   -$myecho "checking mount points..."
286   -for i in ${SDCARD} ${EXTPART}
287   -do
288   - if [ "$i" == ${EXTPART} ] && [ $nandroid_only -eq 1 ]
289   - then
290   - $myecho "nandroid_only chosed ext partition not needed..."
291   - else
292   - $myecho "checking whether $i is mounted..."
293   - mounted=`_GREP_ $i /proc/mounts | _AWK_ '{print $2}'`
294   - if [ "$mounted" != "$i" ]
295   - then
296   - $myecho "$i is not mounted. mounting $i now..."
297   - # not mounted, mount it
298   - _MOUNT_ $i
299   - if [ $? -ne 0 ]
300   - then
301   - echo "Unable to mount $i ..."
302   - echo ""
303   - do_exit 5
304   - fi
305   - fi
306   - $myecho "$i is mounted..."
307   - fi
308   -done
309 349
310 350 myhome="${SDCARD}/${MYFOLDER}"
311 351 rompath="${myhome}/${romname}"
@@ -322,7 +362,7 @@ case "$cmd" in
322 362 fi
323 363 rompath="${myhome}/${romname}"
324 364 nandfolder="${rompath}/nandroid"
325   -
  365 +
326 366 if [ $nandroid_only -eq 1 ]
327 367 then
328 368 echo ""
@@ -456,6 +496,63 @@ case "$cmd" in
456 496 do_exit 30
457 497 fi
458 498
  499 + if [ $docache -eq 1 ]
  500 + then
  501 + compressed=0
  502 + $myecho "checking for cache partition backup..."
  503 + if [ -e "${rompath}/cache-backup.tar.gz" ]
  504 + then
  505 + $myecho "compressed cache-backup found..."
  506 + compressed=1
  507 + else
  508 + if [ ! -e "${rompath}/cache-backup.tar" ]
  509 + then
  510 + echo ""
  511 + echo "cache-backup not fount for ROM ${romname}."
  512 + echo ""
  513 + do_exit 29
  514 + fi
  515 + $myecho "uncompressed cache-backup found..."
  516 + fi
  517 + #proceed with restoring cache
  518 + echo "Cleaning up /cache..."
  519 + cd ${CACHEPART}
  520 + _RM_ -rf `_LS_ -d * | grep -v -e "^recovery" -e "^lost+found" 2>&1` > /dev/null 2>&1
  521 +
  522 + if [ $compressed -eq 1 ]
  523 + then
  524 + echo "Restoring compressed cache-backup in ${CACHEPART} ..."
  525 + cd ${CACHEPART}
  526 + gzip -c -d "${rompath}/cache-backup.tar.gz" | _TAR_ xpf -
  527 + if [ $? -ne 0 ]
  528 + then
  529 + echo ""
  530 + echo "Error occurred during restoration of cache data..."
  531 + echo "tar/gzip operation failed."
  532 + echo "Do you have enough space on the /sdcard?"
  533 + echo ""
  534 + do_exit 28
  535 + fi
  536 + cd /
  537 + else
  538 + echo "Restoring cache-backup in ${CACHEPART} ..."
  539 + cd ${CACHEPART}
  540 + _TAR_ xpf "${rompath}/cache-backup.tar"
  541 + if [ $? -ne 0 ]
  542 + then
  543 + echo ""
  544 + echo "Error occurred during restoration of cache-backup ..."
  545 + echo "tar operation failed."
  546 + echo "Do you have enough space on the /sdcard?"
  547 + echo ""
  548 + do_exit 27
  549 + fi
  550 + cd /
  551 + fi
  552 +
  553 +
  554 + fi
  555 +
459 556 if [ $nandroid_only -eq 0 ]
460 557 then
461 558 compressed=0
@@ -606,6 +703,23 @@ case "$cmd" in
606 703
607 704 if [ $compressed -eq 1 ]
608 705 then
  706 + if [ $docache -eq 1 ]
  707 + then
  708 + $myecho "storing cache..."
  709 + cd ${CACHEPART}
  710 + _TAR_ cpf - `_LS_ -d * | grep -v -e "^lost+found" -e "^recovery" 2>/dev/null` | gzip -1 > "${rompath}/cache-backup.tar.gz"
  711 + if [ $? -ne 0 ]
  712 + then
  713 + echo ""
  714 + echo "Error occurred during storing of cache data..."
  715 + echo "tar/gzip operation failed."
  716 + echo "Do you have enough space on the /sdcard?"
  717 + echo ""
  718 + do_exit 15
  719 + fi
  720 +
  721 + fi
  722 +
609 723 if [ $nandroid_only -eq 0 ]
610 724 then
611 725 # store the apps partition data
@@ -661,6 +775,24 @@ case "$cmd" in
661 775 fi
662 776 fi
663 777 else
  778 + if [ $docache -eq 1 ]
  779 + then
  780 + $myecho "storing cache..."
  781 + cd ${CACHEPART}
  782 + _TAR_ cpf "${rompath}/cache-backup.tar" `_LS_ -d * | grep -v -e "^lost+found" -e "^recovery" 2>/dev/null`
  783 + if [ $? -ne 0 ]
  784 + then
  785 + echo ""
  786 + echo "Error occurred during storing of cache data..."
  787 + echo "tar/gzip operation failed."
  788 + echo "Do you have enough space on the /sdcard?"
  789 + echo ""
  790 + do_exit 15
  791 + fi
  792 +
  793 + fi
  794 +
  795 +
664 796 if [ $nandroid_only -eq 0 ]
665 797 then
666 798 # store the apps partition data
6 fix_permissions
@@ -186,8 +186,8 @@ fp_start()
186 186 DATAMOUNT=1
187 187 fi
188 188
189   - if $TEST -e /dev/block/mmcblk0p2 && $TEST $( $GREP -c " /system/sd " "/proc/mounts" ) -eq 0; then
190   - $MOUNT /system/sd > /dev/null 2>&1
  189 + if $TEST -e /dev/block/mmcblk0p2 && $TEST $( $GREP -c " /sd-ext " "/proc/mounts" ) -eq 0; then
  190 + $MOUNT /sd-ext > /dev/null 2>&1
191 191 SYSSDMOUNT=1
192 192 fi
193 193 fi
@@ -445,7 +445,7 @@ fp_end()
445 445 fi
446 446
447 447 if $TEST $SYSSDMOUNT -eq 1; then
448   - $UMOUNT /system/sd > /dev/null 2>&1
  448 + $UMOUNT /sd-ext > /dev/null 2>&1
449 449 fi
450 450
451 451 if $TEST $SYSMOUNT -eq 1; then
6 switchrom
@@ -2,7 +2,7 @@
2 2 VER="1.1"
3 3 MYFOLDER="switchROM"
4 4 SDCARD="/sdcard"
5   -EXTPART="/system/sd"
  5 +EXTPART="/sd-ext"
6 6 NANDSH="nandroid-mobile.sh"
7 7 NANDLOG="nandroid.log"
8 8 alias _GREP_="busybox grep"
@@ -148,7 +148,7 @@ do
148 148 esac
149 149 done
150 150
151   -# make sure /system/sd and /sdcard are mounted
  151 +# make sure /sd-ext and /sdcard are mounted
152 152 for i in ${SDCARD} ${EXTPART}
153 153 do
154 154 mounted=`_GREP_ $i /proc/mounts | _AWK_ '{print $2}'`
@@ -254,7 +254,7 @@ case "$cmd" in
254 254 fi
255 255
256 256 # proceed with the restoration process
257   - echo "Cleaning up /system/sd ..."
  257 + echo "Cleaning up /sd-ext ..."
258 258 _RM_ -rf ${EXTPART}/app* ${EXTPART}/dalv* > /dev/null 2>&1
259 259 if [ $compressed -eq 1 ]
260 260 then
2  um
@@ -2,7 +2,7 @@
2 2
3 3 echo "" > /sys/devices/platform/usb_mass_storage/lun0/file
4 4
5   -LIST=`mount | grep "^/" | grep "type yaffs*\|vfat\|ext*" | grep "system*\|data\|sdcard*" | cut -d\ -f 3 | sort -rn`
  5 +LIST=`mount | grep "^/" | grep "type yaffs*\|vfat\|ext*" | grep "system*\|data*\|sd-ext*\|sdcard*" | cut -d\ -f 3 | sort -rn`
6 6
7 7 if [ "$LIST" != "" ]; then
8 8 for i in $LIST
26 utility
@@ -10,13 +10,13 @@ clear
10 10 echo "More Utilities by BKMO"
11 11 echo ""
12 12 echo "[1] Convert ext3 > ext4 no data loss"
13   -echo "[2] Fix Permissions 2.03 experimental"
  13 +echo "[2] Fix Permissions 2.03"
14 14 echo "[3] Backup APPS on ext to FAT32"
15 15 echo "[4] Restore APPS from FAT32 to ext"
16 16 echo "[5] Partition SD 3 partitions (can set sizes)"
17 17 echo "[6] Fix auto-rotate problems"
18   -echo "[7] Run BART 1.0.1 Backup"
19   -echo "[8] Run BART 1.0.1 Restore"
  18 +echo "[7] Run BART 1.3.1 Backup"
  19 +echo "[8] Run BART 1.3.1 Restore"
20 20 echo "[9] Reset/delete Battery Stats"
21 21 echo "[q] Quit to Console Prompt"
22 22 echo "[b] Boot me out of here! (reboot)"
@@ -43,7 +43,7 @@ fi
43 43 if [ $text = "1" ]; then
44 44 echo "Converting to EXT4"
45 45 if [ -e /dev/block/mmcblk0p2 ]; then
46   - umount /system/sd > /dev/null 2>&1;
  46 + umount /sd-ext > /dev/null 2>&1;
47 47 set -e;
48 48 tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2;
49 49 e2fsck -fpDC0 /dev/block/mmcblk0p2;
@@ -68,7 +68,7 @@ fi
68 68 if [ $text = "3" ]; then
69 69 echo "Backing up EXT Apps to SDcard"
70 70 if [ -e /dev/block/mmcblk0p2 ]; then
71   - mount /system/sd > /dev/null 2>&1
  71 + mount /sd-ext > /dev/null 2>&1
72 72 fi
73 73
74 74 if [ -e /dev/block/mmcblk0p1 ]; then
@@ -77,10 +77,10 @@ if [ $text = "3" ]; then
77 77
78 78 if [ -e /sdcard/appbackup ]; then
79 79 rm /sdcard/appbackup/* -f
80   - cp /system/sd/app/* /sdcard/appbackup
  80 + cp /sd-ext/app/* /sdcard/appbackup
81 81 else
82 82 mkdir /sdcard/appbackup
83   - cp /system/sd/app/* /sdcard/appbackup
  83 + cp /sd-ext/app/* /sdcard/appbackup
84 84 fi
85 85 echo "Apps backed up to SDcard"
86 86 echo ""
@@ -92,7 +92,7 @@ if [ $text = "4" ]; then
92 92
93 93 echo "Restoring Apps from SDcard to EXT "
94 94 if [ -e /dev/block/mmcblk0p2 ]; then
95   - mount /system/sd > /dev/null 2>&1
  95 + mount /sd-ext > /dev/null 2>&1
96 96 fi
97 97
98 98 if [ -e /dev/block/mmcblk0p1 ]; then
@@ -103,12 +103,12 @@ if [ $text = "Q" ]; then
103 103 clear
104 104 fi
105 105 if [ -e /sdcard/appbackup ]; then
106   - if [ -e /system/sd/app ]; then
107   - rm /system/sd/app/* -f
108   - cp /sdcard/appbackup/* /system/sd/app/
  106 + if [ -e /sd-ext/app ]; then
  107 + rm /sd-ext/app/* -f
  108 + cp /sdcard/appbackup/* /sd-ext/app/
109 109 else
110   - mkdir /system/sd/app
111   - cp /sdcard/appbackup/* /system/sd/app/
  110 + mkdir /sd-ext/app
  111 + cp /sdcard/appbackup/* /sd-ext/app/
112 112 echo "Apps restored from SDcard"
113 113 fi
114 114 else
14 wipe
@@ -12,12 +12,22 @@ case $1 in
12 12 rm /data/system/batterystats.bin
13 13 ;;
14 14 dalvik)
  15 + mount /data > /dev/null 2>&1
  16 + rm -rf /data/dalv*
  17 +
15 18 mount /cache > /dev/null 2>&1
16   - rm -rf /cache/dalvik-cache/*
  19 + rm -rf /cache/dalv*
  20 +
  21 + if [ -e /dev/block/mmcblk0p2 ]; then
  22 + mount /sd-ext > /dev/null 2>&1
  23 + rm -rf /sd-ext/dalv*
  24 + else
  25 + echo "No ext partition found!"
  26 + fi
17 27 ;;
18 28 ext)
19 29 if [ -e /dev/block/mmcblk0p2 ]; then
20   - mount /dev/block/mmcblk0p2 /sd-ext
  30 + mount /sd-ext > /dev/null 2>&1
21 31 rm -rf /sd-ext/*
22 32 else
23 33 echo "No ext partition found!"

0 comments on commit 7055e8d

Please sign in to comment.
Something went wrong with that request. Please try again.