From aa92304556a83d7938ab45c96fa198756729ab31 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Wed, 2 May 2012 15:17:30 +0200 Subject: [PATCH] properly handle /tmp symlink from moto gb init.rc in gb, /tmp is a link to /data/tmp which is not mounted at bootmenu stage. Change-Id: I0e6053704e27452caa86e5d29bfe5f5a9a5e2b7c --- bootmenu/script/2nd-boot.sh | 17 +++++------------ bootmenu/script/2nd-init.sh | 17 +++++------------ bootmenu/script/pre_bootmenu.sh | 6 ++++++ bootmenu/script/stock.sh | 14 ++++++++++---- 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/bootmenu/script/2nd-boot.sh b/bootmenu/script/2nd-boot.sh index 5c1e7436..2af241bd 100755 --- a/bootmenu/script/2nd-boot.sh +++ b/bootmenu/script/2nd-boot.sh @@ -17,18 +17,11 @@ killall ueventd ADBD_RUNNING=`ps | grep adbd | grep -v grep` if [ -z "$ADB_RUNNING" ]; then rm -f /tmp/usbd_current_state - #delete if is a symlink - [ -L "/tmp" ] && rm -f /tmp - mkdir -p /tmp -else - # well, not beautiful but do the work - # to keep current usbd state (if present) - if [ -L "/tmp" ]; then - mv /tmp/usbd_current_state / 2>/dev/null - rm -f /tmp - mkdir -p /tmp - mv /usbd_current_state /tmp/ 2>/dev/null - fi +fi + +# original /tmp data symlink +if [ -L /tmp.bak ]; then + rm /tmp.bak fi if [ -L /sdcard-ext ]; then diff --git a/bootmenu/script/2nd-init.sh b/bootmenu/script/2nd-init.sh index b2a7becb..bc94f5bd 100755 --- a/bootmenu/script/2nd-init.sh +++ b/bootmenu/script/2nd-init.sh @@ -18,18 +18,11 @@ killall ueventd ADBD_RUNNING=`ps | grep adbd | grep -v grep` if [ -z "$ADB_RUNNING" ]; then rm -f /tmp/usbd_current_state - #delete if is a symlink - [ -L "/tmp" ] && rm -f /tmp - mkdir -p /tmp -else - # well, not beautiful but do the work - # to keep current usbd state - if [ -L "/tmp" ]; then - mv /tmp/usbd_current_state / 2>/dev/null - rm -f /tmp - mkdir -p /tmp - mv /usbd_current_state /tmp/ 2>/dev/null - fi +fi + +# original /tmp data symlink +if [ -L /tmp.bak ]; then + rm /tmp.bak fi if [ -L /sdcard-ext ]; then diff --git a/bootmenu/script/pre_bootmenu.sh b/bootmenu/script/pre_bootmenu.sh index 33170141..bd5d8146 100644 --- a/bootmenu/script/pre_bootmenu.sh +++ b/bootmenu/script/pre_bootmenu.sh @@ -80,4 +80,10 @@ if [ -x $BM_ROOTDIR/script/overclock.sh ]; then $BM_ROOTDIR/script/overclock.sh safe fi +# must be restored in stock.sh +if [ -L /tmp ]; then + mv /tmp /tmp.bak + mkdir /tmp && busybox mount -t ramfs ramfs /tmp +fi + exit 0 diff --git a/bootmenu/script/stock.sh b/bootmenu/script/stock.sh index 059c4cf6..dffe3620 100755 --- a/bootmenu/script/stock.sh +++ b/bootmenu/script/stock.sh @@ -8,10 +8,16 @@ export PATH=/sbin:/system/xbin:/system/bin ######## Main Script -mount -o remount,rw / -cp -f /system/bootmenu/binary/adbd /sbin/adbd -chmod 4755 /sbin/adbd -chown root.system /sbin/adbd +busybox mount -o remount,rw / +busybox cp -f /system/bootmenu/binary/adbd /sbin/adbd +busybox chmod 4755 /sbin/adbd +busybox chown root.system /sbin/adbd + +# restore original /tmp data symlink +if [ -L /tmp.bak ]; then + busybox umount /tmp + busybox mv /tmp.bak /tmp +fi ######## Cleanup