From 94ae8b1ccd08b7d0b2408db5b2054dee53413166 Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Mon, 12 Mar 2012 16:01:43 +0100 Subject: Rename -i parameter to -D -i is not a very cool parameter for downing an interface. Change it to -D so that it mirrors -R in the sense that a capital is used for interface-based actions. The old behaviour is kept (undocumented) for backward compatibility. Also a typo (iface-recont should have been iface-recon) is fixed. Lastly some restrictions on profile naming are included in the documentation. The "should not start with '@'" is only for usage with net-profiles. --- contrib/bash-completion | 4 ++-- contrib/zsh-completion | 2 +- docs/netcfg-profiles.5.txt | 4 +++- docs/netcfg.8.txt | 2 +- scripts/netcfg | 23 +++++++++++------------ scripts/netcfg-wpa_actiond | 4 ++-- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/contrib/bash-completion b/contrib/bash-completion index 8ec6a12..d045844 100644 --- a/contrib/bash-completion +++ b/contrib/bash-completion @@ -18,7 +18,7 @@ _netcfg () cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" - opts="-l -c -u -r -R -d -i -a -v -h" + opts="-l -c -u -r -R -d -D -a -v -h" lopts="--help --version" cmds="list current check-iface up reconnect iface-recon down iface-down all-down all-suspend" prfls="`find /etc/network.d -maxdepth 1 -type f -not -name '*~' -not -name '*.conf' -not -name '.*' d -printf '%f\n'`" @@ -40,7 +40,7 @@ _netcfg () esac case "${prev}" in - -R|iface-recon|-i|iface-down) + -R|iface-recon|-D|iface-down) _connected_intfs return 0 ;; diff --git a/contrib/zsh-completion b/contrib/zsh-completion index 1f9fa9e..8d05ee4 100644 --- a/contrib/zsh-completion +++ b/contrib/zsh-completion @@ -38,7 +38,7 @@ _arguments -C \ '(- *)-r[Disconnect and reconnect the specified profile]:Active profiles:up_profiles' \ '(- *)-R[Reconnect profile active on specified interface]:Active interface:up_ifaces' \ '(- *)-d[Take specified profile down]:Active profile:up_profiles' \ -'(- *)-i[Take down profile active on specified interface]:Active interface:up_ifaces' \ +'(- *)-D[Take down profile active on specified interface]:Active interface:up_ifaces' \ '(- *)-a[Take all active profiles down]' \ '(- *)*:All options:all_options' diff --git a/docs/netcfg-profiles.5.txt b/docs/netcfg-profiles.5.txt index 7c33500..e39209f 100644 --- a/docs/netcfg-profiles.5.txt +++ b/docs/netcfg-profiles.5.txt @@ -12,7 +12,9 @@ The *netcfg*(8) profiles are plain text files that defines variables for netcfg behaviour. They must be compliant with *bash*(1) shell syntax and usually do not execute any code. -They are named '/etc/network.d/$\{profile_name}'. +They are named '/etc/network.d/$\{profile_name}', where ++$\{profile_name\}+ must not contain a newline character and should not +start with the `@'-sign. OVERVIEW diff --git a/docs/netcfg.8.txt b/docs/netcfg.8.txt index a878ba3..1d20234 100644 --- a/docs/netcfg.8.txt +++ b/docs/netcfg.8.txt @@ -45,7 +45,7 @@ OPTIONS Reconnect profile active on specified interface *-d, down* _profile_:: Stop the specified profile -*-i, iface-down* _interface_:: +*-D, iface-down* _interface_:: Stop the profile up on the specified interface. *-a, all-down*:: Stop all connected profiles diff --git a/scripts/netcfg b/scripts/netcfg index e6de3bd..f286796 100755 --- a/scripts/netcfg +++ b/scripts/netcfg @@ -20,8 +20,8 @@ usage() echo "-a, all-down Take all active profiles down" echo "-c, check-iface Do not start profile if interface is already up" echo "-d, down Take specified profile down" + echo "-D, iface-down Take down profile active on specified interface" echo "-h, help This help message" - echo "-i, iface-down Take down profile active on specified interface" echo "-l, list List all available profiles" echo "-r, reconnect Disconnect and reconnect specified profile" echo "-R, iface-recon Reconnect profile active on specified interface" @@ -60,33 +60,32 @@ fi cd / case "$1" in - -c|check-iface|-u|up) CHECK="YES" profile_up "$2";; - clean) - rm "$STATE_DIR/interfaces"/* 2> /dev/null - rm "$STATE_DIR/profiles"/* 2> /dev/null - rm "$STATE_DIR/suspend"/* 2> /dev/null - rm "$STATE_DIR/last_profile" 2> /dev/null - killall wpa_supplicant 2> /dev/null - killall dhcpcd 2> /dev/null - ;; -d|down) profile_down "$2";; - -i|iface-down) + -D|iface-down|-i) # -i is there for backward compatibility (pre 2.7) interface_down "$2";; -a|all-down) all_down;; -r|reconnect) profile_down "$2" profile_up "$2";; - -R|iface-recont) + -R|iface-recon) interface_reconnect "$2";; all-resume) all_resume;; all-suspend) all_suspend;; + clean) + rm "$STATE_DIR/interfaces"/* 2> /dev/null + rm "$STATE_DIR/profiles"/* 2> /dev/null + rm "$STATE_DIR/suspend"/* 2> /dev/null + rm "$STATE_DIR/last_profile" 2> /dev/null + killall wpa_supplicant 2> /dev/null + killall dhcpcd 2> /dev/null + ;; -*|--*) usage exit 1;; diff --git a/scripts/netcfg-wpa_actiond b/scripts/netcfg-wpa_actiond index f276ab2..43f7183 100755 --- a/scripts/netcfg-wpa_actiond +++ b/scripts/netcfg-wpa_actiond @@ -18,7 +18,7 @@ case $1 in [[ -z $2 ]] && echo "Please specify an interface to stop" && exit 1 interface=$2 [[ -f "$IFACE_DIR/$interface" ]] && source "$IFACE_DIR/$interface" - netcfg -i "$interface" + netcfg -D "$interface" stop_wpa "$interface" kill $(< "/run/wpa_actiond_${2}.pid") # only try to disable software rfkill switches (FS#25514) @@ -43,7 +43,7 @@ fi [[ -f "$IFACE_DIR/$interface" ]] && source "$IFACE_DIR/$interface" if [[ -f "$CONN_DIR/interfaces/$interface" ]]; then - netcfg -i "$interface" + netcfg -D "$interface" fi if [[ -n "$RFKILL" ]]; then # Enable radio if necessary -- cgit v1.2.3-24-g4f1b