Skip to content

Commit d5afac4

Browse files
committed
Check if busybox exists and install it when needed
1 parent 3ab0d04 commit d5afac4

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

halium-install

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,32 @@ do_chroot()
4343
do_shell "chroot /cache/system $@"
4444
}
4545

46+
check_busybox()
47+
{
48+
export device_architecture=$(do_shell "uname -m")
49+
export busybox_exists=$(do_shell "if [ -d /sbin/busybox ]; then echo true; else echo false; fi")
50+
mkdir busybox
51+
52+
if [ $busybox_exists = "true" ]; then
53+
echo 'Using already installed busybox'
54+
else
55+
if [ $device_architecture = x86_64 ]; then
56+
wget https://github.com/meefik/busybox/raw/master/app/src/main/assets/intel/static/bin/busybox -O busybox/busybox
57+
elif [ $device_architecture = armv7l ]; then
58+
wget https://github.com/meefik/busybox/raw/master/app/src/main/assets/arm/static/bin/busybox -O busybox/busybox
59+
elif [ $device_architecture = arm64 ]; then
60+
wget https://github.com/meefik/busybox/raw/master/app/src/main/assets/arm/static/bin/busybox -O busybox/busybox
61+
else
62+
echo 'Unsupported architecture'
63+
fi
64+
65+
adb push busybox/busybox /sbin/busybox
66+
do_shell "/sbin/busybox --install"
67+
fi
68+
69+
rm busybox -r
70+
}
71+
4672
convert_android_img()
4773
{
4874
if file $SYSIMG | grep -v ": Linux rev 1.0 ext4" >/dev/null; then
@@ -170,6 +196,7 @@ if ! adb devices | grep -q recovery; then
170196
exit 1
171197
fi
172198

199+
check_busybox
173200
check_mounts
174201

175202
WORKDIR=$(mktemp -d /tmp/halium-install.XXXXX)

0 commit comments

Comments
 (0)