Eliminate superfluous test.
[oweals/busybox.git] / install.sh
1 #!/bin/sh
2
3 prefix=$1
4 if [ "$prefix" = "" ]; then
5     echo "No installation directory, aborting."
6     exit 1;
7 fi
8 if [ "$2" = "--hardlinks" ]; then
9     linkopts="-f"
10 else
11     linkopts="-fs"
12 fi
13 h=`sort busybox.links | uniq`
14
15
16 rm -f $prefix/bin/busybox || exit 1
17 mkdir -p $prefix/bin || exit 1
18 install -m 755 busybox $prefix/bin/busybox || exit 1
19
20 for i in $h ; do
21         appdir=`dirname $i`
22         mkdir -p $prefix/$appdir || exit 1
23         if [ "$2" = "--hardlinks" ]; then
24             bb_path="$prefix/bin/busybox"
25         else
26             case "$appdir" in
27                 /)
28                     bb_path="bin/busybox"
29                 ;;
30                 /bin)
31                     bb_path="busybox"
32                 ;;
33                 /sbin)
34                     bb_path="../bin/busybox"
35                 ;;
36                 /usr/bin|/usr/sbin)
37                     bb_path="../../bin/busybox"
38                 ;;
39                 *)
40                 echo "Unknown installation directory: $appdir"
41                 exit 1
42                 ;;
43             esac
44         fi
45         echo "  $prefix$i -> $bb_path"
46         ln $linkopts $bb_path $prefix$i || exit 1
47 done
48
49 exit 0