mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Use both old and new strings for detecting whether this is a Pi-hole dnsmasq config file
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
a2a7e80007
commit
0efc46260f
2 changed files with 9 additions and 5 deletions
|
@ -1224,7 +1224,8 @@ version_check_dnsmasq() {
|
||||||
# Local, named variables
|
# Local, named variables
|
||||||
local dnsmasq_conf="/etc/dnsmasq.conf"
|
local dnsmasq_conf="/etc/dnsmasq.conf"
|
||||||
local dnsmasq_conf_orig="/etc/dnsmasq.conf.orig"
|
local dnsmasq_conf_orig="/etc/dnsmasq.conf.orig"
|
||||||
local dnsmasq_pihole_id_string="# Dnsmasq config for Pi-hole's FTLDNS"
|
local dnsmasq_pihole_id_string="addn-hosts=/etc/pihole/gravity.list"
|
||||||
|
local dnsmasq_pihole_id_string2="# Dnsmasq config for Pi-hole's FTLDNS"
|
||||||
local dnsmasq_original_config="${PI_HOLE_LOCAL_REPO}/advanced/dnsmasq.conf.original"
|
local dnsmasq_original_config="${PI_HOLE_LOCAL_REPO}/advanced/dnsmasq.conf.original"
|
||||||
local dnsmasq_pihole_01_snippet="${PI_HOLE_LOCAL_REPO}/advanced/01-pihole.conf"
|
local dnsmasq_pihole_01_snippet="${PI_HOLE_LOCAL_REPO}/advanced/01-pihole.conf"
|
||||||
local dnsmasq_pihole_01_location="/etc/dnsmasq.d/01-pihole.conf"
|
local dnsmasq_pihole_01_location="/etc/dnsmasq.d/01-pihole.conf"
|
||||||
|
@ -1233,7 +1234,8 @@ version_check_dnsmasq() {
|
||||||
if [[ -f "${dnsmasq_conf}" ]]; then
|
if [[ -f "${dnsmasq_conf}" ]]; then
|
||||||
printf " %b Existing dnsmasq.conf found..." "${INFO}"
|
printf " %b Existing dnsmasq.conf found..." "${INFO}"
|
||||||
# If a specific string is found within this file, we presume it's from older versions on Pi-hole,
|
# If a specific string is found within this file, we presume it's from older versions on Pi-hole,
|
||||||
if grep -q ${dnsmasq_pihole_id_string} ${dnsmasq_conf}; then
|
if grep -q "${dnsmasq_pihole_id_string}" "${dnsmasq_conf}" ||
|
||||||
|
grep -q "${dnsmasq_pihole_id_string2}" "${dnsmasq_conf}"; then
|
||||||
printf " it is from a previous Pi-hole install.\\n"
|
printf " it is from a previous Pi-hole install.\\n"
|
||||||
printf " %b Backing up dnsmasq.conf to dnsmasq.conf.orig..." "${INFO}"
|
printf " %b Backing up dnsmasq.conf to dnsmasq.conf.orig..." "${INFO}"
|
||||||
# so backup the original file
|
# so backup the original file
|
||||||
|
|
|
@ -20,8 +20,9 @@ source "${regexconverter}"
|
||||||
|
|
||||||
basename="pihole"
|
basename="pihole"
|
||||||
PIHOLE_COMMAND="/usr/local/bin/${basename}"
|
PIHOLE_COMMAND="/usr/local/bin/${basename}"
|
||||||
PIHOLE_USER="pihole"
|
DATABASE_USER="pihole"
|
||||||
PIHOLE_GROUP="pihole"
|
DATABASE_GROUP="www-data"
|
||||||
|
DATABASE_PERMISSIONS="0660"
|
||||||
|
|
||||||
piholeDir="/etc/${basename}"
|
piholeDir="/etc/${basename}"
|
||||||
|
|
||||||
|
@ -86,7 +87,8 @@ fi
|
||||||
# Generate new sqlite3 file from schema template
|
# Generate new sqlite3 file from schema template
|
||||||
generate_gravity_database() {
|
generate_gravity_database() {
|
||||||
sqlite3 "${gravityDBfile}" < "${gravityDBschema}"
|
sqlite3 "${gravityDBfile}" < "${gravityDBschema}"
|
||||||
chown $PIHOLE_USER:$PIHOLE_GROUP "${gravityDBfile}"
|
chown ${DATABASE_USER}:${DATABASE_GROUP} "${piholeDir}" "${gravityDBfile}"
|
||||||
|
chmod ${DATABASE_PERMISSIONS} "${piholeDir}" "${gravityDBfile}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Import domains from file and store them in the specified database table
|
# Import domains from file and store them in the specified database table
|
||||||
|
|
Loading…
Reference in a new issue