Skip to content

Instantly share code, notes, and snippets.

@TheB1ackSheep
Last active August 29, 2015 14:09
Show Gist options
  • Save TheB1ackSheep/49b361381212e5e723f1 to your computer and use it in GitHub Desktop.
Save TheB1ackSheep/49b361381212e5e723f1 to your computer and use it in GitHub Desktop.
มี 2 ไฟล์น่ะครับ ไฟล์ 03mountsd ไว้ใช้ mount sd card ไปไว้ที่ /sd-ext แต่ต้องแก้ device path ให้ถูกด้วยน่ะครับ ส่วนไฟล์ 40int2ext จะเอาไว้ mount /data มาที่ /sd-ext วิธีทำก็ให้ก็อป 03mountsd ไปไว้ที่ /system/etc/init.d ก่อน เปลี่ยน permission เป็น 755 แล้วรีบูทเครื่อง หลังจากนั้นก็อปโฟลเดอร์ /data/app, /data/app-lib, /data/app-private, /data/app…
#!/system/bin/sh
#mount sd card, partion formatted as ext2, to /sd-ext if already wipe and format
mount -o rw /dev/block/mmcblk1p1 /sd-ext
BB="logwrapper busybox";
# Areeb - make mount point
if [ ! -d /sd-ext ];
then
$BB mount -o rw,remount /
install -m 774 -o 1000 -g 1000 -d /sd-ext
$BB mount -o ro,remount /
fi
if [ "$SD_EXT_DIRECTORY" = "" ];
then
SD_EXT_DIRECTORY=/sd-ext;
fi;
# By iamareebjamal $©|€|\|TI$T
# XDA Forum
#
MMC=/dev/block/mmcblk1
if [ ! -b "$MMC" ];
then
mknod ${MMC} b 179 0
chmod 600 ${MMC}
for i in 1 2 3;do
mknod ${MMC}p${i} b 179 $i
chmod 600 ${MMC}p${i}
done
fi
# find first linux partition on SD card
# wait for the device to settle
COUNT=6;
until [ -b "$MMC" ] || [ $COUNT -lt 1 ];
do
sleep 1;
COUNT=$((COUNT-1));
done;
if [ -b "$MMC" ];
then
FDISK="busybox fdisk"
PARTITION=`$FDISK -l $MMC | awk '/^\// && $5 == 83 {print $1;exit;}'`
if [ -b "$PARTITION" ];
then
log -p i -t mountsd "Checking filesystems..";
# fsck the sdcard filesystem first
if [ `which e2fsck` ];
then
e2fsck -pv $PARTITION;
e2fsckExitCode=$?
else
echo "e2fsck not found, assuming fs ok.."
e2fsckExitCode=0
fi
# set property with exit code in case an error occurs
setprop cm.e2fsck.errors $e2fsckExitCode;
if [ "$e2fsckExitCode" -lt 2 ];
then
# mount and set perms
$BB mount -o noatime,nodiratime -t auto $PARTITION $SD_EXT_DIRECTORY;
if [ "$?" = 0 ];
then
$BB chown 1000:1000 $SD_EXT_DIRECTORY;
$BB chmod 771 $SD_EXT_DIRECTORY;
log -p i -t mountsd "$SD_EXT_DIRECTORY successfully mounted";
else
log -p e -t mountsd "Unable to mount filesystem for $SD_EXT_DIRECTORY!";
fi
else
log -p e -t mountsd "Unable to repair filesystem, disabling apps2sd";
fi
fi
fi
#!/system/bin/sh
#####################################
## CronMod INT2EXT -- 02/21/2013 ##
## Written by CronicCorey @xda ##
## 40int2ext ##
#####################################
## Thanks to Mastermind1024 @xda for helping to solve the IMEI and Baseband issues on some devices
## Thanks to vvFICKvv, DK75, and Dark Passenger @xda for help to fix compatibility issues with Android 4.2.x
## Thanks to Mortaromarcello @github for code to check if mmcblk0p2 exists
## Only continue if mmcblk1p1 exists
if [ ! -e /dev/block/mmcblk1p1 ]
then
exit
fi;
if [ -e /sd-ext ]
then
if [ ! -e /sd-ext/app ]
then
busybox cp -a /data/app /sd-ext;
fi;
## Mount mmcblk1p1 to /data/app
busybox mount -o bind /sd-ext/app /data/app;
busybox chown 1000:1000 /data/app;
busybox chmod 771 /data/app;
if [ ! -e /sd-ext/app-asec ]
then
busybox cp -a /data/app-asec /sd-ext;
fi;
## Mount mmcblk1p1 to /data/app-asec
busybox mount -o bind /sd-ext/app-asec /data/app-asec;
busybox chown 1000:1000 /data/app-asec;
busybox chmod 771 /data/app-asec;
if [ ! -e /sd-ext/app-lib ]
then
busybox cp -a /data/app-lib /sd-ext;
fi;
## Mount mmcblk1p1 to /data/app-lib
busybox mount -o bind /sd-ext/app-lib /data/app-lib;
busybox chown 1000:1000 /data/app-lib;
busybox chmod 771 /data/app-lib;
if [ ! -e /sd-ext/data ]
then
busybox cp -a /data/data /sd-ext;
fi;
## Mount mmcblk1p1 to /data/data
busybox mount -o bind /sd-ext/data /data/data;
busybox chown 1000:1000 /data/data;
busybox chmod 771 /data/data;
fi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment