Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

1.7.0.1 version of scripts

  • Loading branch information...
commit 7055e8d9f26b2f0c32d153aa4993e5b7403804e9 1 parent 963ea79
@packetlss packetlss authored
Showing with 192 additions and 50 deletions.
  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
View
188 bart
@@ -1,11 +1,13 @@
#!/sbin/sh
-VER="1.0.1"
+VER="1.3.1"
MYFOLDER="bart"
SDCARD="/sdcard"
EXTPART="/system/sd"
+CACHEPART="/cache"
NANDSH="nandroid-mobile.sh"
NANDLOG="nandroid.log"
-RECOVERY="foo"
+CONFIGFILE="/system/sd/bart.config"
+
alias _GREP_="busybox grep"
alias _AWK_="busybox awk"
alias _MOUNT_="busybox mount"
@@ -29,6 +31,7 @@ myecho=":"
ni=0
reboot=0
shutdown=0
+docache=1
do_exit()
{
@@ -58,6 +61,7 @@ print_usage()
echo " -n --nandroid_only, use with -r or -s"
echo " -v --version"
echo " --verbose, verbose output during nandroid"
+ echo " --nocache, ignore the cache partition"
echo " --norecovery, ignore recovery partition"
echo " --noboot, ignore boot partition"
echo " --nodata, ignore data partition"
@@ -126,12 +130,68 @@ read_rom()
fi
}
+# make sure /system/sd and /sdcard are mounted
+
+$myecho "check for /system/sd or /sd-etc"
+
+if [ -e "/sd-ext" ]
+then
+ EXTPART="/sd-ext"
+ CONFIGFILE="/sd-ext/bart.config"
+else
+ if [ -e "/system/sd" ]
+ then
+ EXTPART="/system/sd"
+ CONFIGFILE="/sd-ext/bart.config"
+ fi
+fi
+
+$myecho "checking mount points..."
+for i in ${SDCARD} ${EXTPART}
+do
+ if [ "$i" == ${EXTPART} ] && [ $nandroid_only -eq 1 ]
+ then
+ $myecho "nandroid_only chosed ext partition not needed..."
+ else
+ $myecho "checking whether $i is mounted..."
+ mounted=`_GREP_ $i /proc/mounts | _AWK_ '{print $2}'`
+ if [ "$mounted" != "$i" ]
+ then
+ $myecho "$i is not mounted. mounting $i now..."
+ # not mounted, mount it
+ _MOUNT_ $i
+ if [ $? -ne 0 ]
+ then
+ echo "Unable to mount $i ..."
+ echo ""
+ do_exit 5
+ fi
+ fi
+ $myecho "$i is mounted..."
+ fi
+done
+
+
# args processing
if [ $# -lt 1 ]
then
print_usage
exit 1
fi
+
+
+
+# check for config file
+if [ -f $CONFIGFILE ]
+then
+ $myecho "found $CONFIGFILE"
+
+ . $CONFIGFILE
+
+fi
+
+
+# get args from command line
while [ -n "$1" ]
do
case "$1" in
@@ -177,6 +237,11 @@ do
shutdown=1
shift
;;
+ --nocache)
+ $myecho "setting cache option..."
+ docache=0
+ shift
+ ;;
-a|--app_s)
$myecho "setting app_s option..."
app_s=1
@@ -281,31 +346,6 @@ do
esac
done
-# make sure /system/sd and /sdcard are mounted
-$myecho "checking mount points..."
-for i in ${SDCARD} ${EXTPART}
-do
- if [ "$i" == ${EXTPART} ] && [ $nandroid_only -eq 1 ]
- then
- $myecho "nandroid_only chosed ext partition not needed..."
- else
- $myecho "checking whether $i is mounted..."
- mounted=`_GREP_ $i /proc/mounts | _AWK_ '{print $2}'`
- if [ "$mounted" != "$i" ]
- then
- $myecho "$i is not mounted. mounting $i now..."
- # not mounted, mount it
- _MOUNT_ $i
- if [ $? -ne 0 ]
- then
- echo "Unable to mount $i ..."
- echo ""
- do_exit 5
- fi
- fi
- $myecho "$i is mounted..."
- fi
-done
myhome="${SDCARD}/${MYFOLDER}"
rompath="${myhome}/${romname}"
@@ -322,7 +362,7 @@ case "$cmd" in
fi
rompath="${myhome}/${romname}"
nandfolder="${rompath}/nandroid"
-
+
if [ $nandroid_only -eq 1 ]
then
echo ""
@@ -456,6 +496,63 @@ case "$cmd" in
do_exit 30
fi
+ if [ $docache -eq 1 ]
+ then
+ compressed=0
+ $myecho "checking for cache partition backup..."
+ if [ -e "${rompath}/cache-backup.tar.gz" ]
+ then
+ $myecho "compressed cache-backup found..."
+ compressed=1
+ else
+ if [ ! -e "${rompath}/cache-backup.tar" ]
+ then
+ echo ""
+ echo "cache-backup not fount for ROM ${romname}."
+ echo ""
+ do_exit 29
+ fi
+ $myecho "uncompressed cache-backup found..."
+ fi
+ #proceed with restoring cache
+ echo "Cleaning up /cache..."
+ cd ${CACHEPART}
+ _RM_ -rf `_LS_ -d * | grep -v -e "^recovery" -e "^lost+found" 2>&1` > /dev/null 2>&1
+
+ if [ $compressed -eq 1 ]
+ then
+ echo "Restoring compressed cache-backup in ${CACHEPART} ..."
+ cd ${CACHEPART}
+ gzip -c -d "${rompath}/cache-backup.tar.gz" | _TAR_ xpf -
+ if [ $? -ne 0 ]
+ then
+ echo ""
+ echo "Error occurred during restoration of cache data..."
+ echo "tar/gzip operation failed."
+ echo "Do you have enough space on the /sdcard?"
+ echo ""
+ do_exit 28
+ fi
+ cd /
+ else
+ echo "Restoring cache-backup in ${CACHEPART} ..."
+ cd ${CACHEPART}
+ _TAR_ xpf "${rompath}/cache-backup.tar"
+ if [ $? -ne 0 ]
+ then
+ echo ""
+ echo "Error occurred during restoration of cache-backup ..."
+ echo "tar operation failed."
+ echo "Do you have enough space on the /sdcard?"
+ echo ""
+ do_exit 27
+ fi
+ cd /
+ fi
+
+
+ fi
+
if [ $nandroid_only -eq 0 ]
then
compressed=0
@@ -606,6 +703,23 @@ case "$cmd" in
if [ $compressed -eq 1 ]
then
+ if [ $docache -eq 1 ]
+ then
+ $myecho "storing cache..."
+ cd ${CACHEPART}
+ _TAR_ cpf - `_LS_ -d * | grep -v -e "^lost+found" -e "^recovery" 2>/dev/null` | gzip -1 > "${rompath}/cache-backup.tar.gz"
+ if [ $? -ne 0 ]
+ then
+ echo ""
+ echo "Error occurred during storing of cache data..."
+ echo "tar/gzip operation failed."
+ echo "Do you have enough space on the /sdcard?"
+ echo ""
+ do_exit 15
+ fi
+
+ fi
+
if [ $nandroid_only -eq 0 ]
then
# store the apps partition data
@@ -661,6 +775,24 @@ case "$cmd" in
fi
fi
else
+ if [ $docache -eq 1 ]
+ then
+ $myecho "storing cache..."
+ cd ${CACHEPART}
+ _TAR_ cpf "${rompath}/cache-backup.tar" `_LS_ -d * | grep -v -e "^lost+found" -e "^recovery" 2>/dev/null`
+ if [ $? -ne 0 ]
+ then
+ echo ""
+ echo "Error occurred during storing of cache data..."
+ echo "tar/gzip operation failed."
+ echo "Do you have enough space on the /sdcard?"
+ echo ""
+ do_exit 15
+ fi
+
+ fi
+
+
if [ $nandroid_only -eq 0 ]
then
# store the apps partition data
View
6 fix_permissions
@@ -186,8 +186,8 @@ fp_start()
DATAMOUNT=1
fi
- if $TEST -e /dev/block/mmcblk0p2 && $TEST $( $GREP -c " /system/sd " "/proc/mounts" ) -eq 0; then
- $MOUNT /system/sd > /dev/null 2>&1
+ if $TEST -e /dev/block/mmcblk0p2 && $TEST $( $GREP -c " /sd-ext " "/proc/mounts" ) -eq 0; then
+ $MOUNT /sd-ext > /dev/null 2>&1
SYSSDMOUNT=1
fi
fi
@@ -445,7 +445,7 @@ fp_end()
fi
if $TEST $SYSSDMOUNT -eq 1; then
- $UMOUNT /system/sd > /dev/null 2>&1
+ $UMOUNT /sd-ext > /dev/null 2>&1
fi
if $TEST $SYSMOUNT -eq 1; then
View
6 switchrom
@@ -2,7 +2,7 @@
VER="1.1"
MYFOLDER="switchROM"
SDCARD="/sdcard"
-EXTPART="/system/sd"
+EXTPART="/sd-ext"
NANDSH="nandroid-mobile.sh"
NANDLOG="nandroid.log"
alias _GREP_="busybox grep"
@@ -148,7 +148,7 @@ do
esac
done
-# make sure /system/sd and /sdcard are mounted
+# make sure /sd-ext and /sdcard are mounted
for i in ${SDCARD} ${EXTPART}
do
mounted=`_GREP_ $i /proc/mounts | _AWK_ '{print $2}'`
@@ -254,7 +254,7 @@ case "$cmd" in
fi
# proceed with the restoration process
- echo "Cleaning up /system/sd ..."
+ echo "Cleaning up /sd-ext ..."
_RM_ -rf ${EXTPART}/app* ${EXTPART}/dalv* > /dev/null 2>&1
if [ $compressed -eq 1 ]
then
View
2  um
@@ -2,7 +2,7 @@
echo "" > /sys/devices/platform/usb_mass_storage/lun0/file
-LIST=`mount | grep "^/" | grep "type yaffs*\|vfat\|ext*" | grep "system*\|data\|sdcard*" | cut -d\ -f 3 | sort -rn`
+LIST=`mount | grep "^/" | grep "type yaffs*\|vfat\|ext*" | grep "system*\|data*\|sd-ext*\|sdcard*" | cut -d\ -f 3 | sort -rn`
if [ "$LIST" != "" ]; then
for i in $LIST
View
26 utility
@@ -10,13 +10,13 @@ clear
echo "More Utilities by BKMO"
echo ""
echo "[1] Convert ext3 > ext4 no data loss"
-echo "[2] Fix Permissions 2.03 experimental"
+echo "[2] Fix Permissions 2.03"
echo "[3] Backup APPS on ext to FAT32"
echo "[4] Restore APPS from FAT32 to ext"
echo "[5] Partition SD 3 partitions (can set sizes)"
echo "[6] Fix auto-rotate problems"
-echo "[7] Run BART 1.0.1 Backup"
-echo "[8] Run BART 1.0.1 Restore"
+echo "[7] Run BART 1.3.1 Backup"
+echo "[8] Run BART 1.3.1 Restore"
echo "[9] Reset/delete Battery Stats"
echo "[q] Quit to Console Prompt"
echo "[b] Boot me out of here! (reboot)"
@@ -43,7 +43,7 @@ fi
if [ $text = "1" ]; then
echo "Converting to EXT4"
if [ -e /dev/block/mmcblk0p2 ]; then
- umount /system/sd > /dev/null 2>&1;
+ umount /sd-ext > /dev/null 2>&1;
set -e;
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2;
e2fsck -fpDC0 /dev/block/mmcblk0p2;
@@ -68,7 +68,7 @@ fi
if [ $text = "3" ]; then
echo "Backing up EXT Apps to SDcard"
if [ -e /dev/block/mmcblk0p2 ]; then
- mount /system/sd > /dev/null 2>&1
+ mount /sd-ext > /dev/null 2>&1
fi
if [ -e /dev/block/mmcblk0p1 ]; then
@@ -77,10 +77,10 @@ if [ $text = "3" ]; then
if [ -e /sdcard/appbackup ]; then
rm /sdcard/appbackup/* -f
- cp /system/sd/app/* /sdcard/appbackup
+ cp /sd-ext/app/* /sdcard/appbackup
else
mkdir /sdcard/appbackup
- cp /system/sd/app/* /sdcard/appbackup
+ cp /sd-ext/app/* /sdcard/appbackup
fi
echo "Apps backed up to SDcard"
echo ""
@@ -92,7 +92,7 @@ if [ $text = "4" ]; then
echo "Restoring Apps from SDcard to EXT "
if [ -e /dev/block/mmcblk0p2 ]; then
- mount /system/sd > /dev/null 2>&1
+ mount /sd-ext > /dev/null 2>&1
fi
if [ -e /dev/block/mmcblk0p1 ]; then
@@ -103,12 +103,12 @@ if [ $text = "Q" ]; then
clear
fi
if [ -e /sdcard/appbackup ]; then
- if [ -e /system/sd/app ]; then
- rm /system/sd/app/* -f
- cp /sdcard/appbackup/* /system/sd/app/
+ if [ -e /sd-ext/app ]; then
+ rm /sd-ext/app/* -f
+ cp /sdcard/appbackup/* /sd-ext/app/
else
- mkdir /system/sd/app
- cp /sdcard/appbackup/* /system/sd/app/
+ mkdir /sd-ext/app
+ cp /sdcard/appbackup/* /sd-ext/app/
echo "Apps restored from SDcard"
fi
else
View
14 wipe
@@ -12,12 +12,22 @@ case $1 in
rm /data/system/batterystats.bin
;;
dalvik)
+ mount /data > /dev/null 2>&1
+ rm -rf /data/dalv*
+
mount /cache > /dev/null 2>&1
- rm -rf /cache/dalvik-cache/*
+ rm -rf /cache/dalv*
+
+ if [ -e /dev/block/mmcblk0p2 ]; then
+ mount /sd-ext > /dev/null 2>&1
+ rm -rf /sd-ext/dalv*
+ else
+ echo "No ext partition found!"
+ fi
;;
ext)
if [ -e /dev/block/mmcblk0p2 ]; then
- mount /dev/block/mmcblk0p2 /sd-ext
+ mount /sd-ext > /dev/null 2>&1
rm -rf /sd-ext/*
else
echo "No ext partition found!"
Please sign in to comment.
Something went wrong with that request. Please try again.