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