mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-19 05:40:13 +00:00
Remove no-longer-needed utils
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
parent
76a6b42075
commit
764aa48c14
2 changed files with 0 additions and 102 deletions
|
@ -25,7 +25,6 @@
|
|||
#
|
||||
# Example usage:
|
||||
# addOrEditKeyValPair "/etc/pihole/setupVars.conf" "BLOCKING_ENABLED" "true"
|
||||
# TODO: We miight not actually need this function in v6
|
||||
#######################
|
||||
addOrEditKeyValPair() {
|
||||
local file="${1}"
|
||||
|
@ -44,43 +43,6 @@ addOrEditKeyValPair() {
|
|||
fi
|
||||
}
|
||||
|
||||
#######################
|
||||
# Takes two arguments: file, and key.
|
||||
# Adds a key to target file
|
||||
#
|
||||
# Example usage:
|
||||
# addKey "/etc/dnsmasq.d/01-pihole.conf" "log-queries"
|
||||
#######################
|
||||
addKey(){
|
||||
local file="${1}"
|
||||
local key="${2}"
|
||||
|
||||
# touch file to prevent grep error if file does not exist yet
|
||||
touch "${file}"
|
||||
|
||||
# Match key against entire line, using both anchors. We assume
|
||||
# that the file's keys never have bounding whitespace. Anchors
|
||||
# are necessary to ensure the key is considered absent when it
|
||||
# is a substring of another key present in the file.
|
||||
if ! grep -q "^${key}$" "${file}"; then
|
||||
# Key does not exist, add it.
|
||||
echo "${key}" >> "${file}"
|
||||
fi
|
||||
}
|
||||
|
||||
#######################
|
||||
# Takes two arguments: file, and key.
|
||||
# Deletes a key or key/value pair from target file
|
||||
#
|
||||
# Example usage:
|
||||
# removeKey "/etc/pihole/setupVars.conf" "PIHOLE_DNS_1"
|
||||
#######################
|
||||
removeKey() {
|
||||
local file="${1}"
|
||||
local key="${2}"
|
||||
sed -i "/^${key}/d" "${file}"
|
||||
}
|
||||
|
||||
#######################
|
||||
# returns FTL's PID based on the content of the pihole-FTL.pid file
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue