Had to edit gitignore to add config.sh

This commit is contained in:
Tristan Ancelet 2023-11-12 18:24:24 -06:00
parent 2916cdc102
commit 9320c9d340
2 changed files with 29 additions and 0 deletions

1
.gitignore vendored
View File

@ -4,4 +4,5 @@
!utils !utils
!utils/* !utils/*
!main.sh !main.sh
!config.sh

28
config.sh Normal file
View 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