Patch from Jason Schoon to add optional SIGUSR1 support to dd.
[oweals/busybox.git] / applets / install.sh
index cc6c1fa497591b59489f6be5e9a1b05ab4dd2fa4..e154996e3914ef3ed7ca740c71bcc6651832870b 100755 (executable)
@@ -5,7 +5,7 @@ export LC_CTYPE=POSIX
 
 prefix=${1}
 if [ -z "$prefix" ]; then
-    echo "No installation directory, aborting."
+    echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks]"
     exit 1;
 fi
 h=`sort busybox.links | uniq`
@@ -18,17 +18,19 @@ esac
 
 if [ "$DO_INSTALL_LIBS" != "n" ]; then
        # get the target dir for the libs
-       # This is an incomplete/incorrect list for now
-       case $(uname -m) in
-       x86_64|ppc64*|sparc64*|ia64*|hppa*64*) libdir=/lib64 ;;
-       *) libdir=/lib ;;
-       esac
+       # assume it starts with lib
+       libdir=$($CC -print-file-name=libc.so | \
+                sed -n 's%^.*\(/lib[^\/]*\)/libc.so%\1%p')
+       if test -z "$libdir"; then
+               libdir=/lib
+       fi
 
        mkdir -p $prefix/$libdir || exit 1
        for i in $DO_INSTALL_LIBS; do
                rm -f $prefix/$libdir/$i || exit 1
                if [ -f $i ]; then
-                       install -m 644 $i $prefix/$libdir/ || exit 1
+                       cp -a $i $prefix/$libdir/ || exit 1
+                       chmod 0644 $prefix/$libdir/$i || exit 1
                fi
        done
 fi