#!/bin/sh
# Link busybox applets that lack a real binary. Idempotent; never clobbers real tools.
bb=/usr/bin/busybox
[ -x "$bb" ] || bb=$(command -v busybox) || exit 0
"$bb" --list 2>/dev/null | while IFS= read -r app; do
  case "$app" in ""|busybox) continue ;; esac
  found=0
  for d in /usr/sbin /usr/bin /sbin /bin; do
    [ -e "$d/$app" ] && { found=1; break; }
  done
  [ "$found" = 0 ] && "$bb" ln -sf /usr/bin/busybox "/usr/bin/$app"
done
exit 0
