2019-05-14 14:05:50 -06:00
|
|
|
#!/bin/sh -e
|
2019-05-14 05:02:11 -06:00
|
|
|
|
2019-08-25 11:46:59 -06:00
|
|
|
# Build and install regular busybox.
|
|
|
|
# This excludes utilities which require 'suid' to function.
|
2019-10-06 17:27:21 -06:00
|
|
|
make CC="${CC:-gcc}"
|
2019-08-25 11:46:59 -06:00
|
|
|
make CONFIG_PREFIX="$1/usr" install
|
2019-06-30 09:47:11 -06:00
|
|
|
|
2019-08-25 11:46:59 -06:00
|
|
|
# Rename the binary temporarily.
|
|
|
|
mv "$1/usr/bin/busybox" "$1/usr/bin/busybox-nosuid"
|
2019-07-20 10:56:09 -06:00
|
|
|
|
2019-08-25 11:46:59 -06:00
|
|
|
# Build and install suid busybox.
|
|
|
|
# This _only_ includes utlities which require 'suid' to function.
|
|
|
|
cp -f .config-suid .config
|
2019-10-06 17:27:21 -06:00
|
|
|
make CC="${CC:-gcc}"
|
2019-08-25 11:46:59 -06:00
|
|
|
make CONFIG_PREFIX="$1/usr" install
|
|
|
|
|
|
|
|
# Aptly name the busybox binaries.
|
|
|
|
mv "$1/usr/bin/busybox" "$1/usr/bin/busybox-suid"
|
|
|
|
mv "$1/usr/bin/busybox-nosuid" "$1/usr/bin/busybox"
|
|
|
|
|
|
|
|
# Install the non-suid symlinks.
|
|
|
|
"$1/usr/bin/busybox" --list | while read -r bin; do
|
|
|
|
ln -s busybox "$1/usr/bin/$bin"
|
|
|
|
done
|
2019-08-10 19:43:31 -06:00
|
|
|
|
2019-08-25 11:46:59 -06:00
|
|
|
# Install the suid symlinks.
|
|
|
|
"$1/usr/bin/busybox-suid" --list | while read -r bin; do
|
|
|
|
ln -s busybox-suid "$1/usr/bin/$bin"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Set suid on busybox suid.
|
2019-09-02 01:03:11 -06:00
|
|
|
chmod u+s "$1/usr/bin/busybox-suid"
|
2019-08-25 11:46:59 -06:00
|
|
|
|
|
|
|
# Install runit services.
|
|
|
|
install -Dm755 acpid.run "$1/etc/sv/acpid/run"
|
|
|
|
install -Dm755 crond.run "$1/etc/sv/crond/run"
|
|
|
|
install -Dm755 syslogd.run "$1/etc/sv/syslogd/run"
|
|
|
|
ln -s /run/runit/supervise.acpid "$1/etc/sv/acpid/supervise"
|
|
|
|
ln -s /run/runit/supervise.crond "$1/etc/sv/crond/supervise"
|
|
|
|
ln -s /run/runit/supervise.syslogd "$1/etc/sv/syslogd/supervise"
|