diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-02-23 16:29:26 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-02-23 16:29:26 +0100 |
commit | bf39d97e9d9422537970ed8c3af1b8270bdf0ac0 (patch) | |
tree | b16430a145b2f8c039e5edec5cb2ba5d6c912a8e | |
parent | 3177626033fa58fcb60e29009936f08f16e6a99c (diff) | |
download | busybox-w32-bf39d97e9d9422537970ed8c3af1b8270bdf0ac0.tar.gz busybox-w32-bf39d97e9d9422537970ed8c3af1b8270bdf0ac0.tar.bz2 busybox-w32-bf39d97e9d9422537970ed8c3af1b8270bdf0ac0.zip |
Fix install with hardlinks and a custom PREFIX. Closes 10801
Trying to install busybox with hardlinks and a custom PREFIX will fail
for applets not in the /bin directory, because relative pathnames are
used. applets/install.sh is *supposed to* use the absolute pathname
for hardlinks but it fails to do so because the wrong check is used
in the if statement.
While fixing it, shore up other sloppy coding in applets/install.sh
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rwxr-xr-x | applets/install.sh | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/applets/install.sh b/applets/install.sh index ae99381d7..c75a78e9d 100755 --- a/applets/install.sh +++ b/applets/install.sh | |||
@@ -38,7 +38,7 @@ while [ ${#} -gt 0 ]; do | |||
38 | shift | 38 | shift |
39 | done | 39 | done |
40 | 40 | ||
41 | if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then | 41 | if [ -n "$DO_INSTALL_LIBS" ] && [ x"$DO_INSTALL_LIBS" != x"n" ]; then |
42 | # get the target dir for the libs | 42 | # get the target dir for the libs |
43 | # assume it starts with lib | 43 | # assume it starts with lib |
44 | libdir=$($CC -print-file-name=libc.so | \ | 44 | libdir=$($CC -print-file-name=libc.so | \ |
@@ -58,7 +58,7 @@ if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then | |||
58 | done | 58 | done |
59 | fi | 59 | fi |
60 | 60 | ||
61 | if [ "$cleanup" = "1" ] && [ -e "$prefix/bin/busybox" ]; then | 61 | if [ x"$cleanup" = x"1" ] && [ -e "$prefix/bin/busybox" ]; then |
62 | inode=`ls -i "$prefix/bin/busybox" | awk '{print $1}'` | 62 | inode=`ls -i "$prefix/bin/busybox" | awk '{print $1}'` |
63 | sub_shell_it=` | 63 | sub_shell_it=` |
64 | cd "$prefix" | 64 | cd "$prefix" |
@@ -81,13 +81,13 @@ install -m 755 busybox "$prefix/bin/busybox" || exit 1 | |||
81 | for i in $h; do | 81 | for i in $h; do |
82 | appdir=`dirname "$i"` | 82 | appdir=`dirname "$i"` |
83 | app=`basename "$i"` | 83 | app=`basename "$i"` |
84 | if [ "$noclobber" = "1" ] && [ -e "$prefix/$i" ]; then | 84 | if [ x"$noclobber" = x"1" ] && [ -e "$prefix/$i" ]; then |
85 | echo " $prefix/$i already exists" | 85 | echo " $prefix/$i already exists" |
86 | continue | 86 | continue |
87 | fi | 87 | fi |
88 | mkdir -p "$prefix/$appdir" || exit 1 | 88 | mkdir -p "$prefix/$appdir" || exit 1 |
89 | if [ "$scriptwrapper" = "y" ]; then | 89 | if [ x"$scriptwrapper" = x"y" ]; then |
90 | if [ "$swrapall" != "y" ] && [ "$i" = "/bin/sh" ]; then | 90 | if [ x"$swrapall" != x"y" ] && [ x"$i" = x"/bin/sh" ]; then |
91 | ln $linkopts busybox "$prefix/$i" || exit 1 | 91 | ln $linkopts busybox "$prefix/$i" || exit 1 |
92 | else | 92 | else |
93 | rm -f "$prefix/$i" | 93 | rm -f "$prefix/$i" |
@@ -95,17 +95,17 @@ for i in $h; do | |||
95 | chmod +x "$prefix/$i" | 95 | chmod +x "$prefix/$i" |
96 | fi | 96 | fi |
97 | echo " $prefix/$i" | 97 | echo " $prefix/$i" |
98 | elif [ "$binaries" = "y" ]; then | 98 | elif [ x"$binaries" = x"y" ]; then |
99 | # Copy the binary over rather | 99 | # Copy the binary over rather |
100 | if [ -e $sharedlib_dir/$app ]; then | 100 | if [ -e "$sharedlib_dir/$app" ]; then |
101 | echo " Copying $sharedlib_dir/$app to $prefix/$i" | 101 | echo " Copying $sharedlib_dir/$app to $prefix/$i" |
102 | cp -pPR $sharedlib_dir/$app $prefix/$i || exit 1 | 102 | cp -pPR "$sharedlib_dir/$app" "$prefix/$i" || exit 1 |
103 | else | 103 | else |
104 | echo "Error: Could not find $sharedlib_dir/$app" | 104 | echo "Error: Could not find $sharedlib_dir/$app" |
105 | exit 1 | 105 | exit 1 |
106 | fi | 106 | fi |
107 | else | 107 | else |
108 | if [ "$2" = "--hardlinks" ]; then | 108 | if [ x"$linkopts" = x"-f" ]; then |
109 | bb_path="$prefix/bin/busybox" | 109 | bb_path="$prefix/bin/busybox" |
110 | else | 110 | else |
111 | case "$appdir" in | 111 | case "$appdir" in |