about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libutempter
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libutempter')
-rw-r--r--nixpkgs/pkgs/development/libraries/libutempter/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/libutempter/exec_path.patch32
2 files changed, 72 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libutempter/default.nix b/nixpkgs/pkgs/development/libraries/libutempter/default.nix
new file mode 100644
index 000000000000..717418e686b4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libutempter/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, lib, glib }:
+
+stdenv.mkDerivation rec {
+  pname = "libutempter";
+  version = "1.2.1";
+
+  src = fetchurl {
+    url = "http://ftp.altlinux.org/pub/people/ldv/utempter/libutempter-${version}.tar.gz";
+    sha256 = "sha256-ln/vNy85HeUBhDrYdXDGz12r2WUfAPF4MJD7wSsqNMs=";
+  };
+
+  buildInputs = [ glib ];
+
+  patches = [ ./exec_path.patch ];
+
+  patchFlags = [ "-p2" ];
+
+  prePatch = ''
+    substituteInPlace Makefile --replace 2711 0711
+  '';
+
+  makeFlags = [
+    "libdir=\${out}/lib"
+    "libexecdir=\${out}/lib"
+    "includedir=\${out}/include"
+    "mandir=\${out}/share/man"
+  ];
+
+  meta = with lib; {
+    homepage = "https://github.com/altlinux/libutempter";
+    description = "Interface for terminal emulators such as screen and xterm to record user sessions to utmp and wtmp files";
+    longDescription = ''
+      The bundled utempter binary must be able to run as a user belonging to group utmp.
+      On NixOS systems, this can be achieved by creating a setguid wrapper.
+    '';
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.msteen ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libutempter/exec_path.patch b/nixpkgs/pkgs/development/libraries/libutempter/exec_path.patch
new file mode 100644
index 000000000000..da3fe110fb67
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libutempter/exec_path.patch
@@ -0,0 +1,32 @@
+diff --git a/libutempter/iface.c b/libutempter/iface.c
+index 37c74a8..6f44c9a 100644
+--- a/libutempter/iface.c
++++ b/libutempter/iface.c
+@@ -43,7 +43,7 @@
+        __result; }))
+ #endif
+ 
+-#define UTEMPTER_DEFAULT_PATHNAME	LIBEXECDIR "/utempter/utempter"
++#define UTEMPTER_DEFAULT_PATHNAME	"utempter"
+ 
+ static const char *utempter_pathname;
+ static int saved_fd = -1;
+@@ -57,8 +57,8 @@ do_child(int master_fd, const char *path, char *const *argv)
+ 		_exit(EXIT_FAILURE);
+ 	}
+ 
+-	execv(path, argv);
+-	print_dbg("execv: %s", strerror(errno));
++	execvp(path, argv);
++	print_dbg("execvp: %s", strerror(errno));
+ 
+ 	while (EACCES == errno) {
+ 		/* try saved group ID */
+@@ -73,7 +73,7 @@ do_child(int master_fd, const char *path, char *const *argv)
+ 		if (setgid(sgid))
+ 			break;
+ 
+-		(void) execv(path, argv);
++		(void) execvp(path, argv);
+ 		break;
+ 	}