summaryrefslogtreecommitdiffstats
path: root/retiolum/bin/check-free-retiolum-v4
blob: 3492f7f6bb9fb130d2ba6bf956e245b83ee8cd4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /bin/sh
netname=retiolum
myipv4=${1-10.243.0.-1}
v4num=${myipv4##*.}
printf "Retard check: "
if [ "$v4num" -gt 0 -a "$v4num" -lt "256" ];
then 
  printf "No retard detected\n"
  cd /etc/tinc/$netname/hosts
  printf "Check if ip is still free: "
  for i in `ls -1`; do
    if grep -q -e $myipv4\$ $i ;then
      echo "Host IP already taken by $i! "
      exit 1
    fi
  done
  printf "Passed\n"
else
  printf "you are made of stupid. bailing out\n" 
  exit 1
fi