Advertisement
Guest User

Mount.app

a guest
Oct 11th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.77 KB | None | 0 0
  1. #!/usr/bin/env /usr/local/bin/fish
  2.  
  3. set server "smb://Drive"
  4. set DriveA $server"/DriveA"
  5. set DriveB $server"/DriveB"
  6.  
  7. function unmount_rmdir
  8.     if test -d "$argv[1]"
  9.         diskutil unmount $argv[1]
  10.         rmdir $argv[1]
  11.     end
  12. end
  13.  
  14. function mkdir_mount
  15.     if ! test -d "$argv[1]/$argv[3]"
  16.         if ! test -d "$argv[1]"
  17.             mkdir "$argv[1]"
  18.         end
  19.         mount -t smbfs "$argv[2]" "$argv[1]"
  20.     end
  21. end
  22.  
  23. if ! test -w "/Volumes"
  24.     /usr/bin/osascript -e 'do shell script "chmod 777 /Volumes && chown me /Volumes" with administrator privileges'
  25. end
  26.  
  27. unmount_rmdir /Volumes/DriveB-1
  28. unmount_rmdir /Volumes/DriveB-2
  29. unmount_rmdir /Volumes/DriveA-1
  30. unmount_rmdir /Volumes/Drive-2
  31.  
  32. mkdir_mount /Volumes/DriveA $DriveA Pictures
  33. mkdir_mount /Volumes/DriveA $DriveB Documents
  34.  
  35. killall Dock
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement