Explorar o código

Avoid double mounts

Zachary Kotlarek %!s(int64=13) %!d(string=hai) anos
pai
achega
6b50a1f6e5
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      mountMedia

+ 6 - 1
mountMedia

@@ -11,7 +11,12 @@ if ! ~/bin/video/isMediaMounted; then
 	fi
 
 	# Connect and fix links
-	osascript -e 'tell application "Finder" to mount volume "smb://atv@'${HOST}'/media"' >/dev/null
+	osascript -e \
+		'tell application "Finder"
+			if ((count of (every disk whose (displayed name contains "media" and local volume is false))) < 1) then
+				mount volume "smb://atv@'"${HOST}"'/media"
+			end if
+		end tell'
 	if [ -e '/Applications/Zach/Utilities/FixSMBLinks.app' ]; then
 		open '/Applications/Zach/Utilities/FixSMBLinks.app'
 	fi