From 249fc3c9a06247e56d078538f20dd67c898126b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 11 Feb 2020 11:35:58 +0100 Subject: netset : support network profile as first argument --- netset | 25 +++++++++++++++++-------- 1 file 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="" -- cgit v1.1-2-g2b99