diff options
author | Steve Kondik <shade@chemlab.org> | 2010-07-05 23:09:35 -0400 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2010-07-05 23:09:52 -0400 |
commit | 8794d1afc95e3cf3d5e15db26890620bed9c0fe9 (patch) | |
tree | ea89bca2eff44026500e2963d4518e8c7de92001 /prebuilt/common | |
parent | f32d926b54e8e5b5e66330be7bfefe6f47607bf0 (diff) | |
download | vendor_replicant-8794d1afc95e3cf3d5e15db26890620bed9c0fe9.zip vendor_replicant-8794d1afc95e3cf3d5e15db26890620bed9c0fe9.tar.gz vendor_replicant-8794d1afc95e3cf3d5e15db26890620bed9c0fe9.tar.bz2 |
Add init.d stuff.
Diffstat (limited to 'prebuilt/common')
-rwxr-xr-x | prebuilt/common/etc/init.d/00banner | 12 | ||||
-rwxr-xr-x | prebuilt/common/etc/init.d/01sysctl | 2 | ||||
-rwxr-xr-x | prebuilt/common/etc/init.d/03firstboot | 9 | ||||
-rwxr-xr-x | prebuilt/common/etc/init.d/04modules | 14 | ||||
-rwxr-xr-x | prebuilt/common/etc/init.d/05mountsd | 54 | ||||
-rwxr-xr-x | prebuilt/common/etc/init.d/10apps2sd | 24 | ||||
-rwxr-xr-x | prebuilt/common/etc/init.d/20userinit | 21 |
7 files changed, 136 insertions, 0 deletions
diff --git a/prebuilt/common/etc/init.d/00banner b/prebuilt/common/etc/init.d/00banner new file mode 100755 index 0000000..70b8a9f --- /dev/null +++ b/prebuilt/common/etc/init.d/00banner @@ -0,0 +1,12 @@ +#!/system/bin/sh +# +# Print startup info +# +L="log -p i -t cm" + +$L "Welcome to Android `getprop ro.build.version.release` / `getprop ro.modversion`"; +$L " _ "; +$L " __ __ _ ___ _ _ __ ___ __ _ _ _ _ __ __))"; +$L "((_ \\(/'((_( ((\\( ((_)((_( (('((\\( ((\`1( ((_)((_( "; +$L " )) _))"; +$L " "; diff --git a/prebuilt/common/etc/init.d/01sysctl b/prebuilt/common/etc/init.d/01sysctl new file mode 100755 index 0000000..bba6a83 --- /dev/null +++ b/prebuilt/common/etc/init.d/01sysctl @@ -0,0 +1,2 @@ +#!/system/bin/sh +sysctl -p diff --git a/prebuilt/common/etc/init.d/03firstboot b/prebuilt/common/etc/init.d/03firstboot new file mode 100755 index 0000000..bd084a0 --- /dev/null +++ b/prebuilt/common/etc/init.d/03firstboot @@ -0,0 +1,9 @@ +#!/system/bin/sh +# execute any postinstall script then kill it +if [ -e /data/firstboot.sh ]; +then + log -p i -t boot "Executing firstboot.sh.."; + logwrapper /system/bin/sh /data/firstboot.sh; + rm -f /data/firstboot.sh; +fi; + diff --git a/prebuilt/common/etc/init.d/04modules b/prebuilt/common/etc/init.d/04modules new file mode 100755 index 0000000..db18c71 --- /dev/null +++ b/prebuilt/common/etc/init.d/04modules @@ -0,0 +1,14 @@ +#!/system/bin/sh +# +# Load any extra modules + +MODULES="" + +if [ "`getprop persist.net.ipv6`" = "1" ]; then + MODULES="$MODULES ipv6" +fi + +for i in $MODULES; +do + modprobe $i; +done 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 diff --git a/prebuilt/common/etc/init.d/10apps2sd b/prebuilt/common/etc/init.d/10apps2sd new file mode 100755 index 0000000..b4d0192 --- /dev/null +++ b/prebuilt/common/etc/init.d/10apps2sd @@ -0,0 +1,24 @@ +#!/system/bin/sh +# Make sure the Apps2SD structure exists. + +if [ "$SD_EXT_DIRECTORY" = "" ]; +then + SD_EXT_DIRECTORY=/sd-ext; +fi; + +if ! awk -vDIR="$SD_EXT_DIRECTORY" '$2 == DIR { exit 1; }' /proc/mounts ; +then + # create directories if necessary. + for i in app app-private dalvik-cache; + do + if [ ! -d $SD_EXT_DIRECTORY/$i ]; + then + mkdir $SD_EXT_DIRECTORY/$i; + busybox chown 1000:1000 $SD_EXT_DIRECTORY/$i; + busybox chmod 771 $SD_EXT_DIRECTORY/$i; + log -p i -t a2sd "$SD_EXT_DIRECTORY/$i created" + fi; + done + setprop cm.a2sd.active 1 + log -p i -t a2sd "Apps2SD successfully activated"; +fi; diff --git a/prebuilt/common/etc/init.d/20userinit b/prebuilt/common/etc/init.d/20userinit new file mode 100755 index 0000000..ca88f83 --- /dev/null +++ b/prebuilt/common/etc/init.d/20userinit @@ -0,0 +1,21 @@ +#!/system/bin/sh +# call a userinit.sh script if it's present on the sdcard + +if [ "$SD_EXT_DIRECTORY" = "" ]; +then + SD_EXT_DIRECTORY=/sd-ext; +fi; + +if [ -e $SD_EXT_DIRECTORY/userinit.sh ]; +then + log -p i -t userinit "Executing $SD_EXT_DIRECTORY/userinit.sh"; + busybox chmod +x $SD_EXT_DIRECTORY/userinit.sh; + logwrapper /system/bin/sh $SD_EXT_DIRECTORY/userinit.sh; + setprop cm.userinit.active 1; +fi; + +if [ -d $SD_EXT_DIRECTORY/userinit.d ]; +then + logwrapper busybox run-parts $SD_EXT_DIRECTORY/userinit.d; + setprop cm.userinit.active 1; +fi; |