Browse Source

Stop blowing away other ramdisks

R. Alex Matevish 1 year ago
parent
commit
c63e23aa92
1 changed files with 5 additions and 1 deletions
  1. 5 1
      run.sh

+ 5 - 1
run.sh

@@ -84,8 +84,12 @@ while getopts "miedr" opt; do
       tar --exclude=".*" -zcv $STASH_DIR/* | gpg --encrypt -r $ME - > "$STASH_FILE";
       ;;
     d)
-      if [ -f "$RAMDISK_FILE" ]; then
+      # Check if we have both a ramdisk *and* a mount before we rm_ramdisk, to avoid blowing away another ramdisk
+      # that $RAMDISK_FILE might be referencing
+      if ls $OSX_STASH_LOCATION &> /dev/null; then
         rm_ramdisk;
+      elif [ -f "$RAMDISK_FILE" ]; then
+        rm $RAMDISK_FILE;
       fi
 
       mk_ramdisk;