mirror of
https://github.com/mabam/afpfs-ng-mac-GUI.git
synced 2025-02-17 01:30:49 +00:00
v1.0 (first commit)
This commit is contained in:
parent
aea2d7e4e4
commit
dda795400a
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
$ cat .gitignore
|
||||
.DS_Store
|
BIN
Library/Scripts/afpfs-ng-OSX/Mount AFP2.x volume.scpt
Executable file
BIN
Library/Scripts/afpfs-ng-OSX/Mount AFP2.x volume.scpt
Executable file
Binary file not shown.
BIN
Library/Scripts/afpfs-ng-OSX/Unmount ALL AFP2.x volumes.scpt
Executable file
BIN
Library/Scripts/afpfs-ng-OSX/Unmount ALL AFP2.x volumes.scpt
Executable file
Binary file not shown.
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
||||
## afpfs-ng-OSX GUI
|
||||
|
||||
This repository contains the GUI related files included in the .pkg installer at https://github.com/mabam/afpfs-ng-OSX/releases .
|
||||
|
||||
"Library" and "etc" contain GUI related files and folders at the locations the afpfs-ng-OSX .pkg installer writes them to the boot partition.
|
||||
|
||||
"source" contains the uncompiled scripts of two of those files (I used Platypus for compiling afpfs-ng-OSX.mount_cmd.command).
|
||||
|
||||
"source/post-installation script" contains the post-install script built into the .pkg installer.
|
0
etc/afpfs-ng-OSX/bin/AFP2_mount_vars
Normal file
0
etc/afpfs-ng-OSX/bin/AFP2_mount_vars
Normal file
BIN
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.mount_cmd.app/Contents/Info.plist
Executable file
BIN
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.mount_cmd.app/Contents/Info.plist
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.mount_cmd.app/Contents/Resources/MainMenu.nib
generated
Executable file
BIN
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.mount_cmd.app/Contents/Resources/MainMenu.nib
generated
Executable file
Binary file not shown.
BIN
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.mount_cmd.app/Contents/Resources/appIcon.icns
Executable file
BIN
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.mount_cmd.app/Contents/Resources/appIcon.icns
Executable file
Binary file not shown.
22
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.mount_cmd.app/Contents/Resources/script
Executable file
22
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.mount_cmd.app/Contents/Resources/script
Executable file
@ -0,0 +1,22 @@
|
||||
#!/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
|
46
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.volume_select.app/Contents/Info.plist
Executable file
46
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.volume_select.app/Contents/Info.plist
Executable file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleAllowMixedLocalizations</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>applet</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>applet</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.ScriptEditor.id.afpfs-ng-OSX-volume-select</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>afpfs-ng-OSX.volume_select</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>aplt</string>
|
||||
<key>LSMinimumSystemVersionByArchitecture</key>
|
||||
<dict>
|
||||
<key>x86_64</key>
|
||||
<string>10.6</string>
|
||||
</dict>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>WindowState</key>
|
||||
<dict>
|
||||
<key>dividerCollapsed</key>
|
||||
<false/>
|
||||
<key>eventLogLevel</key>
|
||||
<integer>-1</integer>
|
||||
<key>name</key>
|
||||
<string>ScriptWindowState</string>
|
||||
<key>positionOfDivider</key>
|
||||
<real>518</real>
|
||||
<key>savedFrame</key>
|
||||
<string>170 116 602 886 0 0 1280 1002 </string>
|
||||
<key>selectedTabView</key>
|
||||
<string>result</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
BIN
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.volume_select.app/Contents/MacOS/applet
Executable file
BIN
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.volume_select.app/Contents/MacOS/applet
Executable file
Binary file not shown.
1
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.volume_select.app/Contents/PkgInfo
Executable file
1
etc/afpfs-ng-OSX/bin/afpfs-ng-OSX.volume_select.app/Contents/PkgInfo
Executable file
@ -0,0 +1 @@
|
||||
APPLaplt
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 362 B |
@ -0,0 +1,4 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
|
||||
{\fonttbl}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
}
|
BIN
etc/afpfs-ng-OSX/icon/logged_on_folder.icns
Executable file
BIN
etc/afpfs-ng-OSX/icon/logged_on_folder.icns
Executable file
Binary file not shown.
BIN
etc/afpfs-ng-OSX/icon/server.icns
Executable file
BIN
etc/afpfs-ng-OSX/icon/server.icns
Executable file
Binary file not shown.
BIN
etc/afpfs-ng-OSX/icon/shared_folder.icns
Executable file
BIN
etc/afpfs-ng-OSX/icon/shared_folder.icns
Executable file
Binary file not shown.
BIN
etc/afpfs-ng-OSX/icon/shared_volume.icns
Executable file
BIN
etc/afpfs-ng-OSX/icon/shared_volume.icns
Executable file
Binary file not shown.
0
etc/afpfs-ng-OSX/link/AFP2 Mounts/make_dir
Normal file
0
etc/afpfs-ng-OSX/link/AFP2 Mounts/make_dir
Normal file
0
etc/afpfs-ng-OSX/mount/make_dir
Normal file
0
etc/afpfs-ng-OSX/mount/make_dir
Normal file
22
source/afpfs-ng-OSX.mount_cmd.command
Executable file
22
source/afpfs-ng-OSX.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 /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
|
BIN
source/afpfs-ng-OSX.volume_select.scpt
Executable file
BIN
source/afpfs-ng-OSX.volume_select.scpt
Executable file
Binary file not shown.
66
source/post-installation script/afpfs-ng-OSX.post_install.command
Executable file
66
source/post-installation script/afpfs-ng-OSX.post_install.command
Executable file
@ -0,0 +1,66 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 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 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
|
||||
|
||||
# check temp file to verify conversion went fine
|
||||
if grep -q 'Script Menu.menu' /etc/afpfs-ng-OSX/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
|
||||
|
||||
# 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'
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
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
|
||||
|
||||
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'
|
||||
|
||||
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'
|
||||
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'
|
||||
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
|
||||
|
||||
# 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
|
||||
|
||||
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
|
||||
|
||||
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'
|
||||
|
||||
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'
|
||||
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'
|
||||
fi)
|
||||
# END REPEAT ORIGINAL STEPS IF USER OPTED FOR AUTO RETRY
|
||||
|
||||
fi
|
||||
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user