diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2018-03-30 18:05:42 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2018-03-30 18:05:42 +0200 |
commit | f1a012e8033de4cc49117488a147bd5461e8efa7 (patch) | |
tree | c049929ffa050c259b291688e1cfa6eb4bdee979 | |
parent | f46a10e52be96e2f149e40f3aa19307922d50bbc (diff) | |
download | bin-f1a012e8033de4cc49117488a147bd5461e8efa7.zip bin-f1a012e8033de4cc49117488a147bd5461e8efa7.tar.gz |
improve netset
-rwxr-xr-x | netset | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -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 |