summaryrefslogtreecommitdiffstats
path: root/prebuilt/common/etc/init.d/05mountsd
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2010-07-05 23:09:35 -0400
committerSteve Kondik <shade@chemlab.org>2010-07-05 23:09:52 -0400
commit8794d1afc95e3cf3d5e15db26890620bed9c0fe9 (patch)
treeea89bca2eff44026500e2963d4518e8c7de92001 /prebuilt/common/etc/init.d/05mountsd
parentf32d926b54e8e5b5e66330be7bfefe6f47607bf0 (diff)
downloadvendor_replicant-8794d1afc95e3cf3d5e15db26890620bed9c0fe9.zip
vendor_replicant-8794d1afc95e3cf3d5e15db26890620bed9c0fe9.tar.gz
vendor_replicant-8794d1afc95e3cf3d5e15db26890620bed9c0fe9.tar.bz2
Add init.d stuff.
Diffstat (limited to 'prebuilt/common/etc/init.d/05mountsd')
-rwxr-xr-xprebuilt/common/etc/init.d/05mountsd54
1 files changed, 54 insertions, 0 deletions
diff --git a/prebuilt/common/etc/init.d/05mountsd b/prebuilt/common/etc/init.d/05mountsd
new file mode 100755
index 0000000..f53645f
--- /dev/null
+++ b/prebuilt/common/etc/init.d/05mountsd
@@ -0,0 +1,54 @@
+#!/system/bin/sh
+#
+# mount ext[234] partition from sd card
+
+BB="logwrapper busybox";
+
+if [ "$SD_EXT_DIRECTORY" = "" ];
+then
+ SD_EXT_DIRECTORY=/sd-ext;
+fi;
+
+# find first linux partition on SD card
+MMC=/dev/block/mmcblk0
+
+# 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
+ logwrapper e2fsck -y $PARTITION;
+
+ # set property with exit code in case an error occurs
+ setprop cm.e2fsck.errors $?;
+ if [ "$?" = 0 ];
+ 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