Skip to content

Commit 7055e8d

Browse files
committed
1.7.0.1 version of scripts
1 parent 963ea79 commit 7055e8d

File tree

6 files changed

+192
-50
lines changed

6 files changed

+192
-50
lines changed

bart

Lines changed: 160 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#!/sbin/sh
2-
VER="1.0.1"
2+
VER="1.3.1"
33
MYFOLDER="bart"
44
SDCARD="/sdcard"
55
EXTPART="/system/sd"
6+
CACHEPART="/cache"
67
NANDSH="nandroid-mobile.sh"
78
NANDLOG="nandroid.log"
8-
RECOVERY="foo"
9+
CONFIGFILE="/system/sd/bart.config"
10+
911
alias _GREP_="busybox grep"
1012
alias _AWK_="busybox awk"
1113
alias _MOUNT_="busybox mount"
@@ -29,6 +31,7 @@ myecho=":"
2931
ni=0
3032
reboot=0
3133
shutdown=0
34+
docache=1
3235

3336
do_exit()
3437
{
@@ -58,6 +61,7 @@ print_usage()
5861
echo " -n --nandroid_only, use with -r or -s"
5962
echo " -v --version"
6063
echo " --verbose, verbose output during nandroid"
64+
echo " --nocache, ignore the cache partition"
6165
echo " --norecovery, ignore recovery partition"
6266
echo " --noboot, ignore boot partition"
6367
echo " --nodata, ignore data partition"
@@ -126,12 +130,68 @@ read_rom()
126130
fi
127131
}
128132

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+
129175
# args processing
130176
if [ $# -lt 1 ]
131177
then
132178
print_usage
133179
exit 1
134180
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
135195
while [ -n "$1" ]
136196
do
137197
case "$1" in
@@ -177,6 +237,11 @@ do
177237
shutdown=1
178238
shift
179239
;;
240+
--nocache)
241+
$myecho "setting cache option..."
242+
docache=0
243+
shift
244+
;;
180245
-a|--app_s)
181246
$myecho "setting app_s option..."
182247
app_s=1
@@ -281,31 +346,6 @@ do
281346
esac
282347
done
283348

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
309349

310350
myhome="${SDCARD}/${MYFOLDER}"
311351
rompath="${myhome}/${romname}"
@@ -322,7 +362,7 @@ case "$cmd" in
322362
fi
323363
rompath="${myhome}/${romname}"
324364
nandfolder="${rompath}/nandroid"
325-
365+
326366
if [ $nandroid_only -eq 1 ]
327367
then
328368
echo ""
@@ -456,6 +496,63 @@ case "$cmd" in
456496
do_exit 30
457497
fi
458498

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+
459556
if [ $nandroid_only -eq 0 ]
460557
then
461558
compressed=0
@@ -606,6 +703,23 @@ case "$cmd" in
606703

607704
if [ $compressed -eq 1 ]
608705
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+
609723
if [ $nandroid_only -eq 0 ]
610724
then
611725
# store the apps partition data
@@ -661,6 +775,24 @@ case "$cmd" in
661775
fi
662776
fi
663777
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+
664796
if [ $nandroid_only -eq 0 ]
665797
then
666798
# store the apps partition data

fix_permissions

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ fp_start()
186186
DATAMOUNT=1
187187
fi
188188

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
191191
SYSSDMOUNT=1
192192
fi
193193
fi
@@ -445,7 +445,7 @@ fp_end()
445445
fi
446446

447447
if $TEST $SYSSDMOUNT -eq 1; then
448-
$UMOUNT /system/sd > /dev/null 2>&1
448+
$UMOUNT /sd-ext > /dev/null 2>&1
449449
fi
450450

451451
if $TEST $SYSMOUNT -eq 1; then

switchrom

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
VER="1.1"
33
MYFOLDER="switchROM"
44
SDCARD="/sdcard"
5-
EXTPART="/system/sd"
5+
EXTPART="/sd-ext"
66
NANDSH="nandroid-mobile.sh"
77
NANDLOG="nandroid.log"
88
alias _GREP_="busybox grep"
@@ -148,7 +148,7 @@ do
148148
esac
149149
done
150150

151-
# make sure /system/sd and /sdcard are mounted
151+
# make sure /sd-ext and /sdcard are mounted
152152
for i in ${SDCARD} ${EXTPART}
153153
do
154154
mounted=`_GREP_ $i /proc/mounts | _AWK_ '{print $2}'`
@@ -254,7 +254,7 @@ case "$cmd" in
254254
fi
255255

256256
# proceed with the restoration process
257-
echo "Cleaning up /system/sd ..."
257+
echo "Cleaning up /sd-ext ..."
258258
_RM_ -rf ${EXTPART}/app* ${EXTPART}/dalv* > /dev/null 2>&1
259259
if [ $compressed -eq 1 ]
260260
then

um

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
echo "" > /sys/devices/platform/usb_mass_storage/lun0/file
44

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`
66

77
if [ "$LIST" != "" ]; then
88
for i in $LIST

utility

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ clear
1010
echo "More Utilities by BKMO"
1111
echo ""
1212
echo "[1] Convert ext3 > ext4 no data loss"
13-
echo "[2] Fix Permissions 2.03 experimental"
13+
echo "[2] Fix Permissions 2.03"
1414
echo "[3] Backup APPS on ext to FAT32"
1515
echo "[4] Restore APPS from FAT32 to ext"
1616
echo "[5] Partition SD 3 partitions (can set sizes)"
1717
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"
2020
echo "[9] Reset/delete Battery Stats"
2121
echo "[q] Quit to Console Prompt"
2222
echo "[b] Boot me out of here! (reboot)"
@@ -43,7 +43,7 @@ fi
4343
if [ $text = "1" ]; then
4444
echo "Converting to EXT4"
4545
if [ -e /dev/block/mmcblk0p2 ]; then
46-
umount /system/sd > /dev/null 2>&1;
46+
umount /sd-ext > /dev/null 2>&1;
4747
set -e;
4848
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2;
4949
e2fsck -fpDC0 /dev/block/mmcblk0p2;
@@ -68,7 +68,7 @@ fi
6868
if [ $text = "3" ]; then
6969
echo "Backing up EXT Apps to SDcard"
7070
if [ -e /dev/block/mmcblk0p2 ]; then
71-
mount /system/sd > /dev/null 2>&1
71+
mount /sd-ext > /dev/null 2>&1
7272
fi
7373

7474
if [ -e /dev/block/mmcblk0p1 ]; then
@@ -77,10 +77,10 @@ if [ $text = "3" ]; then
7777

7878
if [ -e /sdcard/appbackup ]; then
7979
rm /sdcard/appbackup/* -f
80-
cp /system/sd/app/* /sdcard/appbackup
80+
cp /sd-ext/app/* /sdcard/appbackup
8181
else
8282
mkdir /sdcard/appbackup
83-
cp /system/sd/app/* /sdcard/appbackup
83+
cp /sd-ext/app/* /sdcard/appbackup
8484
fi
8585
echo "Apps backed up to SDcard"
8686
echo ""
@@ -92,7 +92,7 @@ if [ $text = "4" ]; then
9292

9393
echo "Restoring Apps from SDcard to EXT "
9494
if [ -e /dev/block/mmcblk0p2 ]; then
95-
mount /system/sd > /dev/null 2>&1
95+
mount /sd-ext > /dev/null 2>&1
9696
fi
9797

9898
if [ -e /dev/block/mmcblk0p1 ]; then
@@ -103,12 +103,12 @@ if [ $text = "Q" ]; then
103103
clear
104104
fi
105105
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/
109109
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/
112112
echo "Apps restored from SDcard"
113113
fi
114114
else

0 commit comments

Comments
 (0)