aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Rozic <rooobertinhooo@gmail.com>2014-04-13 21:37:35 +0200
committerRobert Rozic <rooobertinhooo@gmail.com>2014-04-13 21:37:35 +0200
commit089cd2a8c9cd58def93032f7aebc44b216420de7 (patch)
treed5432f72882d8236921647f9b5822ad43d377078
parent93dd50043f3d83aa340a17b96f36f34b0929c09f (diff)
Add swap storage to common
-rw-r--r--common.mk9
-rw-r--r--configs/00frandom11
-rw-r--r--configs/SwapStorages.sh42
3 files changed, 48 insertions, 14 deletions
diff --git a/common.mk b/common.mk
index 807c5a7..b017dea 100644
--- a/common.mk
+++ b/common.mk
@@ -176,6 +176,9 @@ PRODUCT_TAGS += dalvik.gc.type-precise
# Use the non-open-source parts, if they're present
include vendor/samsung/u8500-common/vendor-common.mk
-# Frandom
-#PRODUCT_COPY_FILES += \
-# $(COMMON_PATH)/configs/00frandom:system/etc/init.d/00frandom
+# Storage switch script
+ PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/configs/SwapStorages.sh:system/xbin/SwapStorages.sh
+ PRODUCT_PROPERTY_OVERRIDES += \
+ persist.sys.vold.switchablepair=sdcard0,sdcard1 \
+ persist.sys.vold.switchexternal=0
diff --git a/configs/00frandom b/configs/00frandom
deleted file mode 100644
index cb9c9de..0000000
--- a/configs/00frandom
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/system/bin/sh
-
-insmod /system/lib/modules/frandom.ko
-chmod 644 /dev/frandom
-chmod 644 /dev/erandom
-mv /dev/random /dev/random.ori
-mv /dev/urandom /dev/urandom.ori
-ln /dev/frandom /dev/random
-chmod 644 /dev/random
-ln /dev/erandom /dev/urandom
-chmod 644 /dev/urandom
diff --git a/configs/SwapStorages.sh b/configs/SwapStorages.sh
new file mode 100644
index 0000000..1a2eb2c
--- /dev/null
+++ b/configs/SwapStorages.sh
@@ -0,0 +1,42 @@
+#!/system/bin/sh
+
+MDIR=/system
+PROP=/system/build.prop
+P1="persist.sys.vold.switchexternal"
+
+if [ $# -lt 1 ]; then
+ exit
+fi
+
+MNT=$( cat /proc/mounts | grep " $MDIR " | cut -d ' ' -f 4 | tr ',' ' ' )
+if [ ! -z "$MNT" ]; then
+ REMOUNT=0
+ for OPT in $MNT; do
+ if [ "$OPT" == "rw" ]; then
+ REMOUNT=0
+ break;
+ fi
+ if [ "$OPT" == "ro" ]; then
+ REMOUNT=1
+ break;
+ fi
+ done
+else
+ exit
+fi
+
+if [ "$REMOUNT" == "1" ]; then
+ mount -o remount,rw $MDIR
+fi
+
+V=$(grep "^$P1=" $PROP)
+if [ "$V" == "" ]; then
+ echo "" >> $PROP
+ echo "$P1=$1" >> $PROP
+else
+ sed -i "s/^$P1=.*$/$P1=$1/g" $PROP
+fi
+
+if [ "$REMOUNT" == "1" ]; then
+ mount -o remount,ro $MDIR
+fi