[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



Alan Pevec <apevec 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.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]