Login  •  Register


The time is now: Mon Dec 18, 2017 4:29 pm

Emaculation wiki  •  Delete all board cookies



Post new topic  Reply to topic Page 1 of 1 [ 13 posts ]
Print view Previous topic  |  Next topic
Author Message
PostPosted: Wed Nov 08, 2017 12:56 am 
Offline
Mac Mechanic

Joined: Wed Apr 10, 2013 9:32 am
Posts: 196
[This is the continuation of http://emaculation.com/forum/viewtopic.php?f=34&p=58076#p58076]


The first "distribution" of afpfs-ng-OSX for Snow Leopard and up is ready as .pkg installer.
"Packages" made it easy to create.


Some quick information on it:

• First install Fuse for macOS from https://osxfuse.github.io/ (don't install it via Homebrew, it probably won't work for afpfs-ng-OSX).
• Then get afpfs-ng-OSX —>here<— (the 10.6 .pgk was only tested on OS X 10.6, the 10.8 .pkg was tested on OS X 10.8 and macOS 10.12). Ctrl-click on it and choose 'open'.
• Open Terminal and start Fuse for macOS and the afpfs daemon:
Code:
/Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse; afpfsd
• Connect to a Macintosh or emulator running Classic MacOS (should work for 7.6 through 9.2.2) by entering:
Code:
mkdir ~/mount1; mount_afp2 afp://192.168.1.95/share1 ~/mount1
where "192.168.1.95" is the IP of the machine running Classic MacOS (you could also use its name), "share1" the name of the shared folder and "mount1" (twice) the folder serving as mount point in your user folder ("~/").


AFP2 doesn't support password encryption, which is not implemented in afpfs-ng-OSX anyway.
Therefore, for connecting to AFP3 servers use the built-in functionality of macOS/OS X.

afpfs-ng-OSX does connect through AFP, but it does not actually report that to macOS/OS X. Therefore resource forks and metadata are not supported. I'm working on a workaround for critical files, but it will take some time until I get that finished.

Also, I'm working on a GUI based on AppleScript that starts Fuse for macOS, shows all AFP2 servers on the network and provides mounting by clicking on their shared volumes. It should also give the mounts sensible names like "AFP2_ServerName_VolumeName" (i.s.o. "OSXFUSE Volume 0 (afpfsd)").
I think I have most of the underlying "do shell script" commands for afpfs-ng-OSX ready.


As mentioned, afpfs-ng-OSX is tested on Snow Leopard (which actually still seems to work for AFP2 without it), Mountaion Lion, and Sierra.

Any help in testing on other macOS/OS X versions will be very much appreciated!


Last edited by mabam on Wed Nov 08, 2017 11:18 pm, edited 1 time in total.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sat Nov 18, 2017 11:56 pm 
Offline
Mac Mechanic

Joined: Wed Apr 10, 2013 9:32 am
Posts: 196
I have written an AppleScript that requests AFP server information from all IP's on the network. From the responses it displays AFP2.x servers (only if not capable of AFP3.x) to select from a list:
Image
Upon choosing a server and clicking "Continue …" its shared volumes are requested which are again displayed as list to select from (unfortunately, AppleScript does not allow to combine both lists into one dialog):
Image
Upon clicking "Mount" the script creates the "mount_afp2 …" command prepended by "/usr/local/bin" as required by AppleScript. Now I think the problem is that mount_afp2 passes stuff to another binary without its location. That binary cannot be called directly. I tried having AppleScript run a LaunchAgent that executes a bash script. But that wouldn't work without the location prefix either and therefore resulted in the same problem.
I do not want to have the AppleScript execute a bash script directly as that would make a Terminal window pop up.

Does anyone know a solution for this issue?

(Support for password protected shares will follow at a later stage.)


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sun Nov 19, 2017 5:41 am 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 1865
The best solution is probably to bundle mount_afp2 inside the AppleScript application in the resources folder, along with all the other components you need.

You could use lsof to trace the file chain to see what the dependencies are....


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Mon Nov 20, 2017 1:07 am 
Offline
Mac Mechanic

Joined: Wed Apr 10, 2013 9:32 am
Posts: 196
I'm using a sub-folder of /etc where I put stuff as I also need a place for the mount points and link to them with sensible names.

For days I was looking for a solution to the problem with calling mount_afp2. It wasn't until you responded that I found Platypus which compiles a (bash) script into an app. Its documentation mentions the possibility to use bash with the -l flag making it "act as if it had been invoked as a login shell". Maybe this also would have worked with the LaunchAgent, but using Platypus is easier and the created app can run invisibly or set to display errors if needed.

Nonetheless, thanks for your tip!


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Tue Nov 21, 2017 4:25 am 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 1865
You're welcome :) I tend to use Platypus to create all my apps that have scripts of some sort, because it's just so easy to debug and deploy, with just a few plist and script file changes required after building.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Nov 23, 2017 2:23 pm 
Offline
Mac Mechanic

Joined: Wed Apr 10, 2013 9:32 am
Posts: 196
After inserting some lines needed if there are errors and amending a few other things, it looks like the script is ready. Except there is one thing I can't find a solution for since a while now: In the end of the script it is supposed to launch the "mount app" I have created with Platypus.
Code:
tell application "/etc/afpfs-ng-OSX/afpfs-ng-OSX.mountcmd.app" to launch
But after every restart of the host machine the mount app won't launch at first attempt. Only at the second and after.

Is there a solution for this?

(If I have an AppleScript only containing the line to launch the mount app, it does launch at first attempt after a restart.)


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Nov 23, 2017 4:02 pm 
Offline
Forum All-Star

Joined: Tue Oct 14, 2008 12:12 am
Posts: 803
mabam wrote:
After inserting some lines needed if there are errors and amending a few other things, it looks like the script is ready. Except there is one thing I can't find a solution for since a while now: In the end of the script it is supposed to launch the "mount app" I have created with Platypus.
Code:
tell application "/etc/afpfs-ng-OSX/afpfs-ng-OSX.mountcmd.app" to launch
But after every restart of the host machine the mount app won't launch at first attempt. Only at the second and after.

Is there a solution for this?


I've had similar problems. I hope this message isn't time-wasting, but here are some possible alternatives that I remember using:

Code:
do shell script "open /etc/afpfs-ng-OSX/afpfs-ng-OSX.mountcmd.app"


Code:
tell application "Finder" to open file "/etc/afpfs-ng-OSX/afpfs-ng-OSX.mountcmd.app"


I'm just guessing at the syntax in both examples, but these are two ideas.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Nov 23, 2017 7:36 pm 
Offline
Mac Mechanic

Joined: Wed Apr 10, 2013 9:32 am
Posts: 196
Thanks for your suggestions. The first one I had tried already. The second one I did just now but it didn't help either.

mabam wrote:
(If I have an AppleScript only containing the line to launch the mount app, it does launch at first attempt after a restart.)

The above means that the app might launch if I put it at the beginning of the script. That will make it the second try when the required launch at the end of the script is attempted.
I probably know a way to amend the app so it doesn't have any effect when first launched at the beginning.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Nov 24, 2017 12:16 am 
Offline
Forum All-Star

Joined: Tue Oct 14, 2008 12:12 am
Posts: 803
One last idea (probably as useless as the others):

Code:
tell application "System Events" to open [etc.]


Apologies if this is just more time-wasting! I'm always annoyed at wasting time over pointless suggestions, but all these have worked in the past in other circumstances.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Nov 24, 2017 1:07 am 
Offline
Mac Mechanic

Joined: Wed Apr 10, 2013 9:32 am
Posts: 196
I had tried that already but it doesn't work either. But that doesn't mean that you are wasting my time. Thank you for taking the time!

I have copied the script over from Mountain Lion to my Sierra VM to test. Same issue there except that the script get stopped after a while.

The script line is wrapped in an if block. Maybe that is related. I'm done for today, but that is something I'll have to look into.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Nov 24, 2017 1:18 pm 
Offline
Mac Mechanic

Joined: Wed Apr 10, 2013 9:32 am
Posts: 196
As last action in the AppleScript (which will run as app once finished) it launches an app that has a bash script compiled into it. I have extended that bash script by a line that will kill the AppleScript app if still running (which, as discussed, is the case at first run after reboot).

This is not a beautiful solution to my problem, but a working one.
Any better suggestions are welcome!


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sun Dec 17, 2017 3:35 am 
Offline
Tinkerer
User avatar

Joined: Wed Jun 18, 2008 5:53 am
Posts: 65
This solution looks awesome. Is it still being worked on?


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sun Dec 17, 2017 8:34 am 
Offline
Mac Mechanic

Joined: Wed Apr 10, 2013 9:32 am
Posts: 196
I have no time right now and probably won't have the coming weeks. But I'll get back to it eventually.


Top
 Profile  
Reply with quote Post a reply  
Display posts from previous:  Sort by  
Post new topic  Reply to topic Page 1 of 1 [ 13 posts ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
 

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group