summarylogtreecommitdiffstats
path: root/selinux-refpolicy-arch.install
blob: 21ce9e87e65302ec416bc8dbfe8b448d7f02a888 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
post_install() {
  # Configure /etc/selinux/config
  if [ -e /etc/selinux/config ]
  then
    echo ">>> In order to use this policy, set SELINUXTYPE=refpolicy-arch in /etc/selinux/config."
  else
    /usr/bin/ln -v -s config.refpolicy-arch /etc/selinux/config
  fi

  # In release 20170805, apm module has been renamed to acpi. This causes a
  # conflict when rebuilding the policy
  if /usr/bin/semodule -s refpolicy-arch -l 2>/dev/null | /usr/bin/grep -q '^apm$'
  then
    semodule --noreload -s refpolicy-arch -r apm
  fi

  echo ">>> Building refpolicy-arch policy store. Please wait..."
  /usr/bin/semodule -s refpolicy-arch -i /usr/share/selinux/refpolicy-arch/*.pp
  echo ">>> Relabeling the filesystem may be needed."
  echo ">>> This can be done with: /usr/bin/restorecon -rF /"
}

post_upgrade() {
  post_install
}

post_remove() {
  echo ">>> Removing refpolicy left-over files."
  /usr/bin/rm -rf /etc/selinux/refpolicy-arch

  if [ -L /etc/selinux/config ] && ! [ -e /etc/selinux/config ]
  then
    echo ">>> Removing now-broken symbolic link /etc/selinux/config"
    /usr/bin/rm /etc/selinux/config
  fi
}