]> gitweb.fluxo.info Git - trashman.git/commitdiff
Trashman install detects if it is running the system-wide version
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 17 Nov 2017 12:36:43 +0000 (10:36 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 17 Nov 2017 12:36:43 +0000 (10:36 -0200)
share/trashman/trashman/unix/install

index 289a6537a471438dfd6c5183479feb870aba5165..db2206c0b5962d63e2a6d697803bd38bfb608bf8 100755 (executable)
@@ -17,8 +17,14 @@ if ! which rsync > /dev/null 2>&1; then
   exit 1
 fi
 
-# Install
-rsync -av --delete $BASE/ $FOLDER/share/trashman/ || exit 1
+# Ensure folders exists and we have their absolute names
+FOLDER="`mkdir -p $FOLDER && cd $FOLDER > /dev/null && pwd`"
+BASE="`cd $BASE > /dev/null && pwd`"
+
+# Install if we're not already running the system-wide version
+if [ "$BASE" != "$FOLDER" ]; then
+  rsync -av --delete $BASE/ $FOLDER/share/trashman/ || exit 1
+fi
 
 # Create symlink
 ( cd $FOLDER/bin && ln -sf $FOLDER/share/trashman/trashman ) || exit 1