tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
policycoreutils: 2.4 -> 2.7
xeji
7 years ago
70044c89
232c39e7
+11
-54
2 changed files
expand all
collapse all
unified
split
pkgs
os-specific
linux
policycoreutils
default.nix
fix-printf-type.patch
+11
-42
pkgs/os-specific/linux/policycoreutils/default.nix
···
1
1
-
{ stdenv, fetchurl, pythonPackages, gettext
2
2
-
, setools, libsepol, libselinux, libcap_ng, libsemanage, sepolgen
3
3
-
}:
1
1
+
{ stdenv, fetchurl, gettext, libsepol, libselinux, libsemanage }:
4
2
5
3
stdenv.mkDerivation rec {
6
4
name = "policycoreutils-${version}";
7
7
-
version = "2.4";
5
5
+
version = "2.7";
8
6
inherit (libsepol) se_release se_url;
9
7
10
8
src = fetchurl {
11
9
url = "${se_url}/${se_release}/policycoreutils-${version}.tar.gz";
12
12
-
sha256 = "0y9l9k60iy21hj0lcvfdfxs1fxydg6d3pxp9rhy7hwr4y5vgh6dq";
10
10
+
sha256 = "1x742c7lkw30namhkw87yg7z384qzqjz0pvmqs0lk19v6958l6qa";
13
11
};
14
12
15
15
-
patches = [ ./fix-printf-type.patch ];
16
16
-
17
13
postPatch = ''
18
18
-
# Fix references to libsepol.a
19
19
-
find . -name Makefile -exec sed -i 's,[^ ]*/libsepol.a,${libsepol}/lib/libsepol.a,g' {} \;
20
20
-
21
14
# Fix install references
22
22
-
substituteInPlace po/Makefile --replace /usr/bin/install install
23
23
-
24
24
-
# Fix references to /usr/share
25
25
-
grep -r '/usr/share' | awk -F: '{print $1}' | xargs sed -i "s,\(\$(DESTDIR)\)*/usr/share,$out/share,g"
26
26
-
27
27
-
# Fix sepolicy install
28
28
-
sed -i "s,\(setup.py install\).*,\1 --prefix=$out,g" sepolicy/Makefile
29
29
-
30
30
-
# Fix setuid install
31
31
-
sed -i 's|-m 4755|-m 755|' sandbox/Makefile
15
15
+
substituteInPlace po/Makefile \
16
16
+
--replace /usr/bin/install install --replace /usr/share /share
17
17
+
substituteInPlace newrole/Makefile --replace /usr/share /share
32
18
'';
33
19
34
34
-
nativeBuildInputs = [ pythonPackages.python gettext ];
35
35
-
buildInputs = [ setools libsepol libselinux libcap_ng libsemanage ];
36
36
-
pythonPath = [ libselinux sepolgen ];
20
20
+
nativeBuildInputs = [ gettext ];
21
21
+
buildInputs = [ libsepol libselinux libsemanage ];
37
22
38
23
preBuild = ''
39
24
makeFlagsArray+=("PREFIX=$out")
40
25
makeFlagsArray+=("DESTDIR=$out")
41
41
-
'';
42
42
-
43
43
-
# Creation of the system-config-selinux directory is broken
44
44
-
preInstall = ''
45
45
-
mkdir -p $out/share/system-config-selinux
46
46
-
'';
47
47
-
48
48
-
# Fix the python scripts to include paths to libraries
49
49
-
# NOTE: We are not using wrapPythonPrograms or makeWrapper as these scripts
50
50
-
# purge the environment as a security measure
51
51
-
postInstall = ''
52
52
-
grep -r '#!.*python' $out/bin | awk -F: '{print $1}' | xargs sed -i "1a \
53
53
-
import sys; \
54
54
-
sys.path.append('$(toPythonPath "$out")'); \
55
55
-
${stdenv.lib.flip stdenv.lib.concatMapStrings pythonPath (lib: ''
56
56
-
sys.path.append('$(toPythonPath "${lib}")'); \
57
57
-
'')}"
26
26
+
makeFlagsArray+=("BASHCOMPLETIONDIR=$out/share/bash-completion/completions")
27
27
+
makeFlagsArray+=("LOCALEDIR=$out/share/locale")
28
28
+
makeFlagsArray+=("MAN5DIR=$out/share/man/man5")
58
29
'';
59
59
-
60
60
-
NIX_CFLAGS_COMPILE = "-fstack-protector-all";
61
30
62
31
meta = with stdenv.lib; {
63
32
description = "SELinux policy core utilities";
-12
pkgs/os-specific/linux/policycoreutils/fix-printf-type.patch
···
1
1
-
diff -Nru policycoreutils-2.4/setfiles/restore.c policycoreutils-2.4.new/setfiles/restore.c
2
2
-
--- policycoreutils-2.4/setfiles/restore.c 2015-02-02 09:38:10.000000000 -0500
3
3
-
+++ policycoreutils-2.4.new/setfiles/restore.c 2015-08-29 20:44:13.693023222 -0400
4
4
-
@@ -118,7 +118,7 @@
5
5
-
r_opts->count++;
6
6
-
if (r_opts->count % STAR_COUNT == 0) {
7
7
-
if (r_opts->progress == 1) {
8
8
-
- fprintf(stdout, "\r%luk", (size_t) r_opts->count / STAR_COUNT );
9
9
-
+ fprintf(stdout, "\r%zuk", (size_t) r_opts->count / STAR_COUNT );
10
10
-
} else {
11
11
-
if (r_opts->nfile > 0) {
12
12
-
progress = (r_opts->count < r_opts->nfile) ? (100.0 * r_opts->count / r_opts->nfile) : 100;