I'm well aware that profile-sync-daemon was developed specifically for Linux and that's obviously the only way to use the Overlay Filesystem support. That said, the basic tmpfs support can be made to support BSDs with little effort.
mv doesn't support the --no-target-directory option in OpenBSD. All the uses of mv --no-target-directory already verify that the source is a directory anyway, so the --no-target-directory can be omitted under OpenBSD because the "source operand is skipped with an error message when the respective destination path is a non-empty directory" (per OpenBSD's mv(1)).
cp doesn't support the --reflink=auto option in OpenBSD. Use of cp --reflink=auto under Linux just forces it to perform a standard copy anyway (see Linux's cp(1)), so it can be omitted under OpenBSD.
du doesn't have a --max-depth option in OpenBSD, but du --max-depth=0 can be substituted with du -d 0 under OpenBSD.
stat -c %a can be replaced with stat -f %OLp under OpenBSD, so pretty minor.
unlink doesn't exist under OpenBSD, so can just use rm for better compatibility on all platforms.
pgrep doesn't have a -c (count) option under OpenBSD, so can just use pgrep -f "psd-suspend-sync" | wc -l | tr -d ' ' for better compatibility on all platforms.
OpenBSD's file system doesn't support extended attributes, so the -X option needs to be stripped from rsync calls. That can easily be left as an patch in the OpenBSD port as other BSDs (esp. FreeBSD) file systems do support extended attributes, but I figured I'd mention it anyway.
Some of these are Linux-specific options that are unnecessary under most BSDs (e.g. mv & cp issues), or GNU-style options that differ on BSDs (e.g. du & stat), both of which can probably just be handled as Linux vs BSD cases or be left as patches in the OS-specific ports (especially rsync -X). The others are pretty minor tweaks to just use more portable calls (e.g. unlink & pgrep).
I'll extract a patch from my WIP OpenBSD port and submit a PR in the hopes that others can test under other BSDs (or I can when I have more time). If we can merge in something that handles all BSDs with little extra logic, I'd love that, but if I have to keep maintaining OpenBSD-specific patches in my port, that's totally fine.
I'm well aware that
profile-sync-daemon
was developed specifically for Linux and that's obviously the only way to use the Overlay Filesystem support. That said, the basic tmpfs support can be made to support BSDs with little effort.I have been working on an OpenBSD port (https://github.com/morgant/my-openbsd-ports/blob/main/www/profile-sync-daemon/patches/patch-common_profile-sync-daemon_in) and the biggest issues I ran into are:
mv
doesn't support the--no-target-directory
option in OpenBSD. All the uses ofmv --no-target-directory
already verify that the source is a directory anyway, so the--no-target-directory
can be omitted under OpenBSD because the "source operand is skipped with an error message when the respective destination path is a non-empty directory" (per OpenBSD's mv(1)).cp
doesn't support the--reflink=auto
option in OpenBSD. Use ofcp --reflink=auto
under Linux just forces it to perform a standard copy anyway (see Linux's cp(1)), so it can be omitted under OpenBSD.du
doesn't have a--max-depth
option in OpenBSD, butdu --max-depth=0
can be substituted withdu -d 0
under OpenBSD.stat -c %a
can be replaced withstat -f %OLp
under OpenBSD, so pretty minor.unlink
doesn't exist under OpenBSD, so can just userm
for better compatibility on all platforms.pgrep
doesn't have a-c
(count) option under OpenBSD, so can just usepgrep -f "psd-suspend-sync" | wc -l | tr -d ' '
for better compatibility on all platforms.-X
option needs to be stripped fromrsync
calls. That can easily be left as an patch in the OpenBSD port as other BSDs (esp. FreeBSD) file systems do support extended attributes, but I figured I'd mention it anyway.Some of these are Linux-specific options that are unnecessary under most BSDs (e.g.
mv
&cp
issues), or GNU-style options that differ on BSDs (e.g.du
&stat
), both of which can probably just be handled as Linux vs BSD cases or be left as patches in the OS-specific ports (especiallyrsync -X
). The others are pretty minor tweaks to just use more portable calls (e.g.unlink
&pgrep
).I'll extract a patch from my WIP OpenBSD port and submit a PR in the hopes that others can test under other BSDs (or I can when I have more time). If we can merge in something that handles all BSDs with little extra logic, I'd love that, but if I have to keep maintaining OpenBSD-specific patches in my port, that's totally fine.