1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-18 06:08:21 +00:00

basic-install.sh - no CIDR in ifcfg-*

Do not expect CIDR format IP addresses in /etc/sysconfig/network-scripts/ifcfg-* files as it is not a requirement.
Expect only:
IPADDR=10.10.10.10
Do not expect:
IPADDR=10.10.10.10/24
This commit is contained in:
mettacrawler 2017-11-05 15:28:44 -05:00 committed by GitHub
parent 5221767a70
commit 35dc4800e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -684,13 +684,13 @@ setStaticIPv4() {
elif [[ -f "/etc/sysconfig/network-scripts/ifcfg-${PIHOLE_INTERFACE}" ]];then
# If it exists,
IFCFG_FILE=/etc/sysconfig/network-scripts/ifcfg-${PIHOLE_INTERFACE}
IPADDR=$(echo "${IPV4_ADDRESS}" | cut -f1 -d/)
# check if the desired IP is already set
if grep -q "${IPV4_ADDRESS}" "${IFCFG_FILE}"; then
if grep -q "${IPADDR}" "${IFCFG_FILE}"; then
echo -e " ${INFO} Static IP already configured"
# Otherwise,
else
# Put the IP in variables without the CIDR notation
IPADDR=$(echo "${IPV4_ADDRESS}" | cut -f1 -d/)
CIDR=$(echo "${IPV4_ADDRESS}" | cut -f2 -d/)
# Backup existing interface configuration:
cp "${IFCFG_FILE}" "${IFCFG_FILE}".pihole.orig