summaryrefslogtreecommitdiffstats
path: root/netset
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2018-03-30 18:05:42 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2018-03-30 18:05:42 +0200
commitf1a012e8033de4cc49117488a147bd5461e8efa7 (patch)
treec049929ffa050c259b291688e1cfa6eb4bdee979 /netset
parentf46a10e52be96e2f149e40f3aa19307922d50bbc (diff)
downloadbin-f1a012e8033de4cc49117488a147bd5461e8efa7.zip
bin-f1a012e8033de4cc49117488a147bd5461e8efa7.tar.gz
improve netset
Diffstat (limited to 'netset')
-rwxr-xr-xnetset18
1 files changed, 15 insertions, 3 deletions
diff --git a/netset b/netset
index b1627c2..f6742d9 100755
--- a/netset
+++ b/netset
@@ -11,10 +11,22 @@ then
echo "must be run as root"
exit 1
fi
-$NETCTL stop-all
-PROFILES=$($NETCTL list)
+PROFILES=$($NETCTL list | sed 's/\*//')
select profile in $PROFILES
do
[ -z "$profile" ] && exit 0
- echo "starting profile $profile" && $NETCTL start $profile; break
+ $NETCTL stop-all
+ echo "starting profile $profile" && sleep 1 && $NETCTL start $profile || exit 1
+ break
done
+N=0
+dev=$(cat /etc/netctl/$profile | sed -n 's/Interface\=\(.*\)/\1/p')
+ADDR=$(ip -c addr show dev $dev | grep inet)
+while [ -z "$ADDR" ]
+do
+ N=$((N + 1))
+ [ $N -eq 10 ] && echo " failure" && exit 1
+ echo -n "." && sleep 1
+ ADDR=$(ip -c addr show dev $dev | grep inet)
+done
+echo $ADDR