mirror of
https://github.com/lakinduakash/linux-wifi-hotspot.git
synced 2024-11-10 14:10:10 +00:00
Merge pull request #196 from mathiassmichno/create_ap-lock_fix
Check if root before initializing lock in create_ap and add hostapd log timestamp option
This commit is contained in:
commit
cec2a27d6f
@ -14,7 +14,7 @@
|
||||
# dnsmasq
|
||||
# iptables
|
||||
|
||||
VERSION=0.4.6
|
||||
VERSION=0.4.7
|
||||
PROGNAME="$(basename $0)"
|
||||
|
||||
# make sure that all command outputs are in english
|
||||
@ -46,6 +46,7 @@ usage() {
|
||||
echo " --mac-filter-accept Location of MAC address filter list (defaults to /etc/hostapd/hostapd.accept)"
|
||||
echo " --redirect-to-localhost If -n is set, redirect every web request to localhost (useful for public information networks)"
|
||||
echo " --hostapd-debug <level> With level between 1 and 2, passes arguments -d or -dd to hostapd for debugging."
|
||||
echo " --hostapd-timestamps Include timestamps in hostapd debug messages."
|
||||
echo " --isolate-clients Disable communication between clients"
|
||||
echo " --ieee80211n Enable IEEE 802.11n (HT)"
|
||||
echo " --ieee80211ac Enable IEEE 802.11ac (VHT)"
|
||||
@ -1054,7 +1055,7 @@ for ((i=0; i<$#; i++)); do
|
||||
fi
|
||||
done
|
||||
|
||||
GETOPT_ARGS=$(getopt -o hc:w:g:de:nm: -l "help","hidden","hostapd-debug:","redirect-to-localhost","mac-filter","mac-filter-accept:","isolate-clients","ieee80211n","ieee80211ac","ht_capab:","vht_capab:","driver:","no-virt","fix-unmanaged","country:","freq-band:","mac:","dhcp-dns:","daemon","pidfile:","logfile:","stop:","list","list-running","list-clients:","version","psk","no-haveged","no-dns","no-dnsmasq","mkconfig:","config:" -n "$PROGNAME" -- "$@")
|
||||
GETOPT_ARGS=$(getopt -o hc:w:g:de:nm: -l "help","hidden","hostapd-debug:","hostapd-timestamps","redirect-to-localhost","mac-filter","mac-filter-accept:","isolate-clients","ieee80211n","ieee80211ac","ht_capab:","vht_capab:","driver:","no-virt","fix-unmanaged","country:","freq-band:","mac:","dhcp-dns:","daemon","pidfile:","logfile:","stop:","list","list-running","list-clients:","version","psk","no-haveged","no-dns","no-dnsmasq","mkconfig:","config:" -n "$PROGNAME" -- "$@")
|
||||
[[ $? -ne 0 ]] && exit 1
|
||||
eval set -- "$GETOPT_ARGS"
|
||||
|
||||
@ -1229,15 +1230,19 @@ while :; do
|
||||
--hostapd-debug)
|
||||
shift
|
||||
if [ "x$1" = "x1" ]; then
|
||||
HOSTAPD_DEBUG_ARGS="-d"
|
||||
HOSTAPD_DEBUG_ARGS+="-d "
|
||||
elif [ "x$1" = "x2" ]; then
|
||||
HOSTAPD_DEBUG_ARGS="-dd"
|
||||
HOSTAPD_DEBUG_ARGS+="-dd "
|
||||
else
|
||||
printf "Error: argument for --hostapd-debug expected 1 or 2, got %s\n" "$1"
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
--hostapd-timestamps)
|
||||
shift
|
||||
HOSTAPD_DEBUG_ARGS+="-t "
|
||||
;;
|
||||
--mkconfig)
|
||||
shift
|
||||
STORE_CONFIG="$1"
|
||||
@ -1282,6 +1287,11 @@ fi
|
||||
|
||||
trap "cleanup_lock" EXIT
|
||||
|
||||
if [[ $(id -u) -ne 0 ]]; then
|
||||
echo "create_ap must be run as root." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! init_lock; then
|
||||
echo "ERROR: Failed to initialize lock" >&2
|
||||
exit 1
|
||||
@ -1306,11 +1316,6 @@ if [[ -n "$LIST_CLIENTS_ID" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $(id -u) -ne 0 ]]; then
|
||||
echo "create_ap must be run as root." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$STOP_ID" ]]; then
|
||||
echo "Trying to kill $PROGNAME instance associated with $STOP_ID..."
|
||||
send_stop "$STOP_ID"
|
||||
|
Loading…
Reference in New Issue
Block a user