summaryrefslogtreecommitdiff
path: root/src/validators/ethernet-interface
blob: 2bf92812e095a9dc7eb0ca285aac22cf59457f5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

if ! [[ "$1" =~ ^(lan|eth|eno|ens|enp|enx)[0-9]+$ ]]; then
    echo "Error: $1 is not an ethernet interface"
    exit 1
fi

if ! [ -d "/sys/class/net/$1" ]; then
    echo "Error: $1 interface does not exist in the system"
    exit 1
fi

exit 0