Make --list to work from any user
This commit is contained in:
19
create_ap
19
create_ap
@ -21,6 +21,10 @@ PROGNAME="$(basename $0)"
|
|||||||
# so we can parse them correctly
|
# so we can parse them correctly
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
||||||
|
# all new files and directories must be readable only by root.
|
||||||
|
# in special cases we must use chmod to give any other permissions.
|
||||||
|
umask 0077
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: "$PROGNAME" [options] <wifi-interface> [<interface-with-internet>] [<access-point-name> [<passphrase>]]"
|
echo "Usage: "$PROGNAME" [options] <wifi-interface> [<interface-with-internet>] [<access-point-name> [<passphrase>]]"
|
||||||
echo
|
echo
|
||||||
@ -719,6 +723,11 @@ if [[ $# -lt 1 && $FIX_UNMANAGED -eq 0 && -z "$STOP_ID" && $LIST_RUNNING -eq 0
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $LIST_RUNNING -eq 1 ]]; then
|
||||||
|
list_running
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $(id -u) -ne 0 ]]; then
|
if [[ $(id -u) -ne 0 ]]; then
|
||||||
echo "You must run it as root." >&2
|
echo "You must run it as root." >&2
|
||||||
exit 1
|
exit 1
|
||||||
@ -729,11 +738,6 @@ if [[ -n "$STOP_ID" ]]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $LIST_RUNNING -eq 1 ]]; then
|
|
||||||
list_running
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $FIX_UNMANAGED -eq 1 ]]; then
|
if [[ $FIX_UNMANAGED -eq 1 ]]; then
|
||||||
networkmanager_fix_unmanaged
|
networkmanager_fix_unmanaged
|
||||||
exit 0
|
exit 0
|
||||||
@ -935,6 +939,11 @@ echo "Config dir: $CONFDIR"
|
|||||||
echo "PID: $$"
|
echo "PID: $$"
|
||||||
echo $$ > $CONFDIR/pid
|
echo $$ > $CONFDIR/pid
|
||||||
|
|
||||||
|
# to make --list work from any user, we must give read
|
||||||
|
# permitions to $CONFDIR and $CONFDIR/pid
|
||||||
|
chmod 755 $CONFDIR
|
||||||
|
chmod 444 $CONFDIR/pid
|
||||||
|
|
||||||
if [[ $NO_VIRT -eq 0 ]]; then
|
if [[ $NO_VIRT -eq 0 ]]; then
|
||||||
VWIFI_IFACE=$(get_virt_iface_name)
|
VWIFI_IFACE=$(get_virt_iface_name)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user