Always use a single `=` for bash tests, remove superfluous `;`s from
the end of lines, always have `then` and `do` on the same line as their
respective `if` and `for`/`while` statements.

Signed-off-by: Rahul Sandhu <[email protected]>
---
 eclass/selinux-policy-2.eclass | 58 ++++++++++++++++------------------
 1 file changed, 28 insertions(+), 30 deletions(-)

diff --git a/eclass/selinux-policy-2.eclass b/eclass/selinux-policy-2.eclass
index f7cb0986df04..1a335eff0367 100644
--- a/eclass/selinux-policy-2.eclass
+++ b/eclass/selinux-policy-2.eclass
@@ -56,7 +56,7 @@ _SELINUX_POLICY_2_ECLASS=1
 # (space-separated) or a bash array.
 : "${POLICY_FILES:=""}"
 
-if [[ ${EAPI} == 7 ]]; then
+if [[ ${EAPI} = 7 ]]; then
        # @ECLASS_VARIABLE: POLICY_TYPES
        # @DESCRIPTION:
        # This variable informs the eclass for which SELinux policies the 
module should
@@ -92,7 +92,7 @@ case ${BASEPOL} in
                        EGIT_CHECKOUT_DIR="${WORKDIR}/refpolicy";;
 esac
 
-if [[ ${EAPI} == 7 ]]; then
+if [[ ${EAPI} = 7 ]]; then
        IUSE=""
 else
        # Build all policy types by default
@@ -122,7 +122,7 @@ else
        _BASE_POLICY_VERSION="${PV}"
 fi
 
-if [[ ${EAPI} == 7 ]]; then
+if [[ ${EAPI} = 7 ]]; then
        RDEPEND=">=sys-apps/policycoreutils-2.5
                >=sec-policy/selinux-base-policy-${_BASE_POLICY_VERSION}"
 else
@@ -174,10 +174,10 @@ selinux-policy-2_src_unpack() {
 # content.
 selinux-policy-2_src_prepare() {
        local modfiles
-       local add_interfaces=0;
+       local add_interfaces=0
 
        # Create 3rd_party location for user-contributed policies
-       cd "${S}/refpolicy/policy/modules" && mkdir 3rd_party;
+       cd "${S}/refpolicy/policy/modules" && mkdir 3rd_party
 
        # Patch the sources with the base patchbundle
        if [[ -n ${BASEPOL} ]] && [[ "${BASEPOL}" != "9999" ]]; then
@@ -191,19 +191,18 @@ selinux-policy-2_src_prepare() {
        eapply_user
 
        # Copy additional files to the 3rd_party/ location
-       if [[ "$(declare -p POLICY_FILES 2>/dev/null 2>&1)" == "declare -a"* ]] 
||
+       if [[ "$(declare -p POLICY_FILES 2>/dev/null 2>&1)" = "declare -a"* ]] 
||
           [[ -n ${POLICY_FILES} ]]; then
-               add_interfaces=1;
+               add_interfaces=1
                cd "${S}/refpolicy/policy/modules"
-               for POLFILE in ${POLICY_FILES[@]};
-               do
-                       cp "${FILESDIR}/${POLFILE}" 3rd_party/ || die "Could 
not copy ${POLFILE} to 3rd_party/ location";
+               for POLFILE in ${POLICY_FILES[@]}; do
+                       cp "${FILESDIR}/${POLFILE}" 3rd_party/ || die "Could 
not copy ${POLFILE} to 3rd_party/ location"
                done
        fi
 
        # Apply the additional patches referred to by the module ebuild.
        # But first some magic to differentiate between bash arrays and strings
-       if [[ "$(declare -p POLICY_PATCH 2>/dev/null 2>&1)" == "declare -a"* 
]]; then
+       if [[ "$(declare -p POLICY_PATCH 2>/dev/null 2>&1)" = "declare -a"* ]]; 
then
                [[ -n ${POLICY_PATCH[*]} ]] && eapply -d 
"${S}/refpolicy/policy/modules" -- "${POLICY_PATCH[@]}"
        else
                [[ -n ${POLICY_PATCH} ]] && eapply -d 
"${S}/refpolicy/policy/modules" -- ${POLICY_PATCH}
@@ -228,7 +227,7 @@ selinux-policy-2_src_prepare() {
                        || die "Failed to copy the module files to ${S}/${1}"
        }
 
-       if [[ ${EAPI} == 7 ]]; then
+       if [[ ${EAPI} = 7 ]]; then
                for i in ${POLICY_TYPES}; do
                        _selinux_prepare_modules $i
                done
@@ -249,8 +248,7 @@ selinux-policy-2_src_compile() {
        local makeuse=""
        # We use IUSE instead of USE so that other variables set in the ebuild
        # environment, such as architecture ones, are not included.
-       for useflag in ${IUSE};
-       do
+       for useflag in ${IUSE}; do
                # Advance past a possible '+' character: that is NOT part of 
the USE flag,
                # but instead indicates whether it is enabled by default.
                useflag="${useflag##+}"
@@ -258,7 +256,7 @@ selinux-policy-2_src_compile() {
                # Only additional USE flags defined in our consumers should be 
added to
                # build options: SELINUX_POLICY_TYPES should NOT be passed to 
the policy
                # build system.
-               [[ "${useflag}" == selinux_policy_types_* ]] && continue
+               [[ "${useflag}" = selinux_policy_types_* ]] && continue
 
                use ${useflag} && makeuse="${makeuse} -D use_${useflag}"
        done
@@ -269,7 +267,7 @@ selinux-policy-2_src_compile() {
                emake NAME=$1 SHAREDIR="${EPREFIX}"/usr/share/selinux -C 
"${S}"/${1}
        }
 
-       if [[ ${EAPI} == 7 ]]; then
+       if [[ ${EAPI} = 7 ]]; then
                for i in ${POLICY_TYPES}; do
                        _selinux_compile_modules $i
                done
@@ -294,20 +292,20 @@ selinux-policy-2_src_install() {
                for i in "${MODS[@]}"; do
                        einfo "Installing ${1} ${i} policy package"
                        insinto ${BASEDIR}/${1}
-                       if [[ -f "${S}/${1}/${i}.pp" ]] ; then
+                       if [[ -f "${S}/${1}/${i}.pp" ]]; then
                          doins "${S}"/${1}/${i}.pp || die "Failed to add 
${i}.pp to ${1}"
-                       elif [[ -f "${S}/${1}/${i}.cil" ]] ; then
+                       elif [[ -f "${S}/${1}/${i}.cil" ]]; then
                          doins "${S}"/${1}/${i}.cil || die "Failed to add 
${i}.cil to ${1}"
                        fi
 
-                       if [[ "${POLICY_FILES[@]}" == *"${i}.if"* ]]; then
+                       if [[ "${POLICY_FILES[@]}" = *"${i}.if"* ]]; then
                                insinto ${BASEDIR}/${1}/include/3rd_party
                                doins "${S}"/${1}/${i}.if || die "Failed to add 
${i}.if to ${1}"
                        fi
                done
        }
 
-       if [[ ${EAPI} == 7 ]]; then
+       if [[ ${EAPI} = 7 ]]; then
                for i in ${POLICY_TYPES}; do
                        _selinux_install_modules $i
                done
@@ -389,7 +387,7 @@ selinux-policy-2_pkg_postinst() {
                ewarn "  semodule -i /usr/share/selinux/${1}/*.pp"
        }
 
-       if [[ ${EAPI} == 7 ]]; then
+       if [[ ${EAPI} = 7 ]]; then
                for i in ${POLICY_TYPES}; do
                        _selinux_postinst $i
                done
@@ -404,14 +402,14 @@ selinux-policy-2_pkg_postinst() {
        # Don't relabel when cross compiling
        if [[ -z ${ROOT} ]]; then
                # Relabel depending packages
-               local PKGSET="";
-               if [[ -x /usr/bin/qdepends ]] ; then
-                       PKGSET=$(/usr/bin/qdepends -Cq -r -Q ${CATEGORY}/${PN} 
| grep -v "sec-policy/selinux-");
-               elif [[ -x /usr/bin/equery ]] ; then
-                       PKGSET=$(/usr/bin/equery -Cq depends ${CATEGORY}/${PN} 
| grep -v "sec-policy/selinux-");
+               local PKGSET=""
+               if [[ -x /usr/bin/qdepends ]]; then
+                       PKGSET=$(/usr/bin/qdepends -Cq -r -Q ${CATEGORY}/${PN} 
| grep -v "sec-policy/selinux-")
+               elif [[ -x /usr/bin/equery ]]; then
+                       PKGSET=$(/usr/bin/equery -Cq depends ${CATEGORY}/${PN} 
| grep -v "sec-policy/selinux-")
                fi
-               if [[ -n "${PKGSET}" ]] ; then
-                       rlpkg ${PKGSET};
+               if [[ -n "${PKGSET}" ]]; then
+                       rlpkg ${PKGSET}
                fi
        fi
 }
@@ -441,13 +439,13 @@ selinux-policy-2_pkg_postrm() {
 
                        semodule ${root_opts} -s ${1} ${COMMAND}
                        if [[ $? -ne 0 ]]; then
-                               ewarn "SELinux module unload failed.";
+                               ewarn "SELinux module unload failed."
                        else
                                einfo "SELinux modules unloaded successfully."
                        fi
                }
 
-               if [[ ${EAPI} == 7 ]]; then
+               if [[ ${EAPI} = 7 ]]; then
                        for i in ${POLICY_TYPES}; do
                                _selinux_postrm $i
                        done
-- 
2.50.1


Reply via email to