git.iko.soy/typeable/nixpkgs
on master help sign in
john: Make package work out of the box.

So far it was only possible to run john if you've either copied over the default configuration over to ~/.john and substitute $JOHN with the right path or set $JOHN to the store path directly. Both methods are not really a very good user experience, so we're now patching in the resulting paths into the default rules/configurations. This also splits off configuration files into $out/etc/john instead of putting everything into $out/share/john and now also properly installs the auxiliary programs into $out/bin. Closes #8792. Signed-off-by: aszlig <aszlig@redmoonstudios.org> Reported-by: devhell <"^"@regexmail.net> Cc: @offlinehacker

commit902bcf1422ecabb6efa771505ba5b6b3c76254c8 authoraszlig <aszlig@redmoonstudios.org> dateTue 13 Oct 2015, 04:33 (11 years ago) parentcf4e2c4
1 file changed+26−8
pkgs/tools/security/john/default.nix+26−8
pkgs/tools/security/john/default.nix+26−8
@@ -1,4 +1,6 @@
1−{ stdenv, fetchurl, openssl, nss, nspr, kerberos, gmp, zlib, libpcap, re2 }:
1+{ stdenv, fetchurl, openssl, nss, nspr, kerberos, gmp, zlib, libpcap, re2
2+, writeText
3+}:
24
35with stdenv.lib;
46
@@ -11,18 +13,34 @@ stdenv.mkDerivation rec {
1113 sha256 = "08q92sfdvkz47rx6qjn7qv57cmlpy7i7rgddapq5384mb413vjds";
1214 };
1315
14− buildInputs = [ openssl nss nspr kerberos gmp zlib libpcap re2 ];
15−
16− NIX_CFLAGS_COMPILE = "-DJOHN_SYSTEMWIDE=1";
16+ postPatch = ''
17+ sed -ri -e '
18+ s!^(#define\s+CFG_[A-Z]+_NAME\s+).*/!\1"'"$out"'/etc/john/!
19+ /^#define\s+JOHN_SYSTEMWIDE/s!/usr!'"$out"'!
20+ ' src/params.h
21+ sed -ri -e '/^\.include/ {
22+ s!\$JOHN!'"$out"'/etc/john!
23+ s!^(\.include\s*)<([^./]+\.conf)>!\1"'"$out"'/etc/john/\2"!
24+ }' run/*.conf
25+ '';
1726
1827 preConfigure = "cd src";
1928 configureFlags = [ "--disable-native-macro" ];
2029
30+ buildInputs = [ openssl nss nspr kerberos gmp zlib libpcap re2 ];
31+
32+ NIX_CFLAGS_COMPILE = [ "-DJOHN_SYSTEMWIDE=1" ];
33+
2134 installPhase = ''
22− mkdir -p "$out/share/john"
23− mkdir -p "$out/bin"
24− cp -R ../run/* "$out/share/john"
25− ln -s "$out/share/john/john" "$out/bin/john"
35+ mkdir -p "$out/etc/john" "$out/share/john" "$out/share/doc/john"
36+ find ../run -mindepth 1 -maxdepth 1 -type f -executable \
37+ -exec "${stdenv.shell}" "${writeText "john-binary-install.sh" ''
38+ filename="$(basename "$1")"
39+ install -vD "$1" "$out/bin/''${filename%.*}"
40+ ''}" {} \;
41+ cp -vt "$out/etc/john" ../run/*.conf
42+ cp -vt "$out/share/john" ../run/*.chr ../run/password.lst
43+ cp -vrt "$out/share/doc/john" ../doc/*
2644 '';
2745
2846 meta = {