summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xnetset25
1 files changed, 17 insertions, 8 deletions
diff --git a/netset b/netset
index 83e19b9..cf28795 100755
--- a/netset
+++ b/netset
@@ -11,14 +11,23 @@ then
echo "must be run as root"
exit 1
fi
-PROFILES=$($NETCTL list | sed 's/\*//' | sort)
-select profile in $PROFILES
-do
- [ -z "$profile" ] && exit 0
- $NETCTL stop-all
- echo "starting profile $profile" && sleep 1 && $NETCTL start $profile || exit 1
- break
-done
+if [ $# -gt 0 ]
+then
+ profile=$1
+else
+ PROFILES=$($NETCTL list | sed 's/\*//' | sort)
+ select profile in $PROFILES
+ do
+ [ -z "$profile" ] && exit 0
+ break
+ done
+fi
+if [ ! -r /etc/netctl/$profile ]
+then
+ echo "unknown network profile : $profile" && exit 1
+fi
+$NETCTL stop-all
+echo "starting profile $profile" && sleep 1 && $NETCTL start $profile || exit 1
N=0
dev=$(cat /etc/netctl/$profile | sed -n 's/Interface\=\(.*\)/\1/p')
ADDR=""