From 38e6ae8e440d3c1eb53c7f2bae9dedd2fdf9a5bb Mon Sep 17 00:00:00 2001 From: Bjørn Forsman Date: Sat, 14 Oct 2017 22:35:53 +0200 Subject: at: fix permission errors with "batch" on NixOS Fixes https://github.com/NixOS/nixpkgs/issues/12392 --- pkgs/tools/system/at/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'pkgs/tools') diff --git a/pkgs/tools/system/at/default.nix b/pkgs/tools/system/at/default.nix index 501a1bde33b3..cc4ccdd40f09 100644 --- a/pkgs/tools/system/at/default.nix +++ b/pkgs/tools/system/at/default.nix @@ -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; -- cgit 1.4.1