@@ -1,15 +1,17 @@
-#!/bin/bash
+#!/bin/sh
-function kvercmp()
+set -eu
+
+kvercmp()
{
- ver1=`echo $1 | sed 's/-/./'`
- ver2=`echo $2 | sed 's/-/./'`
+ ver1=$(echo "$1" | sed 's/-/./')
+ ver2=$(echo "$2" | sed 's/-/./')
ret=0
i=1
- while [ 1 ]; do
- digit1=`echo $ver1 | cut -d . -f $i`
- digit2=`echo $ver2 | cut -d . -f $i`
+ while true; do
+ digit1=$(echo "$ver1" | cut -d . -f $i)
+ digit2=$(echo "$ver2" | cut -d . -f $i)
if [ -z "$digit1" ]; then
if [ -z "$digit2" ]; then
@@ -1,8 +1,10 @@
-#!/bin/bash
+#!/bin/sh
-if [[ -r /etc/redhat-release ]]; then
- ver=$(cat /etc/redhat-release | sed -ne '/^Red Hat Enterprise Linux/p')
- if [[ -n $ver ]]; then
+set -eu
+
+if [ -r /etc/redhat-release ]; then
+ ver=$(sed -ne '/^Red Hat Enterprise Linux/p' /etc/redhat-release)
+ if [ -n "$ver" ]; then
echo "$ver" | \
sed -e 's/Red Hat Enterprise Linux[ \ta-zA-Z]*\([0-9]\+\).*/RHEL\1/'
fi
@@ -1,4 +1,6 @@
-#!/bin/bash
+#!/bin/sh
+
+set -eu
if [ $# -ne 1 ]; then
echo "Usage $0 <selinuxfs directory>"
@@ -8,10 +10,10 @@ fi
# This is heuristic but seems unlikely to be wrong,
# the kernel initial sid should always be SystemHigh
# and SystemHigh is normally s15
-level=$(cat $1/initial_contexts/kernel | tr '\0' '\n' | cut -d: -f4)
+level=$(cat "$1/initial_contexts/kernel" | tr '\0' '\n' | cut -d: -f4)
-if [ -z $level ]; then echo "NON-MLS"
-elif [ $level = 's0' ]; then echo "MCS"
-elif [ $level = 's15' ]; then echo "MLS"
+if [ -z "$level" ]; then echo "NON-MLS"
+elif [ "$level" = 's0' ]; then echo "MCS"
+elif [ "$level" = 's15' ]; then echo "MLS"
else echo "UNKNOWN"
fi