Create symlinks at compile time for busybox
diff --git a/Android.mk b/Android.mk
index 3734330..7187ae7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -208,7 +208,18 @@
include $(BUILD_EXECUTABLE)
+# Create busybox symlinks... gzip and gunzip are excluded because those need to link to pigz instead
+BUSYBOX_LINKS := $(shell cat external/busybox/busybox-full.links)
+exclude := tune2fs mke2fs mkdosfs gzip gunzip
+RECOVERY_BUSYBOX_SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(filter-out $(exclude),$(notdir $(BUSYBOX_LINKS))))
+$(RECOVERY_BUSYBOX_SYMLINKS): BUSYBOX_BINARY := busybox
+$(RECOVERY_BUSYBOX_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
+ @echo "Symlink: $@ -> $(BUSYBOX_BINARY)"
+ @mkdir -p $(dir $@)
+ @rm -rf $@
+ $(hide) ln -sf $(BUSYBOX_BINARY) $@
+ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_BUSYBOX_SYMLINKS)
include $(CLEAR_VARS)
LOCAL_MODULE := verifier_test
diff --git a/gui/Android.mk b/gui/Android.mk
index 86d7453..1bab077 100644
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -66,7 +66,8 @@
cp -fr $(TWRP_RES_LOC)/common/res/* $(TARGET_RECOVERY_ROOT_OUT)/res/
cp -fr $(TWRP_RES_LOC)/$(DEVICE_RESOLUTION)/res/* $(TARGET_RECOVERY_ROOT_OUT)/res/
mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sbin/
- ln -sf /sbin/busybox $(TARGET_RECOVERY_ROOT_OUT)/sbin/sh
+ ln -sf /sbin/pigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gzip
+ ln -sf /sbin/unpigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gunzip
LOCAL_GENERATED_SOURCES := $(TWRP_RES_GEN)
LOCAL_SRC_FILES := twrp $(TWRP_RES_GEN)
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 4796d06..048077a 100644
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -71,15 +71,6 @@
LOCAL_SRC_FILES := teamwin $(GEN)
include $(BUILD_PREBUILT)
-#bbinstall.sh
-include $(CLEAR_VARS)
-LOCAL_MODULE := bbinstall.sh
-LOCAL_MODULE_TAGS := eng
-LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
-LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-include $(BUILD_PREBUILT)
-
#fix_permissions
include $(CLEAR_VARS)
LOCAL_MODULE := fix_permissions.sh
@@ -89,15 +80,6 @@
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
-#fs
-include $(CLEAR_VARS)
-LOCAL_MODULE := fs
-LOCAL_MODULE_TAGS := eng
-LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
-LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-include $(BUILD_PREBUILT)
-
#mke2fs.conf
include $(CLEAR_VARS)
LOCAL_MODULE := mke2fs.conf
diff --git a/prebuilt/bbinstall.sh b/prebuilt/bbinstall.sh
deleted file mode 100755
index 2aab969..0000000
--- a/prebuilt/bbinstall.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/sbin/sh
-
-if [ -f "/sbin/[" ];
-then
-exit
-fi
-
-for cmd in $(/sbin/busybox --list); do
- /sbin/busybox ln -s /sbin/busybox /sbin/$cmd
-done
-
-ln -sf /sbin/pigz /sbin/gzip
-ln -sf /sbin/unpigz /sbin/gunzip
-rm /sbin/mkdosfs
\ No newline at end of file
diff --git a/prebuilt/fs b/prebuilt/fs
deleted file mode 100644
index 3092efe..0000000
--- a/prebuilt/fs
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/sbin/sh
-
-um
-if [ $? != "0" ]; then
- echo "Unable to unmount!"
- exit 1
-fi
-
-
-case $1 in
- repair)
- if [ -e /dev/block/mmcblk0p2 ]; then
-
- e2fsck -yf /dev/block/mmcblk0p2
- else
- echo "No ext partition found!"
- exit 1
- fi
- exit 0
- ;;
- ext3)
- if [ -e /dev/block/mmcblk0p2 ]; then
-
- e2fsck -yf /dev/block/mmcblk0p2
- tune2fs -c0 -i0 -j /dev/block/mmcblk0p2
- else
- echo "No ext partition found!"
- exit 1
- fi
- exit 0
- ;;
- ext4)
- if [ -e /dev/block/mmcblk0p2 ]; then
-
- tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2
- e2fsck -fpDC0 /dev/block/mmcblk0p2
- else
- echo "No ext partition found!"
- exit 1
- fi
- exit 0
- ;;
- --)
- exit 0
- ;;
-esac
diff --git a/recovery.cpp b/recovery.cpp
index 1e1d9a9..3c44472 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -809,8 +809,11 @@
DataManager_LoadDefaults();
printf("Starting the UI...");
gui_init();
- printf("=> Installing busybox into /sbin\n");
- system("/sbin/bbinstall.sh"); // Let's install busybox
+ //printf("=> Installing busybox into /sbin\n");
+ //system("/sbin/bbinstall.sh"); // Let's install busybox
+ printf("Symlinking gzip to pigz\n");
+ system("ln -sf /sbin/pigz /sbin/gzip");
+ system("ln -sf /sbin/unpigz /sbin/gunzip");
printf("=> Linking mtab\n");
system("ln -s /proc/mounts /etc/mtab"); // And link mtab for mke2fs
printf("=> Processing recovery.fstab\n");