-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild_busybox.sh
executable file
·40 lines (33 loc) · 1.15 KB
/
build_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
#!/bin/bash
set -e
source ./.config.sh || exit 1
echo "Building BusyBox"
mkdir -p "$BUSYBOX_BUILD"
cd "$BUSYBOX_BUILD"
[ -d "$BUSYBOX_SRC" ] || {
tar --checkpoint=200 -xf "$BUSYBOX" || dd "Missing BusyBox src $BUSYBOX - try run 'make download'"
cd "$BUSYBOX_SRC"
make distclean
}
cd "$BUSYBOX_SRC"
configPresetPath="$NICE_PRESET_PATH/busybox.config"
if [ -r $configPresetPath ]; then
cp "$configPresetPath" '.config'
else
make defconfig > /dev/null
sed -i 's/# CONFIG_STATIC is not set/CONFIG_STATIC=y/' .config
fi
grep -q 'CONFIG_STATIC=y' '.config' || dd "CONFIG_STATIC=y is required for busybox"
make $MAKEFLAGS busybox
make CONFIG_PREFIX="_install" install > /dev/null
mkdir -p "$TARGET/usr/bin"
pushd "$TARGET/usr/bin/"
cp -f "$BUSYBOX_SRC/busybox" "busybox" && chmod o+rx "busybox"
# Install busybox widgets if no $TARGET 'sh' and no 'core' counterparts is available
if ([ ! -x "sh" ] || [ "busybox" == $(readlink "sh") ]); then
widgets=$(find "$BUSYBOX_SRC/_install/" -type l -exec basename {} \;)
for widgetName in $widgets; do
ln -s busybox $widgetName 2> /dev/null || true
done
fi
popd