#!/bin/sh
# version 0.1

. ./installink.sh
. ./!vda_ver

bin=/bin
chkbin=/usr/bin
STATIC=/app/$NAME$VER

applets=`./busybox 2>&1 \
| {
while read -r line; do
    if echo "$line" \
    | grep -F "Currently defined functions:" >/dev/null 2>&1; then
        break
    fi
done
if ! test "$line"; then exit; fi
while read -r line; do echo -n "$line "; done \
| sed "s/   */ /g" | sed "s/, / /g"
}
`
echo "I'm going to do: ln -s $STATIC/busybox $bin/\$name"
echo -n "names:"
for a in $applets; do
    if ! test -e "$bin/$a"; then
	if ! test -e "$chkbin/$a"; then
	    echo -n " $a"
	fi
    fi
done
echo

echo -n "Press <Enter> to continue or Ctrl-C to exit: "; read junk

for a in $applets; do
    if ! test -e "$bin/$a"; then
	if ! test -e "$chkbin/$a"; then
	    ln -s $STATIC/busybox $bin/$a
	fi
    fi
done

echo "NB: making busybox setuid"
chmod u+s busybox
