[Ovirt-devel] [PATCH node-image] set SELinux enforcing temporary to permissive

Jim Meyering jim at meyering.net
Tue Sep 23 10:03:04 UTC 2008


Alan Pevec <apevec at redhat.com> wrote:
> Jim Meyering wrote:
>> Alternatively, use a case stmt, where you don't need the quotes:
>
> thanks, I took this and made build fail if SELinux is disabled
...
> diff --git a/ovirt-node-image.spec.in b/ovirt-node-image.spec.in
...
>  sudo su - -c "cd $(pwd) &&

________________^

> -              if [ $(cat /selinux/enforce) = 1 ]; then
> -                enforcing=1
> -                setenforce 0
> -              else
> -                enforcing=0
> -              fi
> +              case $(cat /selinux/enforce 2>/dev/null) in
> +                  1) enforcing=1 ; setenforce 0 ;;
> +                  0) enforcing=0 ;;
> +                  *) echo "SELinux must be enabled"; exit 1 ;;
> +              esac

ACK.
Good point.

While it does work as-is, you may want to use single quotes in the
echo stmt (or even none), since the whole thing is already inside
a double-quoted string.




More information about the ovirt-devel mailing list