diff options
Diffstat (limited to 'busybox/applets/install.sh')
-rwxr-xr-x | busybox/applets/install.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/busybox/applets/install.sh b/busybox/applets/install.sh new file mode 100755 index 000000000..d163a2ef8 --- /dev/null +++ b/busybox/applets/install.sh | |||
@@ -0,0 +1,52 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | export LC_ALL=POSIX | ||
4 | export LC_CTYPE=POSIX | ||
5 | |||
6 | prefix=$1 | ||
7 | if [ "$prefix" = "" ]; then | ||
8 | echo "No installation directory, aborting." | ||
9 | exit 1; | ||
10 | fi | ||
11 | if [ "$2" = "--hardlinks" ]; then | ||
12 | linkopts="-f" | ||
13 | else | ||
14 | linkopts="-fs" | ||
15 | fi | ||
16 | h=`sort busybox.links | uniq` | ||
17 | |||
18 | |||
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 | ||
22 | |||
23 | for i in $h ; do | ||
24 | appdir=`dirname $i` | ||
25 | mkdir -p $prefix/$appdir || exit 1 | ||
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 | ||
48 | echo " $prefix$i -> $bb_path" | ||
49 | ln $linkopts $bb_path $prefix$i || exit 1 | ||
50 | done | ||
51 | |||
52 | exit 0 | ||