Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for BSDs (tmpfs only) #344

Open
morgant opened this issue Nov 1, 2022 · 1 comment
Open

Add support for BSDs (tmpfs only) #344

morgant opened this issue Nov 1, 2022 · 1 comment

Comments

@morgant
Copy link
Contributor

morgant commented Nov 1, 2022

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 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.

@morgant
Copy link
Contributor Author

morgant commented Nov 7, 2022

Oh, and we don't need to check for kmod on non-Linux OSes since they won't be using OFS.

I'll be trying to put together PRs for this and Issue #343 sometime this week.

morgant added a commit to morgant/profile-sync-daemon that referenced this issue Jan 1, 2023
morgant added a commit to morgant/profile-sync-daemon that referenced this issue Jan 1, 2023
…th '-exec basename' since we just want the filename. Issue graysky2#344
morgant added a commit to morgant/profile-sync-daemon that referenced this issue Jan 1, 2023
morgant added a commit to morgant/profile-sync-daemon that referenced this issue Jan 1, 2023
morgant added a commit to morgant/profile-sync-daemon that referenced this issue Jan 1, 2023
morgant added a commit to morgant/profile-sync-daemon that referenced this issue Jan 1, 2023
morgant added a commit to morgant/profile-sync-daemon that referenced this issue Jan 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant