Anthony Roussel 2023-08-16 07:24:29 +02:00
parent 6c5458cf32
commit a12b4ec80e
No known key found for this signature in database
GPG Key ID: 9DC4987B1A55E75E
2 changed files with 27 additions and 63 deletions

View File

@ -5,22 +5,38 @@
stdenv.mkDerivation rec {
pname = "at";
version = "3.1.23";
version = "3.2.5";
src = fetchurl {
# Debian is apparently the last location where it can be found.
url = "mirror://debian/pool/main/a/at/at_${version}.orig.tar.gz";
sha256 = "040pr2ivfbrhvrhzis97cpwfkzpr7nin33nc301aga5aajlhlicp";
hash = "sha256-uwZrOJ18m7nYSjVzgDK4XDDLp9lJ91gZKtxyyUd/07g=";
};
patches = [
./install.patch
# Remove glibc assumption
(fetchpatch {
url = "https://raw.githubusercontent.com/riscv/riscv-poky/master/meta/recipes-extended/at/at/0001-remove-glibc-assumption.patch";
sha256 = "1rk4hskp0c1jqkanzdxf873i6jgki3xhrm609fsam8an8sl1njnm";
hash = "sha256-1UobqEZWoaq0S8DUDPuI80kTx0Gut2/VxDIwcKeGZOY=";
})
];
postPatch = ''
# Remove chown commands and setuid bit
substituteInPlace Makefile.in \
--replace ' -o root ' ' ' \
--replace ' -g root ' ' ' \
--replace ' -o $(DAEMON_USERNAME) ' ' ' \
--replace ' -o $(DAEMON_GROUPNAME) ' ' ' \
--replace ' -g $(DAEMON_GROUPNAME) ' ' ' \
--replace '$(DESTDIR)$(etcdir)' "$out/etc" \
--replace '$(DESTDIR)$(ATJOB_DIR)' "$out/var/spool/atjobs" \
--replace '$(DESTDIR)$(ATSPOOL_DIR)' "$out/var/spool/atspool" \
--replace '$(DESTDIR)$(LFILE)' "$out/var/spool/atjobs/.SEQ" \
--replace 'chown' '# skip chown' \
--replace '6755' '0755'
'';
nativeBuildInputs = [ bison flex perl /* for `prove` (tests) */ ];
buildInputs = [ pam ];
@ -45,15 +61,17 @@ stdenv.mkDerivation rec {
# Ensure that "batch" can invoke the setuid "at" wrapper, if it exists, or
# else we get permission errors (on NixOS). "batch" is a shell script, so
# when the kernel executes it it drops setuid perms.
# when the kernel executes it drops setuid perms.
postInstall = ''
sed -i "6i test -x ${atWrapperPath} && exec ${atWrapperPath} -qb now # exec doesn't return" "$out/bin/batch"
'';
meta = {
meta = with lib; {
description = "The classical Unix `at' job scheduling command";
license = lib.licenses.gpl2Plus;
homepage = "https://packages.qa.debian.org/at";
platforms = lib.platforms.linux;
license = licenses.gpl2Plus;
homepage = "https://tracker.debian.org/pkg/at";
changelog = "https://salsa.debian.org/debian/at/-/raw/master/ChangeLog";
platforms = platforms.linux;
mainProgram = "at";
};
}

View File

@ -1,54 +0,0 @@
--- at-3.1.14/Makefile.in 2013-09-08 14:43:53.000000000 +0200
+++ at-3.1.14/Makefile.in 2014-07-27 20:42:04.017703443 +0200
@@ -91,35 +91,28 @@
$(CC) -c $(CFLAGS) $(DEFS) $*.c
install: all
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(etcdir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(bindir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(sbindir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(docdir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(atdocdir)
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(IROOT)$(ATSPOOL_DIR) $(IROOT)$(ATJOB_DIR)
- chmod 1770 $(IROOT)$(ATSPOOL_DIR) $(IROOT)$(ATJOB_DIR)
- touch $(IROOT)$(LFILE)
- chmod 600 $(IROOT)$(LFILE)
- chown $(DAEMON_USERNAME):$(DAEMON_GROUPNAME) $(IROOT)$(LFILE)
- test -f $(IROOT)$(etcdir)/at.allow || test -f $(IROOT)$(etcdir)/at.deny || $(INSTALL) -o root -g $(DAEMON_GROUPNAME) -m 640 at.deny $(IROOT)$(etcdir)/
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 6755 at $(IROOT)$(bindir)
+ $(INSTALL) -m 755 -d $(IROOT)$(bindir)
+ $(INSTALL) -m 755 -d $(IROOT)$(sbindir)
+ $(INSTALL) -m 755 -d $(IROOT)$(docdir)
+ $(INSTALL) -m 755 -d $(IROOT)$(atdocdir)
+ $(INSTALL) -m 0755 at $(IROOT)$(bindir)
$(LN_S) -f at $(IROOT)$(bindir)/atq
$(LN_S) -f at $(IROOT)$(bindir)/atrm
- $(INSTALL) -g root -o root -m 755 batch $(IROOT)$(bindir)
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man1dir)
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man5dir)
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man8dir)
- $(INSTALL) -g root -o root -m 755 atd $(IROOT)$(sbindir)
- $(INSTALL) -g root -o root -m 755 atrun $(IROOT)$(sbindir)
- $(INSTALL) -g root -o root -m 644 at.1 $(IROOT)$(man1dir)/
+ $(INSTALL) -m 755 batch $(IROOT)$(bindir)
+ $(INSTALL) -d -m 755 $(IROOT)$(man1dir)
+ $(INSTALL) -d -m 755 $(IROOT)$(man5dir)
+ $(INSTALL) -d -m 755 $(IROOT)$(man8dir)
+ $(INSTALL) -m 755 atd $(IROOT)$(sbindir)
+ $(INSTALL) -m 755 atrun $(IROOT)$(sbindir)
+ $(INSTALL) -m 644 at.1 $(IROOT)$(man1dir)/
cd $(IROOT)$(man1dir) && $(LN_S) -f at.1 atq.1 && $(LN_S) -f at.1 batch.1 && $(LN_S) -f at.1 atrm.1
- $(INSTALL) -g root -o root -m 644 atd.8 $(IROOT)$(man8dir)/
+ $(INSTALL) -m 644 atd.8 $(IROOT)$(man8dir)/
sed "s,\$${exec_prefix},$(exec_prefix),g" <atrun.8>tmpman
- $(INSTALL) -g root -o root -m 644 tmpman $(IROOT)$(man8dir)/atrun.8
+ $(INSTALL) -m 644 tmpman $(IROOT)$(man8dir)/atrun.8
rm -f tmpman
- $(INSTALL) -g root -o root -m 644 at.allow.5 $(IROOT)$(man5dir)/
+ $(INSTALL) -m 644 at.allow.5 $(IROOT)$(man5dir)/
cd $(IROOT)$(man5dir) && $(LN_S) -f at.allow.5 at.deny.5
- $(INSTALL) -g root -o root -m 644 $(DOCS) $(IROOT)$(atdocdir)
+ $(INSTALL) -m 644 $(DOCS) $(IROOT)$(atdocdir)
rm -f $(IROOT)$(mandir)/cat1/at.1* $(IROOT)$(mandir)/cat1/batch.1* \
$(IROOT)$(mandir)/cat1/atq.1*
rm -f $(IROOT)$(mandir)/cat1/atd.8*