#! /bin/bash NETCTL=$(which netctl) if [ -z "$NETCTL" ] then echo "netctl not found" exit 1 fi if [ $UID -ne 0 ] 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 N=0 dev=$(cat /etc/netctl/$profile | sed -n 's/Interface\=\(.*\)/\1/p') ADDR="" 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 | sed -n '/inet /p') done echo echo $ADDR