mirror of
https://github.com/mabam/afpfs-ng-mac-GUI.git
synced 2025-01-04 18:29:26 +00:00
Updating scripts in “source”
This commit is contained in:
parent
ba96fbd205
commit
5eda2b2197
@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# only run commands if mount variables file is not empty (contains variables)
|
||||
if [ -s /etc/afpfs-ng-OSX/bin/AFP2_mount_vars ]; then \
|
||||
|
||||
source /etc/afpfs-ng-OSX/bin/AFP2_mount_vars
|
||||
mount_afp2 afp://"$afpServerIP"/"$afpVolumeName" /etc/afpfs-ng-OSX/mount/"$afpMountName"
|
||||
|
||||
osascript -e 'tell application "Finder"
|
||||
make new alias to POSIX file "/etc/afpfs-ng-OSX/mount/'"$afpMountName"'" at POSIX file "/etc/afpfs-ng-OSX/link/AFP2 Mounts"
|
||||
set name of result to "'"$afpMountName"'"
|
||||
end tell'
|
||||
|
||||
# clear content of mount variables file
|
||||
> /etc/afpfs-ng-OSX/bin/AFP2_mount_vars
|
||||
|
||||
sleep 2
|
||||
|
||||
# force quit volume selection app (required when first ran after system boot, probably due to bug in AppleScript)
|
||||
kill $(ps -ax | grep "afpfs-ng-OSX.volume_select.app" | awk '!/grep/' | cut -c 1-5)
|
||||
|
||||
fi
|
22
source/afpfs-ng-mac.mount_cmd.command
Executable file
22
source/afpfs-ng-mac.mount_cmd.command
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# only run commands if mount variables file is not empty (contains variables)
|
||||
if [ -s /usr/local/afpfs-ng-mac/bin/AFP2_mount_vars ]; then \
|
||||
|
||||
source /usr/local/afpfs-ng-mac/bin/AFP2_mount_vars
|
||||
mount_afp2 afp://"$afpServerIP"/"$afpVolumeName" /usr/local/afpfs-ng-mac/mount/"$afpMountName"
|
||||
|
||||
osascript -e 'tell application "Finder"
|
||||
make new alias to POSIX file "/usr/local/afpfs-ng-mac/mount/'"$afpMountName"'" at POSIX file "/usr/local/afpfs-ng-mac/link/AFP2 Mounts"
|
||||
set name of result to "'"$afpMountName"'"
|
||||
end tell'
|
||||
|
||||
# clear content of mount variables file
|
||||
> /usr/local/afpfs-ng-mac/bin/AFP2_mount_vars
|
||||
|
||||
sleep 2
|
||||
|
||||
# force quit volume selection app (required when first ran after system boot, probably due to bug in AppleScript)
|
||||
kill $(ps -ax | grep "afpfs-ng-mac.volume_select.app" | awk '!/grep/' | cut -c 1-5)
|
||||
|
||||
fi
|
@ -11,21 +11,21 @@ end replaceText
|
||||
|
||||
-- after installation, create folder for mount aliases and add to sidebar
|
||||
tell application "Finder"
|
||||
if not (exists "/etc/afpfs-ng-OSX/link/AFP2 Mounts" as POSIX file) then
|
||||
make new folder at "/etc/afpfs-ng-OSX/link/" as POSIX file with properties {name:"AFP2 Mounts"}
|
||||
if not (exists "/usr/local/afpfs-ng-mac/link/AFP2 Mounts" as POSIX file) then
|
||||
make new folder at "/usr/local/afpfs-ng-mac/link/" as POSIX file with properties {name:"AFP2 Mounts"}
|
||||
activate
|
||||
reveal "/etc/afpfs-ng-OSX/link/AFP2 Mounts" as POSIX file
|
||||
reveal "/usr/local/afpfs-ng-mac/link/AFP2 Mounts" as POSIX file
|
||||
tell application "System Events" to keystroke "t" using command down
|
||||
close window 1
|
||||
end if
|
||||
end tell
|
||||
|
||||
-- clear mount variables file in case previous run errored after volume selection
|
||||
do shell script "cat /dev/null > /etc/afpfs-ng-OSX/bin/AFP2_mount_vars"
|
||||
do shell script "cat /dev/null > /usr/local/afpfs-ng-mac/bin/AFP2_mount_vars"
|
||||
|
||||
-- after restart, clean up "mount" and "link/AFP2 Mounts" if volumes were unmounted by other means than unmount.command
|
||||
try
|
||||
do shell script "if ! test -e dev/osxfuse0; then rm -rf /etc/afpfs-ng-OSX/link/\"AFP2 Mounts\"/*; rmdir /etc/afpfs-ng-OSX/mount/*; fi"
|
||||
do shell script "if ! test -e /dev/macfuse0; then rm -rf /usr/local/afpfs-ng-mac/link/\"AFP2 Mounts\"/*; rmdir /usr/local/afpfs-ng-mac/mount/*; fi"
|
||||
end try
|
||||
|
||||
-- ping broadcast IP (x.x.x.255) to update device list for arp
|
||||
@ -55,10 +55,10 @@ end repeat
|
||||
|
||||
-- if AFP2 servers were found display them in a list, else display error message
|
||||
try
|
||||
tell application (path to frontmost application as text) to set afpServerChoice to choose from list afpServerList with title "afpfs-ng-OSX ¥ Server Selection" with prompt "Choose an AFP2.x server:" OK button name "Continue É"
|
||||
tell application (path to frontmost application as text) to set afpServerChoice to choose from list afpServerList with title "afpfs-ng-mac ¥ Server Selection" with prompt "Choose an AFP2.x server:" OK button name "Continue É"
|
||||
on error errStr number errorNumber
|
||||
if errorNumber is equal to -50 then
|
||||
tell application (path to frontmost application as text) to display dialog "No active AFP2.x servers found." with title "afpfs-ng-OSX ¥ Error" buttons {"OK"} default button "OK" with icon "/etc/afpfs-ng-OSX/icon/server.icns" as POSIX file
|
||||
tell application (path to frontmost application as text) to display dialog "No active AFP2.x servers found." with title "afpfs-ng-mac ¥ Error" buttons {"OK"} default button "OK" with icon "/usr/local/afpfs-ng-mac/icon/server.icns" as POSIX file
|
||||
error number -128 -- stop script execution
|
||||
end if
|
||||
end try
|
||||
@ -83,7 +83,7 @@ set afpVolumeLines to do shell script "/usr/local/bin/afpcmd afp://" & afpServer
|
||||
|
||||
-- display error message if no shared volumes have been found on server
|
||||
if afpVolumeLines is "rror" then
|
||||
tell application (path to frontmost application as text) to display dialog "No AFP2.x volumes found on Ò" & afpServerName & "Ó." with title "afpfs-ng-OSX ¥ Error" buttons {"OK"} default button "OK" with icon "/etc/afpfs-ng-OSX/icon/shared_volume.icns" as POSIX file
|
||||
tell application (path to frontmost application as text) to display dialog "No AFP2.x volumes found on Ò" & afpServerName & "Ó." with title "afpfs-ng-mac ¥ Error" buttons {"OK"} default button "OK" with icon "/usr/local/afpfs-ng-mac/icon/shared_volume.icns" as POSIX file
|
||||
error number -128 -- stop script execution
|
||||
end if
|
||||
|
||||
@ -93,7 +93,7 @@ set AppleScript's text item delimiters to ", "
|
||||
set afpVolumeList to text items of afpVolumeLines
|
||||
set AppleScript's text item delimiters to tid -- reset to original state
|
||||
|
||||
tell application (path to frontmost application as text) to set afpVolumeChoice to choose from list afpVolumeList with title "afpfs-ng-OSX ¥ Volume Selection" with prompt "Choose a volume from Ò" & afpServerName & "Ó:" OK button name "Mount"
|
||||
tell application (path to frontmost application as text) to set afpVolumeChoice to choose from list afpVolumeList with title "afpfs-ng-mac ¥ Volume Selection" with prompt "Choose a volume from Ò" & afpServerName & "Ó:" OK button name "Mount"
|
||||
-- if afpVolumeChoice is false then
|
||||
-- set afpUserPass to choose from list
|
||||
-- else
|
||||
@ -110,15 +110,15 @@ end try
|
||||
set afpMountNameRAW to afpVolumeName & "@" & afpServerName
|
||||
set afpMountName to replaceText(afpMountNameRAW, "'", "\\'")
|
||||
|
||||
-- prevent multiple aliases if attempting to mount the same volume more than once (the actual mounting isn't done twice by osxfuse)
|
||||
-- prevent multiple aliases if attempting to mount the same volume more than once (the actual mounting isn't done twice by macfuse)
|
||||
tell application "Finder"
|
||||
if exists "/etc/afpfs-ng-OSX/link/AFP2 Mounts/" & afpMountNameRAW as POSIX file then
|
||||
if exists "/usr/local/afpfs-ng-mac/link/AFP2 Mounts/" & afpMountNameRAW as POSIX file then
|
||||
error number -128 -- stop script execution
|
||||
else
|
||||
-- create mount point, load osxfuse if not yet running, load afpfs daemon
|
||||
-- export variables for beeing processed by afpfs-ng-OSX.mount_cmd.app
|
||||
-- launch afpfs-ng-OSX.mount_cmd.app to create mounts and aliases
|
||||
do shell script "mkdir /etc/afpfs-ng-OSX/mount/\"" & afpMountNameRAW & "\" && if ! test -e dev/osxfuse0; then /Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse && /usr/local/bin/afpfsd; fi
|
||||
echo afpServerIP=\\\"" & afpServerIP & "\\\" >> /etc/afpfs-ng-OSX/bin/AFP2_mount_vars; echo afpVolumeName=\\\"" & afpVolumeName & "\\\" >> /etc/afpfs-ng-OSX/bin/AFP2_mount_vars; echo afpMountName=\\\"" & afpMountName & "\\\" >> /etc/afpfs-ng-OSX/bin/AFP2_mount_vars; open /etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.mount_cmd.app"
|
||||
-- create mount point, load macfuse if not yet running, load afpfs daemon
|
||||
-- export variables for beeing processed by afpfs-ng-mac.mount_cmd.app
|
||||
-- launch afpfs-ng-mac.mount_cmd.app to create mounts and aliases
|
||||
do shell script "mkdir /usr/local/afpfs-ng-mac/mount/\"" & afpMountNameRAW & "\" && if ! test -e /dev/macfuse0; then /Library/Filesystems/macfuse.fs/Contents/Resources/load_macfuse && /usr/local/bin/afpfsd; fi
|
||||
echo afpServerIP=\\\"" & afpServerIP & "\\\" >> /usr/local/afpfs-ng-mac/bin/AFP2_mount_vars; echo afpVolumeName=\\\"" & afpVolumeName & "\\\" >> /usr/local/afpfs-ng-mac/bin/AFP2_mount_vars; echo afpMountName=\\\"" & afpMountName & "\\\" >> /usr/local/afpfs-ng-mac/bin/AFP2_mount_vars; open /usr/local/afpfs-ng-mac/bin/afpfs-ng-mac.mount_cmd.app"
|
||||
end if
|
||||
end tell
|
@ -3,64 +3,64 @@
|
||||
# check if AppleScript menu active
|
||||
if grep -q 'Script Menu.menu' ~/Library/Preferences/com.apple.systemuiserver.plist
|
||||
|
||||
# if AppleScript menu already active, point to it for controlling afpfs-ng-OSX
|
||||
then osascript -e 'tell application (path to frontmost application as text) to display dialog "Find “afpfs-ng-OSX” in the AppleScript menu to the right of your menu bar." & return & return & "There you can mount and unmount volumes." & return & return & "After first run, any mounted volumes will be available through “AFP2 Mounts” in the side bar of each Finder window." with title "afpfs-ng-OSX" buttons {"OK"} default button "OK" with icon "/etc/afpfs-ng-OSX/icon/logged_on_folder.icns" as POSIX file'
|
||||
# if AppleScript menu already active, point to it for controlling afpfs-ng-mac
|
||||
then osascript -e 'tell application (path to frontmost application as text) to display dialog "Find “afpfs-ng-mac” in the AppleScript menu to the right of your menu bar." & return & return & "There you can mount and unmount volumes." & return & return & "After first run, any mounted volumes will be available through “AFP2 Mounts” in the side bar of each Finder window." with title "afpfs-ng-mac" buttons {"OK"} default button "OK" with icon "/usr/local/afpfs-ng-mac/icon/logged_on_folder.icns" as POSIX file'
|
||||
|
||||
# if AppleScript menu not active, add it to SystemUIServer preferences and save as temp file
|
||||
else plutil -convert xml1 ~/Library/Preferences/com.apple.systemuiserver.plist -o - | awk '/<array>/{print;print "\t\t<string>/System/Library/CoreServices/Menu Extras/Script Menu.menu</string>";next}1' | plutil -convert binary1 - -o - > /etc/afpfs-ng-OSX/ScriptMenu.tmp
|
||||
else plutil -convert xml1 ~/Library/Preferences/com.apple.systemuiserver.plist -o - | awk '/<array>/{print;print "\t\t<string>/System/Library/CoreServices/Menu Extras/Script Menu.menu</string>";next}1' | plutil -convert binary1 - -o - > /usr/local/afpfs-ng-mac/ScriptMenu.tmp
|
||||
|
||||
# check temp file to verify conversion went fine
|
||||
if grep -q 'Script Menu.menu' /etc/afpfs-ng-OSX/ScriptMenu.tmp
|
||||
if grep -q 'Script Menu.menu' /usr/local/afpfs-ng-mac/ScriptMenu.tmp
|
||||
|
||||
# if conversion successful, backup SystemUIServer prefs, overwrite with temp file and restart SystemUIServer
|
||||
then mv ~/Library/Preferences/com.apple.systemuiserver.plist ~/Library/Preferences/com.apple.systemuiserver.plist.old; cp /etc/afpfs-ng-OSX/ScriptMenu.tmp ~/Library/Preferences/com.apple.systemuiserver.plist && $(sleep 1; killall SystemUIServer; open /System/Library/CoreServices/Menu\ Extras/Script\ Menu.menu); rm /etc/afpfs-ng-OSX/ScriptMenu.tmp
|
||||
then mv ~/Library/Preferences/com.apple.systemuiserver.plist ~/Library/Preferences/com.apple.systemuiserver.plist.old; cp /usr/local/afpfs-ng-mac/ScriptMenu.tmp ~/Library/Preferences/com.apple.systemuiserver.plist && $(sleep 1; killall SystemUIServer; open /System/Library/CoreServices/Menu\ Extras/Script\ Menu.menu); rm /usr/local/afpfs-ng-mac/ScriptMenu.tmp
|
||||
|
||||
# check if prefs are still intact after restarting SystemUIServer
|
||||
if grep -q 'Script Menu.menu' ~/Library/Preferences/com.apple.systemuiserver.plist
|
||||
|
||||
# if prefs are intact, point user to AppleScript menu
|
||||
then osascript -e 'tell application (path to frontmost application as text) to display dialog "The AppleScript menu to the right of your menu bar has been activated." & return & return & "There you can find “afpfs-ng-OSX” to mount and unmount volumes." & return & return & "After first run, any mounted volumes will be available through “AFP2 Mounts” in the side bar of each Finder window." with title "afpfs-ng-OSX" buttons {"OK"} default button "OK" with icon "/etc/afpfs-ng-OSX/icon/logged_on_folder.icns" as POSIX file'
|
||||
then osascript -e 'tell application (path to frontmost application as text) to display dialog "The AppleScript menu to the right of your menu bar has been activated." & return & return & "There you can find “afpfs-ng-mac” to mount and unmount volumes." & return & return & "After first run, any mounted volumes will be available through “AFP2 Mounts” in the side bar of each Finder window." with title "afpfs-ng-mac" buttons {"OK"} default button "OK" with icon "/usr/local/afpfs-ng-mac/icon/logged_on_folder.icns" as POSIX file'
|
||||
|
||||
# if prefs are not intact, offer to manually activate AppleScript menu or to retry automatically
|
||||
else rm ~/Library/Preferences/com.apple.systemuiserver.plist; mv ~/Library/Preferences/com.apple.systemuiserver.plist.old ~/Library/Preferences/com.apple.systemuiserver.plist; rm ~/Library/Preferences/com.apple.systemuiserver.plist.old; killall SystemUIServer; open /System/Library/CoreServices/SystemUIServer.app; osascript -e 'tell application "System Events"' -e 'if (name of processes) contains "Installer" then' -e 'tell application "Installer" to activate' -e 'end if' -e 'end tell' -e 'tell application (path to frontmost application as text) to display alert "Could not complete post-installation automatically" message "In order to mount and unmount volumes using afpfs-ng-OSX, the AppleScript menu has to be activated. It will then appear to the right of your menu bar." & return & return & "To activate it manually:" & return & "• Click on “Open Script Editor.app”," & return & "• select “Script Editor” –> “Preferences …” from the menu," & return & "• tick “Show Script menu in menu bar”." & return & return & "Alternatively you may retry automatic completion." & return & return & "Do you want to open Script Editor now?" buttons {"Open Script Editor.app", "Retry automatically"} default button "Open Script Editor.app" cancel button "Retry automatically"' -e 'tell application "AppleScript Editor" to activate' || $(plutil -convert xml1 ~/Library/Preferences/com.apple.systemuiserver.plist -o - | awk '/<array>/{print;print "\t\t<string>/System/Library/CoreServices/Menu Extras/Script Menu.menu</string>";next}1' | plutil -convert binary1 - -o - > /etc/afpfs-ng-OSX/ScriptMenu.tmp
|
||||
else rm ~/Library/Preferences/com.apple.systemuiserver.plist; mv ~/Library/Preferences/com.apple.systemuiserver.plist.old ~/Library/Preferences/com.apple.systemuiserver.plist; rm ~/Library/Preferences/com.apple.systemuiserver.plist.old; killall SystemUIServer; open /System/Library/CoreServices/SystemUIServer.app; osascript -e 'tell application "System Events"' -e 'if (name of processes) contains "Installer" then' -e 'tell application "Installer" to activate' -e 'end if' -e 'end tell' -e 'tell application (path to frontmost application as text) to display alert "Could not complete post-installation automatically" message "In order to mount and unmount volumes using afpfs-ng-mac, the AppleScript menu has to be activated. It will then appear to the right of your menu bar." & return & return & "To activate it manually:" & return & "• Click on “Open Script Editor.app”," & return & "• select “Script Editor” –> “Preferences …” from the menu," & return & "• tick “Show Script menu in menu bar”." & return & return & "Alternatively you may retry automatic completion." & return & return & "Do you want to open Script Editor now?" buttons {"Open Script Editor.app", "Retry automatically"} default button "Open Script Editor.app" cancel button "Retry automatically"' -e 'tell application "AppleScript Editor" to activate' || $(plutil -convert xml1 ~/Library/Preferences/com.apple.systemuiserver.plist -o - | awk '/<array>/{print;print "\t\t<string>/System/Library/CoreServices/Menu Extras/Script Menu.menu</string>";next}1' | plutil -convert binary1 - -o - > /usr/local/afpfs-ng-mac/ScriptMenu.tmp
|
||||
|
||||
# REPEAT ORIGINAL STEPS IF USER OPTED FOR AUTO RETRY - if failes again only offer manual activation
|
||||
if grep -q 'Script Menu.menu' /etc/afpfs-ng-OSX/ScriptMenu.tmp
|
||||
# REPEAT ORIGINAL STEPS IF USER OPTED FOR AUTO RETRY - if fails again only offer manual activation
|
||||
if grep -q 'Script Menu.menu' /usr/local/afpfs-ng-mac/ScriptMenu.tmp
|
||||
|
||||
then mv ~/Library/Preferences/com.apple.systemuiserver.plist ~/Library/Preferences/com.apple.systemuiserver.plist.old; cp /etc/afpfs-ng-OSX/ScriptMenu.tmp ~/Library/Preferences/com.apple.systemuiserver.plist && $(sleep 1; killall SystemUIServer; open /System/Library/CoreServices/Menu\ Extras/Script\ Menu.menu); rm /etc/afpfs-ng-OSX/ScriptMenu.tmp
|
||||
then mv ~/Library/Preferences/com.apple.systemuiserver.plist ~/Library/Preferences/com.apple.systemuiserver.plist.old; cp /usr/local/afpfs-ng-mac/ScriptMenu.tmp ~/Library/Preferences/com.apple.systemuiserver.plist && $(sleep 1; killall SystemUIServer; open /System/Library/CoreServices/Menu\ Extras/Script\ Menu.menu); rm /usr/local/afpfs-ng-mac/ScriptMenu.tmp
|
||||
|
||||
if grep -q 'Script Menu.menu' ~/Library/Preferences/com.apple.systemuiserver.plist
|
||||
|
||||
then osascript -e 'tell application (path to frontmost application as text) to display dialog "The AppleScript menu to the right of your menu bar has been activated." & return & return & "There you can find “afpfs-ng-OSX” to mount and unmount volumes." & return & return & "After first run, any mounted volumes will be available through “AFP2 Mounts” in the side bar of each Finder window." with title "afpfs-ng-OSX" buttons {"OK"} default button "OK" with icon "/etc/afpfs-ng-OSX/icon/logged_on_folder.icns" as POSIX file'
|
||||
then osascript -e 'tell application (path to frontmost application as text) to display dialog "The AppleScript menu to the right of your menu bar has been activated." & return & return & "There you can find “afpfs-ng-mac” to mount and unmount volumes." & return & return & "After first run, any mounted volumes will be available through “AFP2 Mounts” in the side bar of each Finder window." with title "afpfs-ng-mac" buttons {"OK"} default button "OK" with icon "/usr/local/afpfs-ng-mac/icon/logged_on_folder.icns" as POSIX file'
|
||||
|
||||
else rm ~/Library/Preferences/com.apple.systemuiserver.plist; mv ~/Library/Preferences/com.apple.systemuiserver.plist.old ~/Library/Preferences/com.apple.systemuiserver.plist; rm ~/Library/Preferences/com.apple.systemuiserver.plist.old; killall SystemUIServer; open /System/Library/CoreServices/SystemUIServer.app; osascript -e 'tell application "System Events"' -e 'if (name of processes) contains "Installer" then' -e 'tell application "Installer" to activate' -e 'end if' -e 'end tell' -e 'tell application (path to frontmost application as text) to display alert "Could not complete post-installation automatically" message "In order to mount and unmount volumes using afpfs-ng-OSX, you must activate the AppleScript menu manually. It will then appear to the right of your menu bar." & return & return & "Follow these steps:" & return & "• Click on “Open Script Editor.app”," & return & "• select “Script Editor” –> “Preferences …” from the menu," & return & "• tick “Show Script menu in menu bar”." buttons {"Open Script Editor.app"} default button "Open Script Editor.app"' -e 'tell application "AppleScript Editor" to activate'
|
||||
else rm ~/Library/Preferences/com.apple.systemuiserver.plist; mv ~/Library/Preferences/com.apple.systemuiserver.plist.old ~/Library/Preferences/com.apple.systemuiserver.plist; rm ~/Library/Preferences/com.apple.systemuiserver.plist.old; killall SystemUIServer; open /System/Library/CoreServices/SystemUIServer.app; osascript -e 'tell application "System Events"' -e 'if (name of processes) contains "Installer" then' -e 'tell application "Installer" to activate' -e 'end if' -e 'end tell' -e 'tell application (path to frontmost application as text) to display alert "Could not complete post-installation automatically" message "In order to mount and unmount volumes using afpfs-ng-mac, you must activate the AppleScript menu manually. It will then appear to the right of your menu bar." & return & return & "Follow these steps:" & return & "• Click on “Open Script Editor.app”," & return & "• select “Script Editor” –> “Preferences …” from the menu," & return & "• tick “Show Script menu in menu bar”." buttons {"Open Script Editor.app"} default button "Open Script Editor.app"' -e 'tell application "AppleScript Editor" to activate'
|
||||
fi
|
||||
|
||||
else rm /etc/afpfs-ng-OSX/ScriptMenu.tmp; osascript -e 'tell application "System Events"' -e 'if (name of processes) contains "Installer" then' -e 'tell application "Installer" to activate' -e 'end if' -e 'end tell' -e 'tell application (path to frontmost application as text) to display alert "Could not complete post-installation automatically" message "In order to mount and unmount volumes using afpfs-ng-OSX, you must activate the AppleScript menu manually. It will then appear to the right of your menu bar." & return & return & "Follow these steps:" & return & "• Click on “Open Script Editor.app”," & return & "• select “Script Editor” –> “Preferences …” from the menu," & return & "• tick “Show Script menu in menu bar”." buttons {"Open Script Editor.app"} default button "Open Script Editor.app"' -e 'tell application "AppleScript Editor" to activate'
|
||||
else rm /usr/local/afpfs-ng-mac/ScriptMenu.tmp; osascript -e 'tell application "System Events"' -e 'if (name of processes) contains "Installer" then' -e 'tell application "Installer" to activate' -e 'end if' -e 'end tell' -e 'tell application (path to frontmost application as text) to display alert "Could not complete post-installation automatically" message "In order to mount and unmount volumes using afpfs-ng-mac, you must activate the AppleScript menu manually. It will then appear to the right of your menu bar." & return & return & "Follow these steps:" & return & "• Click on “Open Script Editor.app”," & return & "• select “Script Editor” –> “Preferences …” from the menu," & return & "• tick “Show Script menu in menu bar”." buttons {"Open Script Editor.app"} default button "Open Script Editor.app"' -e 'tell application "AppleScript Editor" to activate'
|
||||
fi)
|
||||
# END REPEAT ORIGINAL STEPS IF USER OPTED FOR AUTO RETRY
|
||||
|
||||
fi
|
||||
|
||||
# if temp file is not intact, offer to manually activate AppleScript menu or to retry automatically
|
||||
else rm /etc/afpfs-ng-OSX/ScriptMenu.tmp; osascript -e 'tell application "System Events"' -e 'if (name of processes) contains "Installer" then' -e 'tell application "Installer" to activate' -e 'end if' -e 'end tell' -e 'tell application (path to frontmost application as text) to display alert "Could not complete post-installation automatically" message "In order to mount and unmount volumes using afpfs-ng-OSX, the AppleScript menu has to be activated. It will then appear to the right of your menu bar." & return & return & "To activate it manually:" & return & "• Click on “Open Script Editor.app”," & return & "• select “Script Editor” –> “Preferences …” from the menu," & return & "• tick “Show Script menu in menu bar”." & return & return & "Alternatively you may retry automatic completion." & return & return & "Do you want to open Script Editor now?" buttons {"Open Script Editor.app", "Retry automatically"} default button "Open Script Editor.app" cancel button "Retry automatically"' -e 'tell application "AppleScript Editor" to activate' || $(plutil -convert xml1 ~/Library/Preferences/com.apple.systemuiserver.plist -o - | awk '/<array>/{print;print "\t\t<string>/System/Library/CoreServices/Menu Extras/Script Menu.menu</string>";next}1' | plutil -convert binary1 - -o - > /etc/afpfs-ng-OSX/ScriptMenu.tmp
|
||||
else rm /usr/local/afpfs-ng-mac/ScriptMenu.tmp; osascript -e 'tell application "System Events"' -e 'if (name of processes) contains "Installer" then' -e 'tell application "Installer" to activate' -e 'end if' -e 'end tell' -e 'tell application (path to frontmost application as text) to display alert "Could not complete post-installation automatically" message "In order to mount and unmount volumes using afpfs-ng-mac, the AppleScript menu has to be activated. It will then appear to the right of your menu bar." & return & return & "To activate it manually:" & return & "• Click on “Open Script Editor.app”," & return & "• select “Script Editor” –> “Preferences …” from the menu," & return & "• tick “Show Script menu in menu bar”." & return & return & "Alternatively you may retry automatic completion." & return & return & "Do you want to open Script Editor now?" buttons {"Open Script Editor.app", "Retry automatically"} default button "Open Script Editor.app" cancel button "Retry automatically"' -e 'tell application "AppleScript Editor" to activate' || $(plutil -convert xml1 ~/Library/Preferences/com.apple.systemuiserver.plist -o - | awk '/<array>/{print;print "\t\t<string>/System/Library/CoreServices/Menu Extras/Script Menu.menu</string>";next}1' | plutil -convert binary1 - -o - > /usr/local/afpfs-ng-mac/ScriptMenu.tmp
|
||||
|
||||
# REPEAT ORIGINAL STEPS IF USER OPTED FOR AUTO RETRY - if failes again only offer manual activation
|
||||
if grep -q 'Script Menu.menu' /etc/afpfs-ng-OSX/ScriptMenu.tmp
|
||||
# REPEAT ORIGINAL STEPS IF USER OPTED FOR AUTO RETRY - if fails again only offer manual activation
|
||||
if grep -q 'Script Menu.menu' /usr/local/afpfs-ng-mac/ScriptMenu.tmp
|
||||
|
||||
then mv ~/Library/Preferences/com.apple.systemuiserver.plist ~/Library/Preferences/com.apple.systemuiserver.plist.old; cp /etc/afpfs-ng-OSX/ScriptMenu.tmp ~/Library/Preferences/com.apple.systemuiserver.plist && $(sleep 1; killall SystemUIServer; open /System/Library/CoreServices/Menu\ Extras/Script\ Menu.menu); rm /etc/afpfs-ng-OSX/ScriptMenu.tmp
|
||||
then mv ~/Library/Preferences/com.apple.systemuiserver.plist ~/Library/Preferences/com.apple.systemuiserver.plist.old; cp /usr/local/afpfs-ng-mac/ScriptMenu.tmp ~/Library/Preferences/com.apple.systemuiserver.plist && $(sleep 1; killall SystemUIServer; open /System/Library/CoreServices/Menu\ Extras/Script\ Menu.menu); rm /usr/local/afpfs-ng-mac/ScriptMenu.tmp
|
||||
|
||||
if grep -q 'Script Menu.menu' ~/Library/Preferences/com.apple.systemuiserver.plist
|
||||
|
||||
then osascript -e 'tell application (path to frontmost application as text) to display dialog "The AppleScript menu to the right of your menu bar has been activated." & return & return & "There you can find “afpfs-ng-OSX” to mount and unmount volumes." & return & return & "After first run, any mounted volumes will be available through “AFP2 Mounts” in the side bar of each Finder window." with title "afpfs-ng-OSX" buttons {"OK"} default button "OK" with icon "/etc/afpfs-ng-OSX/icon/logged_on_folder.icns" as POSIX file'
|
||||
then osascript -e 'tell application (path to frontmost application as text) to display dialog "The AppleScript menu to the right of your menu bar has been activated." & return & return & "There you can find “afpfs-ng-mac” to mount and unmount volumes." & return & return & "After first run, any mounted volumes will be available through “AFP2 Mounts” in the side bar of each Finder window." with title "afpfs-ng-mac" buttons {"OK"} default button "OK" with icon "/usr/local/afpfs-ng-mac/icon/logged_on_folder.icns" as POSIX file'
|
||||
|
||||
else rm ~/Library/Preferences/com.apple.systemuiserver.plist; mv ~/Library/Preferences/com.apple.systemuiserver.plist.old ~/Library/Preferences/com.apple.systemuiserver.plist; rm ~/Library/Preferences/com.apple.systemuiserver.plist.old; killall SystemUIServer; open /System/Library/CoreServices/SystemUIServer.app; osascript -e 'tell application "System Events"' -e 'if (name of processes) contains "Installer" then' -e 'tell application "Installer" to activate' -e 'end if' -e 'end tell' -e 'tell application (path to frontmost application as text) to display alert "Could not complete post-installation automatically" message "In order to mount and unmount volumes using afpfs-ng-OSX, you must activate the AppleScript menu manually. It will then appear to the right of your menu bar." & return & return & "Follow these steps:" & return & "• Click on “Open Script Editor.app”," & return & "• select “Script Editor” –> “Preferences …” from the menu," & return & "• tick “Show Script menu in menu bar”." buttons {"Open Script Editor.app"} default button "Open Script Editor.app"' -e 'tell application "AppleScript Editor" to activate'
|
||||
else rm ~/Library/Preferences/com.apple.systemuiserver.plist; mv ~/Library/Preferences/com.apple.systemuiserver.plist.old ~/Library/Preferences/com.apple.systemuiserver.plist; rm ~/Library/Preferences/com.apple.systemuiserver.plist.old; killall SystemUIServer; open /System/Library/CoreServices/SystemUIServer.app; osascript -e 'tell application "System Events"' -e 'if (name of processes) contains "Installer" then' -e 'tell application "Installer" to activate' -e 'end if' -e 'end tell' -e 'tell application (path to frontmost application as text) to display alert "Could not complete post-installation automatically" message "In order to mount and unmount volumes using afpfs-ng-mac, you must activate the AppleScript menu manually. It will then appear to the right of your menu bar." & return & return & "Follow these steps:" & return & "• Click on “Open Script Editor.app”," & return & "• select “Script Editor” –> “Preferences …” from the menu," & return & "• tick “Show Script menu in menu bar”." buttons {"Open Script Editor.app"} default button "Open Script Editor.app"' -e 'tell application "AppleScript Editor" to activate'
|
||||
fi
|
||||
|
||||
else rm /etc/afpfs-ng-OSX/ScriptMenu.tmp; osascript -e 'tell application "System Events"' -e 'if (name of processes) contains "Installer" then' -e 'tell application "Installer" to activate' -e 'end if' -e 'end tell' -e 'tell application (path to frontmost application as text) to display alert "Could not complete post-installation automatically" message "In order to mount and unmount volumes using afpfs-ng-OSX, you must activate the AppleScript menu manually. It will then appear to the right of your menu bar." & return & return & "Follow these steps:" & return & "• Click on “Open Script Editor.app”," & return & "• select “Script Editor” –> “Preferences …” from the menu," & return & "• tick “Show Script menu in menu bar”." buttons {"Open Script Editor.app"} default button "Open Script Editor.app"' -e 'tell application "AppleScript Editor" to activate'
|
||||
else rm /usr/local/afpfs-ng-mac/ScriptMenu.tmp; osascript -e 'tell application "System Events"' -e 'if (name of processes) contains "Installer" then' -e 'tell application "Installer" to activate' -e 'end if' -e 'end tell' -e 'tell application (path to frontmost application as text) to display alert "Could not complete post-installation automatically" message "In order to mount and unmount volumes using afpfs-ng-mac, you must activate the AppleScript menu manually. It will then appear to the right of your menu bar." & return & return & "Follow these steps:" & return & "• Click on “Open Script Editor.app”," & return & "• select “Script Editor” –> “Preferences …” from the menu," & return & "• tick “Show Script menu in menu bar”." buttons {"Open Script Editor.app"} default button "Open Script Editor.app"' -e 'tell application "AppleScript Editor" to activate'
|
||||
fi)
|
||||
# END REPEAT ORIGINAL STEPS IF USER OPTED FOR AUTO RETRY
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue
Block a user