Add --fix-unmanaged option
This commit is contained in:
parent
9d7806882a
commit
b49f48a4e2
22
create_ap
22
create_ap
@ -39,6 +39,9 @@ usage() {
|
||||
echo " --ht_capab <HT> HT capabilities (default: [HT40+])"
|
||||
echo " --driver Choose your WiFi adapter driver (default: nl80211)"
|
||||
echo " --no-virt Do not create virtual interface"
|
||||
echo " --fix-unmanaged If NetworkManager shows your interface as unmanaged after you"
|
||||
echo " close create_ap, then use this option to switch your interface"
|
||||
echo " back to managed"
|
||||
echo
|
||||
echo "Non-Bridging Options:"
|
||||
echo " -g <gateway> IPv4 Gateway for the Access Point (default: 192.168.12.1)"
|
||||
@ -344,6 +347,11 @@ networkmanager_rm_unmanaged() {
|
||||
return 0
|
||||
}
|
||||
|
||||
networkmanager_fix_unmanaged() {
|
||||
[[ -f ${NETWORKMANAGER_CONF} ]] || return
|
||||
sed -e "/^unmanaged-devices=.*/d" -i ${NETWORKMANAGER_CONF}
|
||||
}
|
||||
|
||||
networkmanager_rm_unmanaged_if_needed() {
|
||||
[[ $ADDED_UNMANAGED =~ .*\ ${1}\ .* ]] && networkmanager_rm_unmanaged $1 $2
|
||||
}
|
||||
@ -373,6 +381,7 @@ IEEE80211N=0
|
||||
HT_CAPAB='[HT40+]'
|
||||
DRIVER=nl80211
|
||||
NO_VIRT=0
|
||||
FIX_UNMANAGED=0
|
||||
|
||||
CONFDIR=
|
||||
WIFI_IFACE=
|
||||
@ -476,7 +485,7 @@ clean_exit() {
|
||||
# if the user press ctrl+c then execute die()
|
||||
trap "die" SIGINT
|
||||
|
||||
ARGS=$(getopt -o hc:w:g:dnm: -l "help","hidden","ieee80211n","ht_capab:","driver:","no-virt" -n $(basename $0) -- "$@")
|
||||
ARGS=$(getopt -o hc:w:g:dnm: -l "help","hidden","ieee80211n","ht_capab:","driver:","no-virt","fix-unmanaged" -n $(basename $0) -- "$@")
|
||||
[[ $? -ne 0 ]] && exit 1
|
||||
eval set -- "$ARGS"
|
||||
|
||||
@ -536,6 +545,10 @@ while :; do
|
||||
shift
|
||||
NO_VIRT=1
|
||||
;;
|
||||
--fix-unmanaged)
|
||||
shift
|
||||
FIX_UNMANAGED=1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
@ -543,7 +556,7 @@ while :; do
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $# -lt 1 ]]; then
|
||||
if [[ $# -lt 1 && $FIX_UNMANAGED -eq 0 ]]; then
|
||||
usage >&2
|
||||
exit 1
|
||||
fi
|
||||
@ -553,6 +566,11 @@ if [[ $(id -u) -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $FIX_UNMANAGED -eq 1 ]]; then
|
||||
networkmanager_fix_unmanaged
|
||||
exit 0
|
||||
fi
|
||||
|
||||
WIFI_IFACE=$1
|
||||
|
||||
if ! is_wifi_interface ${WIFI_IFACE}; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user