blob: f5c0aae9169a26df9b4a7ba5935ba9db9da4843a (
plain) (
tree)
|
|
#!/bin/ash
# copy busybox to NEWROOT unless one exists at the expected path.
bb_target_path="/opt/openslx/bin/busybox"
bb_source_path="$( type -p busybox )"
[ -x "$bb_source_path" ] || bb_source_path="$( command -v busybox )"
if ! [ -x "$bb_source_path" ]; then
echo "Busybox binary not found in initrd!?"
exit 1
fi
if [ -x "${NEWROOT}${bb_target_path}" ]; then
echo "Not installing busybox in stage 4 - already exists"
exit 1
fi
mkdir -p -- "${NEWROOT}/opt/openslx/bin" "${NEWROOT}/opt/openslx/sbin"
cp -f -- "$bb_source_path" "${NEWROOT}${bb_target_path}"
# --list-full gives {s,}bin prefixes
for app in $( busybox --list-full ); do
# No -f, so we skip any tools that might already exist
ln -ns -- "$bb_target_path" "${NEWROOT}/opt/openslx/$app"
done
# compat: /bin/ash if not exists
# also accept dead symlinks as it might be relative and just look dead
# to us from outside NEWROOT
if ! [ -e "${NEWROOT}/bin/ash" ] && ! [ -L "${NEWROOT}/bin/ash" ]; then
ln -nsf -- "$bb_target_path" "${NEWROOT}/bin/ash"
else
# either valid symlink or binary, log it and ignore.
echo "'/bin/ash' is a symlink or binary, leaving it alone."
fi
exit 0
|