Skip to content

Commit

Permalink
openbsd.mount: init
Browse files Browse the repository at this point in the history
  • Loading branch information
rhelmot committed Jan 16, 2025
1 parent bffd9c0 commit dd9e65d
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/mount/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
mkDerivation,
}:

mkDerivation {
path = "sbin/mount";
meta.mainProgram = "mount";
patches = [ ./search-path.patch ];
}
39 changes: 39 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/mount/search-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index eaff190b572..4bce21559f6 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -338,12 +338,6 @@ mountfs(const char *vfstype, const char *spec, const char *name,
{
char *cp;

- /* List of directories containing mount_xxx subcommands. */
- static const char *edirs[] = {
- _PATH_SBIN,
- _PATH_USRSBIN,
- NULL
- };
const char **argv, **edir;
struct statfs sf;
pid_t pid;
@@ -427,15 +421,12 @@ mountfs(const char *vfstype, const char *spec, const char *name,
return (1);
case 0: /* Child. */
/* Go find an executable. */
- edir = edirs;
- do {
- (void)snprintf(execname,
- sizeof(execname), "%s/mount_%s", *edir, vfstype);
- argv[0] = execname;
- execv(execname, (char * const *)argv);
- if (errno != ENOENT)
- warn("exec %s for %s", execname, name);
- } while (*++edir != NULL);
+ (void)snprintf(execname,
+ sizeof(execname), "mount_%s", vfstype);
+ argv[0] = execname;
+ execvp(execname, (char * const *)argv);
+ if (errno != ENOENT)
+ warn("exec %s for %s", execname, name);

if (errno == ENOENT)
warn("no mount helper program found for %s", vfstype);
8 changes: 8 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/mount_ffs/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
mkDerivation,
}:

mkDerivation {
path = "sbin/mount_ffs";
extraPaths = [ "sbin/mount" ];
}
8 changes: 8 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/mount_tmpfs/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
mkDerivation,
}:

mkDerivation {
path = "sbin/mount_tmpfs";
extraPaths = [ "sbin/mount" ];
}

0 comments on commit dd9e65d

Please sign in to comment.