diff options
author | Jim Pryor <profjim@jimpryor.net> | 2009-08-11 14:04:51 +0200 |
---|---|---|
committer | James Rayner <james@archlinux.org> | 2009-08-15 04:28:25 +0200 |
commit | e4271e46d3ddfe0a3dbaef66d51157bfd88ca2ff (patch) | |
tree | 12bde81565b99df88d3a62f31fe8a2a79c4507c0 /src/netcfg | |
parent | 4ede76fb6a5ba81b92b0e3452e954d9eea431a74 (diff) | |
download | netctl-e4271e46d3ddfe0a3dbaef66d51157bfd88ca2ff.tar.gz netctl-e4271e46d3ddfe0a3dbaef66d51157bfd88ca2ff.tar.xz |
netcfg current and netcfg list
These and "netcfg version" don't require root privileges.
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
Diffstat (limited to 'src/netcfg')
-rw-r--r-- | src/netcfg | 28 |
1 files changed, 26 insertions, 2 deletions
@@ -17,25 +17,49 @@ usage() echo " Start specified profile: netcfg profile " echo " Other functions: netcfg argument profile" echo "Arguments:" + echo " current Report currently running profiles" 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 "-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 "-u, up Start specified profile" echo "-v, version Output version information and exit" echo " all-resume Resume previously suspended profiles and reconnect them" echo " all-suspend Store a list of current running profiles and suspend them" + exit 1 } # TODO: Re-add ROOT check and rewrite with getopts from BashFAQ -case $1 in +case "$1" in --version|-v|version) - version;; + version + exit 0;; --help|-h|help) usage;; + list|-l) + echo "Available Profiles" + echo "------------------" + list_profiles + exit 0;; + current) + if [[ -d "$STATE_DIR/profiles/" ]]; then + ls "$STATE_DIR/profiles/" + exit 0 + else + exit_stderr "No active profiles." + fi;; +esac + +if [[ $(id -u) -gt 0 ]]; then + exit_stderr "This script should be run as root." +fi + +case "$1" in + -c|check-iface|-u|up) CHECK="YES"; profile_up $2;; |