3
0
Fork 0
forked from mirrors/nixpkgs

at: fix permission errors with "batch" on NixOS

Fixes https://github.com/NixOS/nixpkgs/issues/12392
This commit is contained in:
Bjørn Forsman 2017-10-14 22:35:53 +02:00
parent 635fbcbd33
commit 38e6ae8e44

View file

@ -1,4 +1,7 @@
{ fetchurl, stdenv, bison, flex, pam, sendmailPath ? "/run/wrappers/bin/sendmail" }:
{ fetchurl, stdenv, bison, flex, pam
, sendmailPath ? "/run/wrappers/bin/sendmail"
, atWrapperPath ? "/run/wrappers/bin/at"
}:
stdenv.mkDerivation rec {
name = "at-${version}";
@ -30,6 +33,13 @@ stdenv.mkDerivation rec {
--with-daemon_username=atd --with-daemon_groupname=atd
'';
# 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.
postInstall = ''
sed -i "6i test -x ${atWrapperPath} && exec ${atWrapperPath} -qb now # exec doesn't return" "$out/bin/batch"
'';
meta = {
description = ''The classical Unix `at' job scheduling command'';
license = stdenv.lib.licenses.gpl2Plus;