afpfs-ng-OSX – connect to Classic MacOS via AFP2

About Qemu-system-ppc, a PPC Mac emulator for Windows, macOS and Linux that can run Mac OS 9.0 up to Mac OS X 10.5

Moderators: Cat_7, Ronald P. Regensburg

User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by mabam »

In the meantime I had the same idea: Get rid of any non-ASCII characters. I have the script for that ready by now. For copying from macOS/OS X to Classic Mac OS many file names are too long and get truncated anyway. In that context, while being an international user, I don't see such a big issue in turning, e. g., 'ä' into 'a'.

Searching https://github.com/incbee/Unarchiver for "macroman" and "charset_macos" brought up some stuff. But I have no idea what to do with it. At that point I'm reminded that I am just a hacker :-)
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by mabam »

The script to copy a folder with subfolders and files onto a volume via afpfs-ng-OSX, amend the file/folder names where necessary and have macbinary encode the files is ready.
Now I'm attempting to script Mac OS 9 to have StuffIt Expander decode them again. The following line of script seems to be correct:

Code: Select all

tell application "StuffIt Expander" to expand "file.bin"
But after having to wait for a moment I keep getting this error:
StuffIt Expander got an error: AppleEvent timed out.
This is in both, Qemu running Mac OS 9.2.2 and SheepShaver running Mac OS 9.0.4.

Does anyone know what to do about this?
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by adespoton »

Have you tried just telling "Stuffit Expander" to open file.bin instead of expand it? I seem to recall some versions of Expander's dictionary being a bit sketchy back in the day.

You could also try a different version of Expander to see if that helps.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by mabam »

None of that helps, I'm afraid. There's also a freeware tool called "MacBinary II", available at Macintosh Garden. But it's not scriptable. And

Code: Select all

tell application "Finder" to open file "file.bin" using application "MacBinary II"
won't work either.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by adespoton »

Yeah; that was all added in later versions of AppleScript. :(

You could always either do it manually using http://files.stairways.com/other/macbin ... d-info.txt

Or, https://en.wikipedia.org/wiki/MacBinary lists some open source software at the end -- maybe we could create a tool to handle it all.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by mabam »

I have looked into the software in the wikipedia link already. Won't help, I'm afraid.
And doing it manually doesn't look like something I'm capable of.

Code: Select all

tell application "Finder" to open "file.bin"
works for decoding with StuffIt Expander if I first set the file creator to "SIT!" using ResEdit. But I haven't succeeded in using AppleScript to set the file creator.

Any ideas on how to accomplish that or is that also a feature that has been implemented later?

EDIT:
Just found the fix: https://daringfireball.net/2004/02/scri ... ator_types
I used "file creator" as I found that somewhere else. But for the version of AppleScript that comes with OS 9.2.2 "creator type" appears to be correct.

EDIT 2:
I tried the above with the file creator of MacBinary III as license-wise it would be easier to ship that with afpfs-ng-OSX. The decoded file contains the resource fork, but first thing I saw was that it did not have the label it was given in OS X. If I use StuffIt Expander the label is preserved.

EDIT 3:
MacBinary III did decode with the correct label on second approach. Seems to be related to first rebuilding the desktop file.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by mabam »

MacBinary III doesn't do the job reliably. Will have to use StuffIt Expander. The following works:

Code: Select all

repeat with theItem in binList
tell application "StuffIt Expander" to expand file theItem
end repeat
However, I'd like to pass the files to Expander at once i.s.o. one by one in a loop. That should make things faster. According to Expander's AppleScript dictionary that should be possible:

Code: Select all

expand alias  -- List of documents/folders/disks to Expand
But I could not yet find the correct syntax for that. What kind of delimiters do I use? Any other formatting I have to take into account?
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by adespoton »

AppleScript accepts arrays of file aliases, so this is probably what you want. I can't recall the syntax offhand, but I know there's examples of its use in one of the online AppleScript repositories.

Meanwhile, this might be of use:
http://web.archive.org/web/200503070302 ... inary.html

I'm in the middle of a project of converting Apple Backup files to discrete MacBinary documents, but those docs also explain how to decode MacBinary and come with a Pascal and a C source code example. Might be more than you were planning for, and not necessarily needed if you're using Expander.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by mabam »

After putting this on hold for a while I have continued working on it since yesterday.

In order to create a droplet, I have added some lines to the AppleScript that handles the binary conversion. I then copied the droplet onto the mounted volume shared by SheepShaver, just to realise it wouldn't work anymore. The only explanation I can come up with is the fact that afpfs-ng isn't able to handle/convert the date resulting in every file appearing as being created on 1 January 1970.

(At first I thought it might be due to security measures. But any other app copied to that volume can't be opened either, not even via "open" in the context menu.)

Is it possible that this prevents the applet from running? And is there a fix?
What I mean is: How to make OS X/macOS not care about the date or how to make it think 1970 is the correct date?
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by adespoton »

If the date is set to time 0, it's likely some of the filesystem metadata isn't being copied over correctly. This makes sense, as the bit fields changed between what was used in 7.6 and 8.6. I've gone through the macbinary documentation for macbinary 1 2 and 3, and they discuss some of this; it's probably relevant to apfs 2 and 3 as well.

The new versions are backwards compatible, as long as you check the fields correctly; it sounds like in this case the problem is assuming things in the other direction.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by mabam »

This is not related to the macbinary conversion. Even when I copy the droplet into SheepShaver using the Unix volume, and then move it into the folder I'm connected to from the host via AFP2, I have the same problem.

afpfs-ng-OSX creates a link in the sidebar that points to the folder "AFP2 Mounts" containing aliases of all mounted AFP2 volumes. That way volumes can be identified by their name (volume@server).
I'm using a work-around now making use of the above mentioned folder: After mounting a volume the droplet gets copied into "AFP2 Mounts" and renamed to "volume@server.app". That way it will be listed right under the corresponding mount alias and takes the files it then converts using macbinary and copies them onto the corresponding volume. Droplet and mount alias are deleted upon unmount.
yannis
Space Cadet
Posts: 1
Joined: Thu Dec 17, 2020 5:31 pm

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by yannis »

HI,

I installed MacFuse 4.0.4 from MacFuse4.0.4.dmg and tried to install AFPFS but I get the error message that macfuse is not installed on the disk
Image
I'm running macOS Catalina and I would like to connect to a MacOS 9.1 that runs under QEMU.

What should I do?
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by mabam »

Hi yannis,

Nice to see some interest in this project after three years. I have to admit that I didn’t use afpfs-ng-OSX for quite a while, though. That is, I never installed it on my present Catalina machine.

Also, I have never uploaded the macbinary conversion stuff to github as I didn’t continue to work on its MacOS Classic side. I was planning to and even bought a used AppleScript handbook from that time, but this stuff is very time consuming (and I am not a programmer) so I never got to actually finish it.

However, as far as the GUI is concerned, Dave Griffin forked it and changed some file paths in his Catalina branch at https://github.com/dgsga/afpfs-ng-OSX-GUI/tree/Catalina . You might want to contact him and see whether he ran into the same error as you did.


EDIT:
afpfs-ng-OSX_v0.8.2.osx1.0.gui1.0_10.8.pkg requires /Library/Filesystems/osxfuse.fs to be present and else throws the error in your screenshot.
I just checked the latest Fuse installer macfuse-4.0.4.dmg. As they renamed it to macFUSE since I created the afpfs-ng-OSX installer, the above path is now named /Library/Filesystems/macfuse.fs .

So after installing macFUSE, if you create an empty folder “osxfuse.fs” at /Library/Filesystems/, the afpfs-ng-OSX_v0.8.2.osx1.0.gui1.0_10.8.pkg installer should run fine. Afterwards you can remove the dummy folder.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by adespoton »

mabam wrote: Fri Dec 18, 2020 2:15 pm Hi yannis,

Nice to see some interest in this project after three years. I have to admit that I didn’t use afpfs-ng-OSX for quite a while, though. That is, I never installed it on my present Catalina machine.

Also, I have never uploaded the macbinary conversion stuff to github as I didn’t continue to work on its MacOS Classic side. I was planning to and even bought a used AppleScript handbook from that time, but this stuff is very time consuming (and I am not a programmer) so I never got to actually finish it.

However, as far as the GUI is concerned, Dave Griffin forked it and changed some file paths in his Catalina branch at https://github.com/dgsga/afpfs-ng-OSX-GUI/tree/Catalina . You might want to contact him and see whether he ran into the same error as you did.


EDIT:
afpfs-ng-OSX_v0.8.2.osx1.0.gui1.0_10.8.pkg requires /Library/Filesystems/osxfuse.fs to be present and else throws the error in your screenshot.
I just checked the latest Fuse installer macfuse-4.0.4.dmg. As they renamed it to macFUSE since I created the afpfs-ng-OSX installer, the above path is now named /Library/Filesystems/macfuse.fs .

So after installing macFUSE, if you create an empty folder “osxfuse.fs” at /Library/Filesystems/, the afpfs-ng-OSX_v0.8.2.osx1.0.gui1.0_10.8.pkg installer should run fine. Afterwards you can remove the dummy folder.
Heh... that's after all that headache we went through years ago with /System/Library/Filesystems/osxfuse.fs and having to re-do the installer to move the check to /Library/Filesystems/.

I don't think I'm going to have time soon, but if someone wants to open up the pkg script and change it so it's OK with the other fs name as well, that might be good.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by mabam »

adespoton wrote: Fri Dec 18, 2020 6:43 pm Heh... that's after all that headache we went through years ago with /System/Library/Filesystems/osxfuse.fs and having to re-do the installer to move the check to /Library/Filesystems/.
I just checked as I couldn’t remember this. Turns out it wasn’t the path to the fuse file system but the path to fuse.h. At first there was a typo (https://github.com/mabam/afpfs-ng-OSX/c ... bad4e2cf29) and then the path had to be updated to meet the then present FUSE for macOS version 3.x (https://github.com/mabam/afpfs-ng-OSX/c ... 0cbc732328).

Turns out with macFUSE v4.x they changed it back, so the path update has to be reverted.


There’s one other thing I’m considering:
mabam wrote: Fri Dec 18, 2020 2:15 pm […] Dave Griffin forked it and changed some file paths in his Catalina branch at https://github.com/dgsga/afpfs-ng-OSX-GUI/tree/Catalina. […]
Now looking at Dave’s changes, I absolutely see that moving the “working directory” of afpfs-ng-OSX from /etc/ to /usr/local/ makes totally sense. So that’s something I’ll probably change too.

What I’m not sure about is Dave’s changing the name of the tool from “afpfs-ng-OSX” to “afpfs-ng”. As Apple moved from “OS X” to “macOS” and “FUSE for macOS” to “macFUSE” seven weeks ago, which an updated version of my branch will be hooked on, I’ll probably name the tool “afpfs-ng-mac”. But I do prefer to keep the differentiation from the original linux branch. Mainly because in macOS, the command “mount_afp” is already used natively by Apple which is why in my branch it’s changed to “mount_afp2”.

What do you guys think?


I don't think I'm going to have time soon, but if someone wants to open up the pkg script and change it so it's OK with the other fs name as well, that might be good.
Compared to me having all the source files on my local machine, that would be quite some extra work for a third person to do. And I can work in my GitHub branch directly. But first I’ll have to do some testing after changing the stuff I’ve just described.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by adespoton »

Sort of a side note, but I just thought of another potential FUSE project: implementing AppleShare IP so that people can mount an AppleShare 2 file share as a virtual disk on modern OSes. The back end's already done, after all.

And at some point, I want to get back to MFS and HFS and get them working as native filesystem frameworks via FUSE, so Disk Utility can handle them natively for mounting and reading.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by mabam »

As macFUSE v4.x runs on Mavericks and up, I did all the changes required for https://github.com/mabam/afpfs-ng-mac-GUI and https://github.com/mabam/afpfs-ng-mac, set up a Mavericks VM and did the re-compilation and testing there.

Seems to run all fine.

Next steps will be to create the .pgk installer, test on Catalina, and update the readme files in both of the repositories.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by mabam »

adespoton wrote: Sat Dec 19, 2020 5:44 pm Sort of a side note, but I just thought of another potential FUSE project: implementing AppleShare IP so that people can mount an AppleShare 2 file share as a virtual disk on modern OSes. The back end's already done, after all.

And at some point, I want to get back to MFS and HFS and get them working as native filesystem frameworks via FUSE, so Disk Utility can handle them natively for mounting and reading.

Well, have fun! :wink:

Smells like programming, so not something I’d be capable of. But definitely a very useful project for the retro Mac and emulation community.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by mabam »

mabam wrote: Sat Dec 19, 2020 11:08 pm Seems to run all fine.

Next steps will be to create the .pgk installer, test on Catalina, and update the readme files in both of the repositories.
The .pkg installer is ready at https://github.com/mabam/afpfs-ng-mac/releases. It’s a pre-release for now.
Please pay attention to the notes there. Especially the fact that the .pkg is neither code signed nor notarised.

The readmes will be updated later.

Please let me know of any issues you might encounter with the tool. (But also bear in mind that the tool has it’s limitations [see https://emaculation.com/forum/viewtopic ... 998#p57998 and https://emaculation.com/forum/viewtopic ... 790#p58790] and that my skills are limited as I am not a programmer.)
dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by dgsga »

Hi all
After much experimentation I have managed to successfully compile Netatalk 2.2.5 on macOS BigSur. It works a treat on the classic Mac OS 9 side, the network share on Big Sur can be mounted on the classic Mac desktop via Chooser > AppleShare > Server IP address or directly via the Network Browser. Guest login works fine, files can transferred to and from the network share via drag'n'drop. Heaven, my G4 Cube is networked to my Mac at long last. If anyone is interested let me know and I'll post a how-to...
Last edited by dgsga on Wed Feb 17, 2021 8:28 pm, edited 1 time in total.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by adespoton »

This is great! I currently use a 10.6 server as my go-between for network sharing, but this means my G4 Mini running OS 9 should now be able to talk to my Big Sur laptop without using SheepShaver to share the Unix directory :)
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by mabam »

dgsga wrote: Wed Feb 17, 2021 8:22 pm Hi all
After much experimentation I have managed to successfully compile Netatalk 2.2.5 on macOS BigSur. It works a treat on the classic Mac OS 9 side, the network share on Big Sur can be mounted on the classic Mac desktop via Chooser > AppleShare > Server IP address or directly via the Network Browser. Guest login works fine, files can transferred to and from the network share via drag'n'drop. Heaven, my G4 Cube is networked to my Mac at long last.
Wow, this is great!

If anyone is interested let me know and I'll post a how-to...
Yes, definitely! I look forward to try it. afpfs-ng only provides basic functionality and only enables the host to connect to the guest, not the other way around.
dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by dgsga »

OK. Here goes:
1. Install Homebrew
2. Install dependencies, I think these are the essentials:

Code: Select all

brew install wget automake autoconf libtool libgcrypt
3. Clone patched Netatalk 2.2.6 branch from my Github repo:

Code: Select all

git clone https://github.com/dgsga/Netatalk-for-macOS.git
4. Download OpenSSL 1.0.2u

Code: Select all

wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz
5. Unpack archive, cd to 'openssl-1.0.2u' directory then:

Code: Select all

./config
make
make install
6. Download Berkeley-DV version 5.1.29

Code: Select all

wget http://ftpmirror.your.org/pub/misc/Berkeley-DB/db-5.1.29.tar.gz
7. Unpack archive, cd to 'db-5.1.29/build_unix' directory then:

Code: Select all

../dist/configure --prefix=/usr/local
make
make install
8. cd to Netatalk repo then:

Code: Select all

./bootstrap
./configure --without-acls --without-ldap
make
make install
9. Configure afpd.conf, netatalk.conf and AppleVolumes.default files in /usr/local/etc/netatalk to suit your needs
10. Start your AFP server:

Code: Select all

sudo afpd
sudo cnid_metad
sudo cnid_dbd
11. You can create a Launch daemon to autorun the above commands as root on startup
12. Enjoy!
Last edited by dgsga on Fri Feb 19, 2021 8:39 am, edited 6 times in total.
dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by dgsga »

I'm currently trying to get 'username +password' login as well as 'guest' login working on the Mac OS 9 side. I think it's just a case of setting the afp server configs correctly, still working on it...
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: afpfs-ng-OSX – connect to Classic MacOS via AFP2

Post by adespoton »

Please keep us posted; this is a great way to get modern macs talking to old macs again!
Post Reply