Eric Andersen | eded54b | 1999-11-12 08:03:23 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Eric Andersen | 39eea89 | 2001-03-08 21:42:11 +0000 | [diff] [blame] | 3 | export LC_ALL=POSIX |
| 4 | export LC_CTYPE=POSIX |
| 5 | |
Eric Andersen | e5db406 | 2000-07-25 16:47:03 +0000 | [diff] [blame] | 6 | prefix=$1 |
| 7 | if [ "$prefix" = "" ]; then |
Eric Andersen | a9c95ea | 1999-11-15 17:33:30 +0000 | [diff] [blame] | 8 | echo "No installation directory, aborting." |
Eric Andersen | eded54b | 1999-11-12 08:03:23 +0000 | [diff] [blame] | 9 | exit 1; |
| 10 | fi |
Eric Andersen | 51154ba | 2000-07-20 21:57:11 +0000 | [diff] [blame] | 11 | if [ "$2" = "--hardlinks" ]; then |
| 12 | linkopts="-f" |
| 13 | else |
| 14 | linkopts="-fs" |
| 15 | fi |
Eric Andersen | a9c95ea | 1999-11-15 17:33:30 +0000 | [diff] [blame] | 16 | h=`sort busybox.links | uniq` |
Eric Andersen | eded54b | 1999-11-12 08:03:23 +0000 | [diff] [blame] | 17 | |
Eric Andersen | 51154ba | 2000-07-20 21:57:11 +0000 | [diff] [blame] | 18 | |
Pavel Roskin | 259972e | 2000-07-28 19:34:02 +0000 | [diff] [blame] | 19 | rm -f $prefix/bin/busybox || exit 1 |
| 20 | mkdir -p $prefix/bin || exit 1 |
| 21 | install -m 755 busybox $prefix/bin/busybox || exit 1 |
Eric Andersen | eded54b | 1999-11-12 08:03:23 +0000 | [diff] [blame] | 22 | |
Eric Andersen | 51154ba | 2000-07-20 21:57:11 +0000 | [diff] [blame] | 23 | for i in $h ; do |
| 24 | appdir=`dirname $i` |
Pavel Roskin | 259972e | 2000-07-28 19:34:02 +0000 | [diff] [blame] | 25 | mkdir -p $prefix/$appdir || exit 1 |
Eric Andersen | 51154ba | 2000-07-20 21:57:11 +0000 | [diff] [blame] | 26 | 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 Roskin | 259972e | 2000-07-28 19:34:02 +0000 | [diff] [blame] | 48 | echo " $prefix$i -> $bb_path" |
| 49 | ln $linkopts $bb_path $prefix$i || exit 1 |
Eric Andersen | 51154ba | 2000-07-20 21:57:11 +0000 | [diff] [blame] | 50 | done |
| 51 | |
Eric Andersen | cb41c2e | 1999-11-22 07:41:00 +0000 | [diff] [blame] | 52 | exit 0 |