blob: f6742d944c7fafb21f79768a696bacb2d936801c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#! /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/\*//')
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=$(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
|