aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-04-05 02:37:15 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-04-05 02:37:15 +0200
commitc0644cac0d430a2925920aec6820dd103cdf145f (patch)
tree203639dacab650411170fca8f56d3515758e982d
parent9eb7bfd4d4ede3b6aa6a42595fd8824316ab4e2f (diff)
downloadbusybox-w32-c0644cac0d430a2925920aec6820dd103cdf145f.tar.gz
busybox-w32-c0644cac0d430a2925920aec6820dd103cdf145f.tar.bz2
busybox-w32-c0644cac0d430a2925920aec6820dd103cdf145f.zip
applets/install.sh: afer quoting of variables
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rwxr-xr-xapplets/install.sh69
1 files changed, 34 insertions, 35 deletions
diff --git a/applets/install.sh b/applets/install.sh
index 8f449d6b5..95b4719d4 100755
--- a/applets/install.sh
+++ b/applets/install.sh
@@ -3,12 +3,15 @@
3export LC_ALL=POSIX 3export LC_ALL=POSIX
4export LC_CTYPE=POSIX 4export LC_CTYPE=POSIX
5 5
6prefix=${1} 6prefix=$1
7if [ -z "$prefix" ]; then 7if [ -z "$prefix" ]; then
8 echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks/--scriptwrapper]" 8 echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks/--scriptwrapper]"
9 exit 1; 9 exit 1
10fi 10fi
11
11h=`sort busybox.links | uniq` 12h=`sort busybox.links | uniq`
13
14linkopts=""
12scriptwrapper="n" 15scriptwrapper="n"
13cleanup="0" 16cleanup="0"
14noclobber="0" 17noclobber="0"
@@ -33,12 +36,12 @@ if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then
33 libdir=/lib 36 libdir=/lib
34 fi 37 fi
35 38
36 mkdir -p $prefix/$libdir || exit 1 39 mkdir -p "$prefix/$libdir" || exit 1
37 for i in $DO_INSTALL_LIBS; do 40 for i in $DO_INSTALL_LIBS; do
38 rm -f $prefix/$libdir/$i || exit 1 41 rm -f "$prefix/$libdir/$i" || exit 1
39 if [ -f $i ]; then 42 if [ -f "$i" ]; then
40 cp -pPR $i $prefix/$libdir/ || exit 1 43 cp -pPR "$i" "$prefix/$libdir/" || exit 1
41 chmod 0644 $prefix/$libdir/$i || exit 1 44 chmod 0644 "$prefix/$libdir/$i" || exit 1
42 fi 45 fi
43 done 46 done
44fi 47fi
@@ -46,40 +49,40 @@ fi
46if [ "$cleanup" = "1" ] && [ -e "$prefix/bin/busybox" ]; then 49if [ "$cleanup" = "1" ] && [ -e "$prefix/bin/busybox" ]; then
47 inode=`ls -i "$prefix/bin/busybox" | awk '{print $1}'` 50 inode=`ls -i "$prefix/bin/busybox" | awk '{print $1}'`
48 sub_shell_it=` 51 sub_shell_it=`
49 cd "$prefix" 52 cd "$prefix"
50 for d in usr/sbin usr/bin sbin bin; do 53 for d in usr/sbin usr/bin sbin bin; do
51 pd=$PWD 54 pd=$PWD
52 if [ -d "$d" ]; then 55 if [ -d "$d" ]; then
53 cd $d 56 cd "$d"
54 ls -iL . | grep "^ *$inode" | awk '{print $2}' | env -i xargs rm -f 57 ls -iL . | grep "^ *$inode" | awk '{print $2}' | env -i xargs rm -f
55 fi 58 fi
56 cd "$pd" 59 cd "$pd"
57 done 60 done
58 ` 61 `
59 exit 0 62 exit 0
60fi 63fi
61 64
62rm -f $prefix/bin/busybox || exit 1 65rm -f "$prefix/bin/busybox" || exit 1
63mkdir -p $prefix/bin || exit 1 66mkdir -p "$prefix/bin" || exit 1
64install -m 755 busybox $prefix/bin/busybox || exit 1 67install -m 755 busybox "$prefix/bin/busybox" || exit 1
65 68
66for i in $h; do 69for i in $h; do
67 appdir=`dirname $i` 70 appdir=`dirname "$i"`
68 mkdir -p $prefix/$appdir || exit 1 71 mkdir -p "$prefix/$appdir" || exit 1
69 if [ "$scriptwrapper" = "y" ]; then 72 if [ "$scriptwrapper" = "y" ]; then
70 if [ "$swrapall" != "y" ] && [ "$i" = "/bin/sh" ]; then 73 if [ "$swrapall" != "y" ] && [ "$i" = "/bin/sh" ]; then
71 ln $linkopts busybox $prefix$i || exit 1 74 ln $linkopts busybox "$prefix/$i" || exit 1
72 else 75 else
73 rm -f $prefix$i 76 rm -f "$prefix/$i"
74 echo "#!/bin/busybox" > $prefix$i 77 echo "#!/bin/busybox" >"$prefix/$i"
75 chmod +x $prefix/$i 78 chmod +x "$prefix/$i"
76 fi 79 fi
77 echo " $prefix/$i" 80 echo " $prefix/$i"
78 else 81 else
79 if [ "$2" = "--hardlinks" ]; then 82 if [ "$2" = "--hardlinks" ]; then
80 bb_path="$prefix/bin/busybox" 83 bb_path="$prefix/bin/busybox"
81 else 84 else
82 case "/$appdir" in 85 case "$appdir" in
83 /) 86 /)
84 bb_path="bin/busybox" 87 bb_path="bin/busybox"
85 ;; 88 ;;
@@ -89,22 +92,18 @@ for i in $h; do
89 /sbin) 92 /sbin)
90 bb_path="../bin/busybox" 93 bb_path="../bin/busybox"
91 ;; 94 ;;
92 /usr/bin|/usr/sbin) 95 /usr/bin | /usr/sbin)
93 bb_path="../../bin/busybox" 96 bb_path="../../bin/busybox"
94 ;; 97 ;;
95 /root) # root/linuxrc (?!)
96 bb_path="bin/busybox"
97 i=$(basename $i)
98 ;;
99 *) 98 *)
100 echo "Unknown installation directory: $appdir" 99 echo "Unknown installation directory: $appdir"
101 exit 1 100 exit 1
102 ;; 101 ;;
103 esac 102 esac
104 fi 103 fi
105 if [ "$noclobber" = "0" ] || [ ! -e "$prefix/$i" ]; then 104 if [ "$noclobber" = "0" ] || [ ! -e "$prefix/$i" ]; then
106 echo " $prefix/$i -> $bb_path" 105 echo " $prefix/$i -> $bb_path"
107 ln $linkopts $bb_path $prefix/$i || exit 1 106 ln $linkopts "$bb_path" "$prefix/$i" || exit 1
108 else 107 else
109 echo " $prefix/$i already exists" 108 echo " $prefix/$i already exists"
110 fi 109 fi