summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger2006-06-07 18:12:27 +0000
committerMike Frysinger2006-06-07 18:12:27 +0000
commite3fdf2431a6baa4ee999b25e3d3f3d8fc4f32dc1 (patch)
tree86ef65755dea822a5e05e7a3ad3e88a9ecb13b6f
parent81514ecca37fdd0d158377287a45db8aaa926d67 (diff)
downloadbusybox-e3fdf2431a6baa4ee999b25e3d3f3d8fc4f32dc1.zip
busybox-e3fdf2431a6baa4ee999b25e3d3f3d8fc4f32dc1.tar.gz
add a --noclobber flag
-rwxr-xr-xapplets/install.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/applets/install.sh b/applets/install.sh
index 1cd97bb..4ec96c2 100755
--- a/applets/install.sh
+++ b/applets/install.sh
@@ -10,10 +10,12 @@ if [ -z "$prefix" ]; then
fi
h=`sort busybox.links | uniq`
cleanup="0"
+noclobber="0"
case "$2" in
--hardlinks) linkopts="-f";;
--symlinks) linkopts="-fs";;
--cleanup) cleanup="1";;
+ --noclobber) noclobber="1";;
"") h="";;
*) echo "Unknown install option: $2"; exit 1;;
esac
@@ -81,8 +83,12 @@ for i in $h ; do
;;
esac
fi
- echo " $prefix$i -> $bb_path"
- ln $linkopts $bb_path $prefix$i || exit 1
+ if [ "$noclobber" = "0" ] || [ ! -e "$prefix$i" ]; then
+ echo " $prefix$i -> $bb_path"
+ ln $linkopts $bb_path $prefix$i || exit 1
+ else
+ echo " $prefix$i already exists"
+ fi
done
exit 0