@rm -rf $@
$(hide) cp external/koush/Superuser/init.superuser.rc $@
+
+SUPERUSER_MARKER := $(TARGET_OUT_ETC)/.has_su_daemon
+$(SUPERUSER_MARKER): $(LOCAL_MODULE)
+$(SUPERUSER_MARKER): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk
+ @mkdir -p $(dir $@)
+ @rm -rf $@
+ $(hide) touch $@
+
ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
- $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(TARGET_ROOT_OUT)/init.superuser.rc
-endif
\ No newline at end of file
+ $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(TARGET_ROOT_OUT)/init.superuser.rc $(TARGET_OUT_ETC)/.has_su_daemon
+endif
echo -n -e 'ui_print Installing Superuser...\n' > /proc/self/fd/$2
echo -n -e 'ui_print\n' > /proc/self/fd/$2
+# detect binary versions to install
X86=$(uname -a | grep x86)
I686=$(uname -a | grep i686)
I386=$(uname -a | grep i386)
mkdir -p $PLATFORM
cp /cache/su $PLATFORM/su
cp /cache/Superuser.apk .
+ cp /cache/install-recovery.sh .
fi
cp Superuser.apk /system/app
chmod 644 /system/app/Superuser.apk
+# if the system is at least 4.3, and there is no su daemon built in,
+# let's try to install it using install-recovery.sh
+BUILD_RELEASE_VERSION=$(cat /system/build.prop | grep ro\\.build\\.version\\.release)
+IS_43=$(echo $BUILD_RELEASE_VERSION | grep 4\\.3)
+if [ -z "$IS_43" -o "$IS_43" \> "4.3" -o "$IS_43" == "4.3" ]
+then
+ # check for rom su daemon before clobbering install-recovery.sh
+ if [ ! -f "/system/etc/.has_su_daemon" ]
+ then
+ echo -n -e 'ui_print Installing Superuser daemon...\n' > /proc/self/fd/$2
+ echo -n -e 'ui_print\n' > /proc/self/fd/$2
+ cp install-recovery.sh /system/etc/install-recovery.sh
+ chmod 755 /system/etc/install-recovery.sh
+ # note that an post install su daemon was installed
+ # so recovery doesn't freak out and recommend you disable
+ # the install-recovery.sh execute bit.
+ touch /system/etc/.installed_su_daemon
+ fi
+fi
+
umount /system
\ No newline at end of file
<target name="-post-build">
<mkdir dir="bin/recoveryzip/META-INF/com/google/android" />
<copy file="assets/update-binary" tofile="bin/recoveryzip/META-INF/com/google/android/update-binary"/>
+ <copy file="assets/install-recovery.sh" tofile="bin/recoveryzip/install-recovery.sh"/>
<copy file="bin/Superuser-release.apk" tofile="bin/recoveryzip/Superuser.apk"/>
<exec executable="zip" failonerror="true" dir="bin/recoveryzip">