-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_busybox.sh
executable file
·55 lines (44 loc) · 1.1 KB
/
get_busybox.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
BUSYBOX_DEB="http://ftp.debian.org/debian/pool/main/b/busybox/busybox-static_1.30.1-4_arm64.deb"
mkdir -p downloaded
if [ -f "./downloaded/busybox" ]; then
echo "Busybox already found, skipping..."
exit 0
fi
if [ ! -x "$(command -v ar)" ]; then
echo "Ar needed to unpack .deb archives, exitting..."
exit 1
fi
if [ ! -x "$(command -v tar)" ]; then
echo "Tar needed to unpack .deb archives, exitting..."
exit 1
fi
mkdir busybox_deb
echo "Getting busybox package..."
wget "$BUSYBOX_DEB" -O busybox_deb/busybox.deb
if [ $? -ne 0 ]; then
echo "Busybox download fialed, exitting..."
exit 1
fi
echo "Unpacking busybox package... (1/2)"
cd busybox_deb
ar x busybox.deb
if [ $? -ne 0 ]; then
echo "Busybox unpack failed, exitting..."
cd ..
rm -rf busybox_deb
exit 1
fi
echo "Unpacking busybox package... (2/2)"
tar xf data.tar.xz
if [ $? -ne 0 ]; then
echo "Busybox unpack failed, exitting..."
cd ..
rm -rf busybox_deb
exit 1
fi
echo "Moving busybox binary..."
mv bin/busybox ../downloaded
cd ..
echo "Cleaning up temporary files..."
rm -rf busybox_deb