aboutsummaryrefslogtreecommitdiff
path: root/busybox/applets/install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'busybox/applets/install.sh')
-rwxr-xr-xbusybox/applets/install.sh52
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
3export LC_ALL=POSIX
4export LC_CTYPE=POSIX
5
6prefix=$1
7if [ "$prefix" = "" ]; then
8 echo "No installation directory, aborting."
9 exit 1;
10fi
11if [ "$2" = "--hardlinks" ]; then
12 linkopts="-f"
13else
14 linkopts="-fs"
15fi
16h=`sort busybox.links | uniq`
17
18
19rm -f $prefix/bin/busybox || exit 1
20mkdir -p $prefix/bin || exit 1
21install -m 755 busybox $prefix/bin/busybox || exit 1
22
23for 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
50done
51
52exit 0