]>
Commit | Line | Data |
---|---|---|
ff12a795 | 1 | #!/usr/bin/env bash |
818567fc | 2 | set -e |
3f161ba9 | 3 | |
5c7290b1 | 4 | TEST_DESCRIPTION="SELinux tests" |
8c3534b5 | 5 | IMAGE_NAME="selinux" |
054ee249 | 6 | TEST_NO_NSPAWN=1 |
5c7290b1 EV |
7 | |
8 | # Requirements: | |
9 | # Fedora 23 | |
10 | # selinux-policy-targeted | |
11 | # selinux-policy-devel | |
12 | ||
67321fdf | 13 | # Check if selinux-policy-devel is installed, and if it isn't bail out early instead of failing |
cc4338e4 | 14 | test -f /usr/share/selinux/devel/include/system/systemd.if || exit 0 |
67321fdf | 15 | |
3f161ba9 FS |
16 | # shellcheck source=test/test-functions |
17 | . "${TEST_BASE_DIR:?}/test-functions" | |
18 | ||
5c7290b1 | 19 | SETUP_SELINUX=yes |
3f161ba9 | 20 | KERNEL_APPEND="${KERNEL_APPEND:=} selinux=1 security=selinux" |
5c7290b1 | 21 | |
d9e606e8 | 22 | test_append_files() { |
5c7290b1 | 23 | ( |
3f161ba9 FS |
24 | local workspace="${1:?}" |
25 | local policy_headers_dir=/usr/share/selinux/devel | |
26 | local modules_dir=/var/lib/selinux | |
27 | ||
d9e606e8 | 28 | setup_selinux |
3f161ba9 FS |
29 | # Make sure we never expand this to "/..." |
30 | rm -rf "${workspace:?}/$modules_dir" | |
31 | ||
32 | if ! cp -ar "$modules_dir" "$workspace/$modules_dir"; then | |
33 | dfatal "Failed to copy $modules_dir" | |
5c7290b1 EV |
34 | exit 1 |
35 | fi | |
36 | ||
3f161ba9 | 37 | rm -rf "${workspace:?}/$policy_headers_dir" |
5c7290b1 | 38 | inst_dir /usr/share/selinux |
3f161ba9 FS |
39 | |
40 | if ! cp -ar "$policy_headers_dir" "$workspace/$policy_headers_dir"; then | |
41 | dfatal "Failed to copy $policy_headers_dir" | |
5c7290b1 EV |
42 | exit 1 |
43 | fi | |
44 | ||
3f161ba9 FS |
45 | mkdir "$workspace/systemd-test-module" |
46 | cp systemd_test.te "$workspace/systemd-test-module" | |
47 | cp systemd_test.if "$workspace/systemd-test-module" | |
48 | cp systemd_test.fc "$workspace/systemd-test-module" | |
5c7290b1 EV |
49 | dracut_install -o sesearch |
50 | dracut_install runcon | |
68a7705e ZJS |
51 | dracut_install checkmodule semodule semodule_package m4 make load_policy sefcontext_compile |
52 | dracut_install -o /usr/libexec/selinux/hll/pp # Fedora/RHEL/... | |
53 | dracut_install -o /usr/lib/selinux/hll/pp # Debian/Ubuntu/... | |
cc469c3d | 54 | ) |
5c7290b1 EV |
55 | } |
56 | ||
c4cd6205 | 57 | do_test "$@" |