#!/bin/bash

_install() {
    for item in `ls /etc/sysconfig/network-scripts/ifcfg-*|grep -P 'ifcfg-eth|ifcfg-net'|awk -F'-' '{print $NF}'`
    do
        [[ $item =~ "net2" ]] && continue
        if [[ ! `ls /sys/class/net/|grep -P 'eth|net'` =~ $item ]];then
            rm -f /etc/sysconfig/network-scripts/ifcfg-$item
        fi
    done

}

_check() {
    _check="PASS"
    for item in `ls /etc/sysconfig/network-scripts/ifcfg-*|grep -P 'ifcfg-eth|ifcfg-net'|awk -F'-' '{print $NF}'`
    do
        if [[ ! `ls /sys/class/net/|grep -P 'eth|net'` =~ $item ]];then
            _check="FAIL"
            PRINT_ERR "/etc/sysconfig/network-scripts/ifcfg-$item must be removed because $eth not exist"
        fi
    done

}
