diff --git a/contrib/install.sh b/contrib/install.sh index cb8a43b3496c3..9335c801bed10 100755 --- a/contrib/install.sh +++ b/contrib/install.sh @@ -15,14 +15,15 @@ done DEST=$1 for SRC in $ARGS; do - # Copy file, then take output of the form 'src' -> 'dest' and get only 'dest' - DESTFILE=$(LC_ALL=C cp -va $SRC $DEST | sed -e $'s/ -> /\\\n/g' | tail -n 1) + cp -a $SRC $DEST - # If there are surrounding quotes, remove them. We do this simply by knowing that the destination is always an absolute path - if [ "$(echo $DESTFILE | head -c1)" != "/" ]; then - DESTFILE=$(echo $DESTFILE | awk '{print substr($0, 2, length($0)-2)}') + if [ -d "$DEST" ]; then + DESTFILE="$DEST/$(basename "$SRC")" + else + DESTFILE="$DEST" fi # Do the chmod dance, and ignore errors on platforms that don't like setting permissions of symlinks + # TODO: Test if it's a symlink instead of having to redirect stderr to /dev/null chmod $PERMS $DESTFILE 2>/dev/null done