diff options
Diffstat (limited to 'su/install-su.sh')
-rw-r--r-- | su/install-su.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/su/install-su.sh b/su/install-su.sh new file mode 100644 index 0000000..aad003e --- /dev/null +++ b/su/install-su.sh @@ -0,0 +1,24 @@ +#!/sbin/sh +cp /sbin/su.recovery /system/xbin/su +chmod 6755 /system/xbin/su +ln -sf /system/xbin/su /system/bin/su + +# 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 |