|
|
|
@ -1,5 +1,8 @@
|
|
|
|
|
#!/bin/sh |
|
|
|
|
|
|
|
|
|
# Control the network interfaces |
|
|
|
|
# Depends: iproute2, netctl |
|
|
|
|
|
|
|
|
|
WIRELESS="wlan0" |
|
|
|
|
ETHERNET="eth0" |
|
|
|
|
PROFILE="eth0-dhcp" |
|
|
|
@ -11,19 +14,21 @@ help() {
|
|
|
|
|
|
|
|
|
|
cat << EOF |
|
|
|
|
${B}NAME${N} |
|
|
|
|
netctl.sh - network manager |
|
|
|
|
netctl.sh - control the network interfaces |
|
|
|
|
|
|
|
|
|
${B}SYNOPSIS${N} |
|
|
|
|
${B}netctl.sh${N} [${U}OPTION${N}] [${U}ARG${N}] |
|
|
|
|
${B}netctl.sh${N} [${U}OPTION${N}] [${U}COMMAND${N}] |
|
|
|
|
|
|
|
|
|
${B}OPTIONS${N} |
|
|
|
|
${B}-e${N} [${U}ARG${N}] |
|
|
|
|
${B}-h${N} Display usage message and exit. |
|
|
|
|
|
|
|
|
|
${B}-e${N} [${U}STATE${N}] |
|
|
|
|
Perform action on ethernet. |
|
|
|
|
|
|
|
|
|
${B}-w${N} [${U}ARG${N}] |
|
|
|
|
${B}-w${N} [${U}STATE${N}] |
|
|
|
|
Perform action on wireless. |
|
|
|
|
|
|
|
|
|
${B}ARGS${N} |
|
|
|
|
${B}COMMANDS${N} |
|
|
|
|
1, on |
|
|
|
|
Enable selected option. |
|
|
|
|
|
|
|
|
@ -35,13 +40,14 @@ EOF
|
|
|
|
|
# Exit if no option is provided |
|
|
|
|
[ "$#" -eq 0 ] && help && exit 1 |
|
|
|
|
|
|
|
|
|
# Option handling |
|
|
|
|
SCRIPT="$(basename "$0")" |
|
|
|
|
|
|
|
|
|
# Option handling |
|
|
|
|
while getopts ':h?e:w:' opt; do |
|
|
|
|
case $opt in |
|
|
|
|
h) |
|
|
|
|
help |
|
|
|
|
exit 1 |
|
|
|
|
exit 0 |
|
|
|
|
;; |
|
|
|
|
e) |
|
|
|
|
dev="ethernet" |
|
|
|
@ -89,7 +95,8 @@ case "$1" in
|
|
|
|
|
[ "$dev" = "ethernet" ] && ethernet 0 || wireless 0 |
|
|
|
|
;; |
|
|
|
|
*) |
|
|
|
|
help |
|
|
|
|
echo "$SCRIPT: invalid command '$1'" |
|
|
|
|
echo "Try '$SCRIPT -h' for more information." |
|
|
|
|
exit 1 |
|
|
|
|
;; |
|
|
|
|
esac |
|
|
|
|