blob: d163a2ef84303034728339ebffa4e19cb68ab32e [file] [log] [blame]
Eric Anderseneded54b1999-11-12 08:03:23 +00001#!/bin/sh
2
Eric Andersen39eea892001-03-08 21:42:11 +00003export LC_ALL=POSIX
4export LC_CTYPE=POSIX
5
Eric Andersene5db4062000-07-25 16:47:03 +00006prefix=$1
7if [ "$prefix" = "" ]; then
Eric Andersena9c95ea1999-11-15 17:33:30 +00008 echo "No installation directory, aborting."
Eric Anderseneded54b1999-11-12 08:03:23 +00009 exit 1;
10fi
Eric Andersen51154ba2000-07-20 21:57:11 +000011if [ "$2" = "--hardlinks" ]; then
12 linkopts="-f"
13else
14 linkopts="-fs"
15fi
Eric Andersena9c95ea1999-11-15 17:33:30 +000016h=`sort busybox.links | uniq`
Eric Anderseneded54b1999-11-12 08:03:23 +000017
Eric Andersen51154ba2000-07-20 21:57:11 +000018
Pavel Roskin259972e2000-07-28 19:34:02 +000019rm -f $prefix/bin/busybox || exit 1
20mkdir -p $prefix/bin || exit 1
21install -m 755 busybox $prefix/bin/busybox || exit 1
Eric Anderseneded54b1999-11-12 08:03:23 +000022
Eric Andersen51154ba2000-07-20 21:57:11 +000023for i in $h ; do
24 appdir=`dirname $i`
Pavel Roskin259972e2000-07-28 19:34:02 +000025 mkdir -p $prefix/$appdir || exit 1
Eric Andersen51154ba2000-07-20 21:57:11 +000026 if [ "$2" = "--hardlinks" ]; then
27 bb_path="$prefix/bin/busybox"
28 else
29 case "$appdir" in
30 /)
31 bb_path="bin/busybox"
32 ;;
33 /bin)
34 bb_path="busybox"
35 ;;
36 /sbin)
37 bb_path="../bin/busybox"
38 ;;
39 /usr/bin|/usr/sbin)
40 bb_path="../../bin/busybox"
41 ;;
42 *)
43 echo "Unknown installation directory: $appdir"
44 exit 1
45 ;;
46 esac
47 fi
Pavel Roskin259972e2000-07-28 19:34:02 +000048 echo " $prefix$i -> $bb_path"
49 ln $linkopts $bb_path $prefix$i || exit 1
Eric Andersen51154ba2000-07-20 21:57:11 +000050done
51
Eric Andersencb41c2e1999-11-22 07:41:00 +000052exit 0