7 if [ -z "$prefix" ]; then
8 echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks/--scriptwrapper]"
12 h
=`sort busybox.links | uniq`
19 --hardlinks) linkopts
="-f";;
20 --symlinks) linkopts
="-fs";;
21 --scriptwrapper) scriptwrapper
="y";swrapall
="y";;
22 --sw-sh-hard) scriptwrapper
="y";linkopts
="-f";;
23 --sw-sh-sym) scriptwrapper
="y";linkopts
="-fs";;
24 --cleanup) cleanup
="1";;
25 --noclobber) noclobber
="1";;
27 *) echo "Unknown install option: $2"; exit 1;;
30 if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then
31 # get the target dir for the libs
32 # assume it starts with lib
33 libdir
=$
($CC -print-file-name=libc.so | \
34 sed -n 's%^.*\(/lib[^\/]*\)/libc.so%\1%p')
35 if test -z "$libdir"; then
39 mkdir
-p "$prefix/$libdir" ||
exit 1
40 for i
in $DO_INSTALL_LIBS; do
41 rm -f "$prefix/$libdir/$i" ||
exit 1
43 cp -pPR "$i" "$prefix/$libdir/" ||
exit 1
44 chmod 0644 "$prefix/$libdir/$i" ||
exit 1
49 if [ "$cleanup" = "1" ] && [ -e "$prefix/bin/busybox" ]; then
50 inode
=`ls -i "$prefix/bin/busybox" | awk '{print $1}'`
53 for d in usr/sbin usr/bin sbin bin; do
57 ls -iL . | grep "^ *$inode" | awk '{print $2}' | env -i xargs rm -f
65 rm -f "$prefix/bin/busybox" ||
exit 1
66 mkdir
-p "$prefix/bin" ||
exit 1
67 install -m 755 busybox
"$prefix/bin/busybox" ||
exit 1
71 mkdir
-p "$prefix/$appdir" ||
exit 1
72 if [ "$scriptwrapper" = "y" ]; then
73 if [ "$swrapall" != "y" ] && [ "$i" = "/bin/sh" ]; then
74 ln $linkopts busybox
"$prefix/$i" ||
exit 1
77 echo "#!/bin/busybox" >"$prefix/$i"
82 if [ "$2" = "--hardlinks" ]; then
83 bb_path
="$prefix/bin/busybox"
93 bb_path
="../bin/busybox"
96 bb_path
="../../bin/busybox"
99 echo "Unknown installation directory: $appdir"
104 if [ "$noclobber" = "0" ] ||
[ ! -e "$prefix/$i" ]; then
105 echo " $prefix/$i -> $bb_path"
106 ln $linkopts "$bb_path" "$prefix/$i" ||
exit 1
108 echo " $prefix/$i already exists"