Had to edit gitignore to add config.sh
This commit is contained in:
parent
2916cdc102
commit
9320c9d340
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,4 +4,5 @@
|
||||
!utils
|
||||
!utils/*
|
||||
!main.sh
|
||||
!config.sh
|
||||
|
||||
|
28
config.sh
Normal file
28
config.sh
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# File Definitions
|
||||
DHCPD_CONFIG="$PWD/dhcpd.conf"
|
||||
DHCPD_LEASES="$PWD/dhcpd.leases"
|
||||
|
||||
export PROJECT_DIR=`dirname $0`
|
||||
export DHCPD_CONFIG_FILE="${DHCPD_CONFIG:="/etc/dhcpd.conf"}"
|
||||
export LEASES_FILE="${DHCPD_LEASES:="/var/lib/dhcpd/dhcpd.leases"}"
|
||||
|
||||
# Variable Definitions
|
||||
export IP_REGEX='[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'
|
||||
export SHARED_NETWORK_BEGIN_REGEX='^[[:space:]]*shared-network[[:space:]]+"[a-zA-Z0-9\-]+"[[:space:]]\{'
|
||||
export SUBNET_BEGIN_REGEX="^[[:space:]]*subnet[[:space:]]+$IP_REGEX[[:space:]]+netmask[[:space:]]+$IP_REGEX[[:space:]]+\{"
|
||||
export HOST_BEGIN_REGEX='^[[:space:]]*host[[:space:]]+[a-zA-Z0-9_\-]+[[:space:]]+\{'
|
||||
export POOL_BEGIN_REGEX='^[[:space:]]*pool[[:space:]]+\{'
|
||||
export POOL_RANGE_REGEX="^[[:space:]]*range[[:space:]]$IP_REGEX[[:space:]]$IP_REGEX[[:space:]]*;"
|
||||
|
||||
include () {
|
||||
local INCLUDE_FILE="${1:?"include: File was not included"}"
|
||||
local INCLUDE_PATH="$PROJECT_DIR/utils/$INCLUDE_FILE"
|
||||
|
||||
if [[ -f $INCLUDE_PATH ]]; then
|
||||
. $INCLUDE_PATH
|
||||
fi
|
||||
}
|
||||
|
||||
export -f include
|
Loading…
Reference in New Issue
Block a user