Use consistent bash5 style for conditionals and quoting
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
# First check that wireless-regdb is there
|
||||
if [ -f "/etc/conf.d/wireless-regdom" ]; then
|
||||
if [[ -f "/etc/conf.d/wireless-regdom" ]]; then
|
||||
unset WIRELESS_REGDOM
|
||||
. /etc/conf.d/wireless-regdom
|
||||
fi
|
||||
|
||||
# If the region is already set, we're done
|
||||
if [ ! -n "${WIRELESS_REGDOM}" ]; then
|
||||
if [[ ! -n ${WIRELESS_REGDOM} ]]; then
|
||||
# Get the current timezone
|
||||
if [ -e "/etc/localtime" ]; then
|
||||
if [[ -e "/etc/localtime" ]]; then
|
||||
TIMEZONE=$(readlink -f /etc/localtime)
|
||||
TIMEZONE=${TIMEZONE#/usr/share/zoneinfo/}
|
||||
|
||||
@@ -15,12 +15,12 @@ if [ ! -n "${WIRELESS_REGDOM}" ]; then
|
||||
COUNTRY="${TIMEZONE%%/*}"
|
||||
|
||||
# If we don't have a two letter country, get it from the timezone table
|
||||
if [[ ! "$COUNTRY" =~ ^[A-Z]{2}$ ]] && [ -f "/usr/share/zoneinfo/zone.tab" ]; then
|
||||
if [[ ! $COUNTRY =~ ^[A-Z]{2}$ ]] && [[ -f /usr/share/zoneinfo/zone.tab ]]; then
|
||||
COUNTRY=$(awk -v tz="$TIMEZONE" '$3 == tz {print $1; exit}' /usr/share/zoneinfo/zone.tab)
|
||||
fi
|
||||
|
||||
# Check if we have a two letter country code
|
||||
if [[ "$COUNTRY" =~ ^[A-Z]{2}$ ]]; then
|
||||
if [[ $COUNTRY =~ ^[A-Z]{2}$ ]]; then
|
||||
# Append it to the wireless-regdom conf file that is used at boot
|
||||
echo "WIRELESS_REGDOM=\"$COUNTRY\"" | sudo tee -a /etc/conf.d/wireless-regdom >/dev/null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user