summaryrefslogtreecommitdiff
path: root/lib/inet2.sh
blob: 672286e0b0f8e30cb0737547bbe699085cc5dc10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env sh

run() {
  printf '$ \x1b[32;1m%s\x1b[0m\n' "$*"
  "$@"
}
step() {
  printf '\x1b[34;1m>> %s\x1b[0m\n' "$*"
}

getval() {
  /var/lib/inet2/config.awk /etc/inet2.conf "$@"
}

haskey() {
  getval interface | while read -r inter; do
    if getval "interface $inter" "$1"; then
      echo "true"
      return
    fi
  done
}