- replaced /bin/sh by /bin/bash - fixed indentaion - updated copyright banner - attempt to eliminate shellcheck issues
Partially fixes: #12398
Signed-off-by: Peter Müller peter.mueller@ipfire.org --- src/initscripts/packages/hostapd | 38 ++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 9 deletions(-)
diff --git a/src/initscripts/packages/hostapd b/src/initscripts/packages/hostapd index 5945375f3..60f50cace 100644 --- a/src/initscripts/packages/hostapd +++ b/src/initscripts/packages/hostapd @@ -1,6 +1,26 @@ -#!/bin/sh +#!/bin/bash +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007-2020 IPFire Team info@ipfire.org # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see http://www.gnu.org/licenses/. # +# # +############################################################################### + . /etc/sysconfig/rc -. ${rc_functions} +. "${rc_functions}"
CHANNEL="6" COUNTRY="00" @@ -8,7 +28,7 @@ TXPOWER="auto" INTERFACE="blue0" MACMODE="0"
-eval $(/usr/local/bin/readhash /var/ipfire/wlanap/settings) +eval "$(/usr/local/bin/readhash /var/ipfire/wlanap/settings)"
case "${1}" in start) @@ -18,21 +38,21 @@ case "${1}" in
# Check Interface configuration if [ ! -d "/sys/class/net/${INTERFACE}" ]; then - boot_mesg "Interface $INTERFACE doesn't exist." ${FAILURE} + boot_mesg "Interface $INTERFACE doesn't exist." "${FAILURE}" echo_failure exit 0 fi
if [ "$(ip link show $INTERFACE | /bin/grep "ether")" == "" ]; then - boot_mesg "Interface $INTERFACE is assigned to wlan master device." ${FAILURE} - boot_mesg "Please reboot to fix this." ${FAILURE} + boot_mesg "Interface $INTERFACE is assigned to wlan master device." "${FAILURE}" + boot_mesg "Please reboot to fix this." "${FAILURE}" echo_failure exit 0 fi
# Check if INTERFACE is an actual wireless device if [ ! -d "/sys/class/net/${INTERFACE}/wireless" ]; then - boot_mesg "Interface $INTERFACE is not a wireless device." ${FAILURE} + boot_mesg "Interface $INTERFACE is not a wireless device." "${FAILURE}" echo_failure exit 0 fi @@ -45,7 +65,7 @@ case "${1}" in DRIVER="HOSTAP" driver="hostap" else - boot_mesg "Interface $INTERFACE is a not supported wireless device." ${FAILURE} + boot_mesg "Interface $INTERFACE is a not supported wireless device." "${FAILURE}" echo_failure exit 0 fi @@ -86,7 +106,7 @@ case "${1}" in
if [ "$(/usr/sbin/iwconfig $INTERFACE | /bin/grep "Mode:Master")" == "" ]; then killproc /usr/bin/hostapd > /dev/null 2>&1 - boot_mesg "Try to create additional AP device ..." + boot_mesg "Try to create additional AP device ..." ip link set ${INTERFACE} down ip link set ${INTERFACE} name ${INTERFACE}_man iw dev ${INTERFACE}_man interface add ${INTERFACE} type __ap