mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 14:58:08 +00:00
Addressed Stickler ShellCheck lints
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
parent
a0fc38d6a2
commit
0c892e6b3a
@ -788,14 +788,14 @@ setStaticIPv4() {
|
|||||||
elif [[ -f "/etc/sysconfig/network-scripts/ifcfg-${PIHOLE_INTERFACE}" ]];then
|
elif [[ -f "/etc/sysconfig/network-scripts/ifcfg-${PIHOLE_INTERFACE}" ]];then
|
||||||
# If it exists,
|
# If it exists,
|
||||||
IFCFG_FILE=/etc/sysconfig/network-scripts/ifcfg-${PIHOLE_INTERFACE}
|
IFCFG_FILE=/etc/sysconfig/network-scripts/ifcfg-${PIHOLE_INTERFACE}
|
||||||
printf -v IPADDR "${IPV4_ADDRESS%%/*}"
|
printf -v IPADDR "%s" "${IPV4_ADDRESS%%/*}"
|
||||||
# check if the desired IP is already set
|
# check if the desired IP is already set
|
||||||
if grep -Eq "${IPADDR}(\\b|\\/)" "${IFCFG_FILE}"; then
|
if grep -Eq "${IPADDR}(\\b|\\/)" "${IFCFG_FILE}"; then
|
||||||
printf " %b Static IP already configured\\n" "${INFO}"
|
printf " %b Static IP already configured\\n" "${INFO}"
|
||||||
# Otherwise,
|
# Otherwise,
|
||||||
else
|
else
|
||||||
# Put the IP in variables without the CIDR notation
|
# Put the IP in variables without the CIDR notation
|
||||||
printf -v CIDR "${IPV4_ADDRESS##*/}"
|
printf -v CIDR "%s" "${IPV4_ADDRESS##*/}"
|
||||||
# Backup existing interface configuration:
|
# Backup existing interface configuration:
|
||||||
cp "${IFCFG_FILE}" "${IFCFG_FILE}".pihole.orig
|
cp "${IFCFG_FILE}" "${IFCFG_FILE}".pihole.orig
|
||||||
# Build Interface configuration file using the GLOBAL variables we have
|
# Build Interface configuration file using the GLOBAL variables we have
|
||||||
@ -946,8 +946,8 @@ setDNS() {
|
|||||||
# Clean user input and replace whitespace with comma.
|
# Clean user input and replace whitespace with comma.
|
||||||
piholeDNS=$(sed 's/[, \t]\+/,/g' <<< "${piholeDNS}")
|
piholeDNS=$(sed 's/[, \t]\+/,/g' <<< "${piholeDNS}")
|
||||||
|
|
||||||
printf -v PIHOLE_DNS_1 "${piholeDNS%%,*}"
|
printf -v PIHOLE_DNS_1 "%s" "${piholeDNS%%,*}"
|
||||||
printf -v PIHOLE_DNS_2 "${piholeDNS##*,}"
|
printf -v PIHOLE_DNS_2 "%s" "${piholeDNS##*,}"
|
||||||
|
|
||||||
# If the IP is valid,
|
# If the IP is valid,
|
||||||
if ! valid_ip "${PIHOLE_DNS_1}" || [[ ! "${PIHOLE_DNS_1}" ]]; then
|
if ! valid_ip "${PIHOLE_DNS_1}" || [[ ! "${PIHOLE_DNS_1}" ]]; then
|
||||||
@ -1252,7 +1252,7 @@ installScripts() {
|
|||||||
else
|
else
|
||||||
# Show an error and exit
|
# Show an error and exit
|
||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
printf "\t\t%bError: Local repo %s not found, exiting installer%b\\n" "${COL_LIGHT_RED}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
printf "\\t\\t%bError: Local repo %s not found, exiting installer%b\\n" "${COL_LIGHT_RED}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -1734,7 +1734,7 @@ finalExports() {
|
|||||||
installLogrotate() {
|
installLogrotate() {
|
||||||
|
|
||||||
local str="Installing latest logrotate script"
|
local str="Installing latest logrotate script"
|
||||||
printf "\\n %b %s..." "${INFO} ${str}"
|
printf "\\n %b %s..." "${INFO}" "${str}"
|
||||||
# Copy the file over from the local repo
|
# Copy the file over from the local repo
|
||||||
cp ${PI_HOLE_LOCAL_REPO}/advanced/Templates/logrotate /etc/pihole/logrotate
|
cp ${PI_HOLE_LOCAL_REPO}/advanced/Templates/logrotate /etc/pihole/logrotate
|
||||||
# Different operating systems have different user / group
|
# Different operating systems have different user / group
|
||||||
|
Loading…
Reference in New Issue
Block a user