Create busybox symlinks during compile
diff --git a/Android.mk b/Android.mk
index f7d75f9..f10ca46 100644
--- a/Android.mk
+++ b/Android.mk
@@ -208,6 +208,20 @@
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
+# 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
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_TAGS := tests
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 8b7c2f1..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
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/recovery.cpp b/recovery.cpp
index ea085d1..2459650 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -810,10 +810,8 @@
DataManager_LoadDefaults();
printf("Starting the UI...");
gui_init();
- printf("=> Installing busybox into /sbin\n");
- system("/sbin/bbinstall.sh"); // Let's install busybox
printf("=> Linking mtab\n");
- system("ln -s /proc/mounts /etc/mtab"); // And link mtab for mke2fs
+ system("ln -s /proc/mounts /etc/mtab"); // Link mtab for mke2fs
printf("=> Processing recovery.fstab\n");
if (!PartitionManager.Process_Fstab("/etc/recovery.fstab", 1)) {
LOGE("Failing out of recovery due to problem with recovery.fstab.\n");