openbsd: many new small packages (#371699)

This commit is contained in:
Peder Bergebakken Sundt
2025-01-17 03:18:49 +01:00
committed by GitHub
70 changed files with 531 additions and 0 deletions
@@ -0,0 +1,5 @@
{ mkDerivation }:
mkDerivation {
path = "usr.bin/cap_mkdb";
meta.mainProgram = "cap_mkdb";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/cat";
}
@@ -0,0 +1,24 @@
diff --git a/bin/chmod/Makefile b/bin/chmod/Makefile
index 82854bae3a3..39813dc8882 100644
--- a/bin/chmod/Makefile
+++ b/bin/chmod/Makefile
@@ -3,17 +3,8 @@
PROG= chmod
MAN= chmod.1 chgrp.1 chown.8 chflags.1
LINKS= ${BINDIR}/chmod ${BINDIR}/chgrp \
- ${BINDIR}/chmod /sbin/chown
-
-# XXX compatibility
-afterinstall:
- (cd ${DESTDIR}/usr/sbin && \
- ln -sf ../../sbin/chown . && \
- ln -sf ../../bin/chgrp . && \
- chown -h ${BINOWN}:${BINGRP} chown chgrp)
- (cd ${DESTDIR}/usr/bin && \
- ln -sf ../../bin/chmod chflags && \
- chown -h ${BINOWN}:${BINGRP} chflags)
+ ${BINDIR}/chmod ${BINDIR}/chown \
+ ${BINDIR}/chmod ${BINDIR}/chflags
.include <bsd.prog.mk>
@@ -0,0 +1,6 @@
{ mkDerivation }:
mkDerivation {
path = "bin/chmod";
patches = [ ./no-sbin.patch ];
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "usr.bin/cmp";
}
+4
View File
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/cp";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/date";
}
+4
View File
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/dd";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "usr.sbin/dev_mkdb";
}
+4
View File
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/df";
}
@@ -0,0 +1,7 @@
{ mkDerivation }:
mkDerivation {
path = "usr.sbin/dhcpleasectl";
extraPaths = [ "sbin/dhcpleased" ];
}
@@ -0,0 +1,15 @@
{
mkDerivation,
libevent,
byacc,
}:
mkDerivation {
path = "sbin/dhcpleased";
postPatch = ''
sed -i 's/DPADD/#DPADD/' $BSDSRCDIR/sbin/dhcpleased/Makefile
'';
buildInputs = [ libevent ];
extraNativeBuildInputs = [ byacc ];
}
@@ -0,0 +1,10 @@
{ mkDerivation, libkvm }:
mkDerivation {
path = "sbin/dmesg";
buildInputs = [ libkvm ];
postPatch = ''
sed -i /DPADD/d $BSDSRCDIR/sbin/dmesg/Makefile
'';
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/domainname";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/echo";
}
+4
View File
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/ed";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/expr";
}
@@ -0,0 +1 @@
{ mkDerivation }: mkDerivation { path = "usr.bin/getent"; }
@@ -0,0 +1,21 @@
{
mkDerivation,
login,
}:
mkDerivation {
path = "libexec/getty";
extraPaths = [ "etc/gettytab" ];
postPatch = ''
substituteInPlace $BSDSRCDIR/libexec/getty/pathnames.h \
--replace-fail "/usr/libexec/getty" "$out/bin/getty" \
--replace-fail "/usr/bin/login" "${login}/bin/login"
'';
postInstall = ''
mkdir -p $out/etc
cp $BSDSRCDIR/etc/gettytab $out/etc/gettytab
'';
meta.mainProgram = "getty";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/hostname";
}
+6
View File
@@ -0,0 +1,6 @@
{
mkDerivation,
}:
mkDerivation {
path = "usr.bin/id";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "sbin/ifconfig";
}
@@ -0,0 +1,8 @@
{ mkDerivation }:
mkDerivation {
path = "usr.bin/kdump";
extraPaths = [
"sys"
"usr.bin/ktrace"
];
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/kill";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "usr.bin/ktrace";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "usr.sbin/kvm_mkdb";
}
@@ -7,6 +7,7 @@
libm,
librpcsvc,
libutil,
libexecinfo,
rtld,
version,
}:
@@ -36,6 +37,7 @@ symlinkJoin rec {
librthread
librpcsvc
libutil
libexecinfo
]
++ (lib.optional (!stdenvNoLibc.hostPlatform.isStatic) rtld)
);
@@ -0,0 +1,13 @@
{
lib,
mkDerivation,
buildPackages,
}:
mkDerivation {
path = "lib/libcurses";
makeFlags = [
"AWK=${lib.getBin buildPackages.gawk}/bin/awk"
"HOSTCC=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"
];
}
@@ -0,0 +1,7 @@
{ mkDerivation }:
mkDerivation {
path = "lib/libevent";
preInstall = ''
mkdir -p $out/include
'';
}
@@ -0,0 +1,22 @@
{
lib,
mkDerivation,
}:
mkDerivation {
path = "gnu/lib/libexecinfo";
extraPaths = [
"gnu/llvm/libunwind"
"gnu/llvm/libcxx"
"gnu/lib/libcxx"
];
libcMinimal = true;
outputs = [
"out"
"man"
];
meta.platforms = lib.platforms.openbsd;
}
@@ -0,0 +1,6 @@
{
mkDerivation,
}:
mkDerivation {
path = "lib/libkvm";
}
+4
View File
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/ln";
}
@@ -0,0 +1,12 @@
{
mkDerivation,
libutil,
}:
mkDerivation {
path = "usr.bin/login";
buildInputs = [
libutil
];
meta.mainProgram = "login";
}
@@ -0,0 +1,10 @@
{
mkDerivation,
}:
mkDerivation {
path = "libexec/login_passwd";
postPatch = ''
sed -i 's/4555/0555/' $BSDSRCDIR/libexec/login_passwd/Makefile
'';
}
+4
View File
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/ls";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/md5";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/mkdir";
}
@@ -0,0 +1,9 @@
{
mkDerivation,
}:
mkDerivation {
path = "sbin/mount";
meta.mainProgram = "mount";
patches = [ ./search-path.patch ];
}
@@ -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);
@@ -0,0 +1,8 @@
{
mkDerivation,
}:
mkDerivation {
path = "sbin/mount_ffs";
extraPaths = [ "sbin/mount" ];
}
@@ -0,0 +1,8 @@
{
mkDerivation,
}:
mkDerivation {
path = "sbin/mount_tmpfs";
extraPaths = [ "sbin/mount" ];
}
+4
View File
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/mt";
}
@@ -0,0 +1,6 @@
{
mkDerivation,
}:
mkDerivation {
path = "usr.sbin/mtree";
}
+4
View File
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/mv";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "usr.bin/newsyslog";
}
@@ -0,0 +1,16 @@
{
mkDerivation,
byacc,
}:
mkDerivation {
path = "sbin/pfctl";
extraPaths = [
"sys/net"
];
extraNativeBuildInputs = [
byacc
];
meta.mainProgram = "pfctl";
}
@@ -0,0 +1,15 @@
{
mkDerivation,
libkvm,
}:
mkDerivation {
path = "usr.bin/pkill";
buildInputs = [
libkvm
];
postPatch = ''
sed -i /DPADD/d $BSDSRCDIR/usr.bin/pkill/Makefile
'';
}
+9
View File
@@ -0,0 +1,9 @@
{ mkDerivation, libkvm }:
mkDerivation {
path = "bin/ps";
buildInputs = [ libkvm ];
postPatch = ''
sed -i /DPADD/d $BSDSRCDIR/bin/ps/Makefile
'';
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/pwd";
}
@@ -0,0 +1,4 @@
{ mkDerivation, ... }:
mkDerivation {
path = "usr.sbin/pwd_mkdb";
}
+4
View File
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/rm";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/rmdir";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "sbin/route";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "usr.bin/sed";
}
@@ -0,0 +1,8 @@
{ mkDerivation }:
mkDerivation {
path = "sbin/shutdown";
preBuild = ''
sed -i 's/4550/0550/' Makefile
'';
}
@@ -0,0 +1,7 @@
{ mkDerivation }:
mkDerivation {
path = "usr.sbin/slaacctl";
extraPaths = [ "sbin/slaacd" ];
}
@@ -0,0 +1,15 @@
{
mkDerivation,
libevent,
byacc,
}:
mkDerivation {
path = "sbin/slaacd";
postPatch = ''
sed -i 's/DPADD/#DPADD/' $BSDSRCDIR/sbin/slaacd/Makefile
'';
buildInputs = [ libevent ];
extraNativeBuildInputs = [ byacc ];
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/sleep";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/stty";
}
+12
View File
@@ -0,0 +1,12 @@
{
mkDerivation,
}:
mkDerivation {
path = "usr.bin/su";
postPatch = ''
sed -i /BINMODE/d $BSDSRCDIR/usr.bin/su/Makefile
'';
meta.mainProgram = "su";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "sbin/swapctl";
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/sync";
}
@@ -0,0 +1,13 @@
diff --git a/sbin/sysctl/Makefile b/sbin/sysctl/Makefile
index 6454e1dc888..53ddf3f3038 100644
--- a/sbin/sysctl/Makefile
+++ b/sbin/sysctl/Makefile
@@ -5,8 +5,4 @@ MAN= sysctl.8
CPPFLAGS+= -D_LIBKVM
-afterinstall:
- ln -sf ../../sbin/sysctl ${DESTDIR}/usr/sbin
- chown -h ${BINOWN}:${BINGRP} ${DESTDIR}/usr/sbin/sysctl
-
.include <bsd.prog.mk>
@@ -0,0 +1,8 @@
{
mkDerivation,
}:
mkDerivation {
path = "sbin/sysctl";
patches = [ ./no-perms.patch ];
meta.mainProgram = "sysctl";
}
@@ -0,0 +1,17 @@
{
mkDerivation,
libressl,
libevent,
}:
mkDerivation {
path = "usr.sbin/syslogd";
buildInputs = [
libressl
libevent
];
postPatch = ''
sed -i /DPADD/d $BSDSRCDIR/usr.sbin/syslogd/Makefile
'';
}
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/test";
}
@@ -0,0 +1,6 @@
{ mkDerivation, libcurses }:
mkDerivation {
path = "usr.bin/top";
buildInputs = [ libcurses ];
}
@@ -0,0 +1,6 @@
{
mkDerivation,
}:
mkDerivation {
path = "sbin/ttyflags";
}
@@ -0,0 +1,9 @@
{ mkDerivation, libkvm }:
mkDerivation {
path = "usr.bin/vmstat";
buildInputs = [ libkvm ];
postPatch = ''
sed -i /DPADD/d $BSDSRCDIR/usr.bin/vmstat/Makefile
'';
}
+9
View File
@@ -88,6 +88,7 @@ let
else pkgs.netbsd.getent;
darwin = pkgs.netbsd.getent;
freebsd = pkgs.freebsd.getent;
openbsd = pkgs.openbsd.getent;
};
getopt = {
linux = pkgs.util-linux;
@@ -110,11 +111,13 @@ let
linux = pkgs.nettools;
darwin = pkgs.darwin.shell_cmds;
freebsd = pkgs.freebsd.bin;
openbsd = pkgs.openbsd.hostname;
};
ifconfig = {
linux = pkgs.nettools;
darwin = pkgs.darwin.network_cmds;
freebsd = pkgs.freebsd.ifconfig;
openbsd = pkgs.openbsd.ifconfig;
};
killall = {
linux = pkgs.psmisc;
@@ -141,6 +144,7 @@ let
linux = pkgs.util-linux;
darwin = pkgs.darwin.diskdev_cmds;
freebsd = freebsd.mount;
openbsd = pkgs.openbsd.mount;
# technically just targeting the darwin version; binlore already
# ids the util-linux copy as 'cannot'
# no obvious exec in manpage args; I think binlore flags 'can'
@@ -163,6 +167,7 @@ let
linux = pkgs.procps;
darwin = pkgs.darwin.ps;
freebsd = pkgs.freebsd.bin;
openbsd = pkgs.openbsd.ps;
# technically just targeting procps ps (which ids as can)
# but I don't see obvious exec in args; have yet to look
# for underlying cause in source
@@ -178,6 +183,7 @@ let
linux = pkgs.nettools;
darwin = pkgs.darwin.network_cmds;
freebsd = pkgs.freebsd.route;
openbsd = pkgs.openbsd.route;
};
script = {
linux = pkgs.util-linux;
@@ -187,11 +193,13 @@ let
linux = pkgs.procps;
darwin = pkgs.darwin.system_cmds;
freebsd = pkgs.freebsd.sysctl;
openbsd = pkgs.openbsd.sysctl;
};
top = {
linux = pkgs.procps;
darwin = pkgs.darwin.top;
freebsd = pkgs.freebsd.top;
openbsd = pkgs.openbsd.top;
# technically just targeting procps top; haven't needed this in
# any scripts so far, but overriding it for consistency with ps
# override above and in procps. (procps also overrides 'free',
@@ -218,6 +226,7 @@ let
# Darwin/FreeBSD. Unfortunately no other implementations exist currently!
darwin = pkgs.callPackage ../os-specific/linux/procps-ng {};
freebsd = pkgs.callPackage ../os-specific/linux/procps-ng {};
openbsd = pkgs.callPackage ../os-specific/linux/procps-ng {};
};
write = {
linux = pkgs.util-linux;