commit 3ca36638947f69755e956e432fa4f926f42a3faf
parent 3f08801967f78d6cadb3e50f0b1392b178d56111
Author: Karthik K <hashken.distro@gmail.com>
Date: Wed, 6 May 2015 22:38:40 +0530
Print descriptive messages for several switches
* Print messages for terminating switches like --list, --stop,
--fix-unmanaged and --daemon
* Minor change in help string
Diffstat:
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/bash_completion b/bash_completion
@@ -111,7 +111,8 @@ _create_ap() {
# No Options
;;
--stop)
- opts=$("$1" --list)
+ local stop_awk_cmd='$1 ~ /^[0-9]+$/'
+ opts=$("$1" --list | awk "$stop_awk_cmd")
;;
--list)
# No Options
diff --git a/create_ap b/create_ap
@@ -47,7 +47,7 @@ usage() {
echo " --freq-band <GHz> Set frequency band. Valid inputs: 2.4, 5 (default: 2.4)"
echo " --driver Choose your WiFi adapter driver (default: nl80211)"
echo " --no-virt Do not create virtual interface"
- echo " --no-haveged Do not run \`haveged' automatically when needed"
+ echo " --no-haveged Do not run 'haveged' automatically when needed"
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"
@@ -915,6 +915,7 @@ while :; do
esac
done
+# Check if required number of positional args are present
if [[ $# -lt 1 && $FIX_UNMANAGED -eq 0 && -z "$STOP_ID" && $LIST_RUNNING -eq 0 ]]; then
usage >&2
exit 1
@@ -934,6 +935,7 @@ trap "clean_exit" SIGINT SIGUSR1
trap "die" SIGUSR2
if [[ $LIST_RUNNING -eq 1 ]]; then
+ echo -e "List of running $PROGNAME instances:\n"
list_running
exit 0
fi
@@ -944,11 +946,13 @@ if [[ $(id -u) -ne 0 ]]; then
fi
if [[ -n "$STOP_ID" ]]; then
+ echo "Trying to kill $PROGNAME instance associated with $STOP_ID..."
send_stop "$STOP_ID"
exit 0
fi
if [[ $FIX_UNMANAGED -eq 1 ]]; then
+ echo "Trying to fix unmanaged status in NetworkManager..."
networkmanager_fix_unmanaged
exit 0
fi
@@ -959,6 +963,7 @@ if [[ $DAEMONIZE -eq 1 ]]; then
for x in "${ARGS[@]}"; do
[[ "$x" != "--daemon" ]] && NEW_ARGS+=( "$x" )
done
+ echo "Running as Daemon..."
# run a detached create_ap
setsid "$0" "${NEW_ARGS[@]}" &