sec-policy/selinux-apm: remove old apm module from store
authorJason Zaman <perfinion@gentoo.org>
Sun, 18 Jun 2017 08:58:45 +0000 (16:58 +0800)
committerJason Zaman <perfinion@gentoo.org>
Sun, 18 Jun 2017 16:27:34 +0000 (00:27 +0800)
"apm" module got renamed to "acpi", must remove apm first
the contexts are okay even tho the modules are not
replaced in the same command (doesnt become unlabeled_t)

Package-Manager: Portage-2.3.5, Repoman-2.3.1

sec-policy/selinux-apm/selinux-apm-2.20170204-r4.ebuild
sec-policy/selinux-apm/selinux-apm-9999.ebuild

index 469df11cc54421d597ae935d8c0f9d0808c1deac..1008927338d9ab592e266952859bce3345e2bea5 100644 (file)
@@ -7,8 +7,29 @@ MODS="acpi"
 
 inherit selinux-policy-2
 
-DESCRIPTION="SELinux policy for apm"
+DESCRIPTION="SELinux policy for acpi"
 
 if [[ ${PV} != 9999* ]] ; then
        KEYWORDS="~amd64 ~arm ~arm64 ~mips ~x86"
 fi
+
+pkg_postinst() {
+       # "apm" module got renamed to "acpi", must remove apm first
+       # the contexts are okay even tho the modules are not
+       # replaced in the same command (doesnt become unlabeled_t)
+       for i in ${POLICY_TYPES}; do
+               if semodule -s "${i}" -l | grep apm >/dev/null 2>&1; then
+                       semodule -s "${i}" -r apm
+               fi
+       done
+       selinux-policy-2_pkg_postinst
+}
+
+pkg_postrm() {
+       for i in ${POLICY_TYPES}; do
+               if semodule -s "${i}" -l | grep apm >/dev/null 2>&1; then
+                       semodule -s "${i}" -r apm
+               fi
+       done
+       selinux-policy-2_pkg_postrm
+}
index 469df11cc54421d597ae935d8c0f9d0808c1deac..1008927338d9ab592e266952859bce3345e2bea5 100644 (file)
@@ -7,8 +7,29 @@ MODS="acpi"
 
 inherit selinux-policy-2
 
-DESCRIPTION="SELinux policy for apm"
+DESCRIPTION="SELinux policy for acpi"
 
 if [[ ${PV} != 9999* ]] ; then
        KEYWORDS="~amd64 ~arm ~arm64 ~mips ~x86"
 fi
+
+pkg_postinst() {
+       # "apm" module got renamed to "acpi", must remove apm first
+       # the contexts are okay even tho the modules are not
+       # replaced in the same command (doesnt become unlabeled_t)
+       for i in ${POLICY_TYPES}; do
+               if semodule -s "${i}" -l | grep apm >/dev/null 2>&1; then
+                       semodule -s "${i}" -r apm
+               fi
+       done
+       selinux-policy-2_pkg_postinst
+}
+
+pkg_postrm() {
+       for i in ${POLICY_TYPES}; do
+               if semodule -s "${i}" -l | grep apm >/dev/null 2>&1; then
+                       semodule -s "${i}" -r apm
+               fi
+       done
+       selinux-policy-2_pkg_postrm
+}