Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 87cb43cc85 | |||
| 0a903feb12 | |||
| 15874b002e | |||
| ca9de23ca5 | |||
| d807c40ba5 | |||
| 4125bcccdc | |||
| ac37014628 | |||
| d765ce768f | |||
| 1a3a23a867 |
@@ -50,9 +50,10 @@ rm -f "/etc/pihole/GitHubVersions"
|
|||||||
rm -f "/etc/pihole/localbranches"
|
rm -f "/etc/pihole/localbranches"
|
||||||
rm -f "/etc/pihole/localversions"
|
rm -f "/etc/pihole/localversions"
|
||||||
|
|
||||||
# Create new versions file if it does not exist
|
|
||||||
VERSION_FILE="/etc/pihole/versions"
|
VERSION_FILE="/etc/pihole/versions"
|
||||||
touch "${VERSION_FILE}"
|
|
||||||
|
# Truncates the file to zero length if it exists to clear it up, otherwise creates an empty file.
|
||||||
|
truncate -s 0 "${VERSION_FILE}"
|
||||||
chmod 644 "${VERSION_FILE}"
|
chmod 644 "${VERSION_FILE}"
|
||||||
|
|
||||||
# if /pihole.docker.tag file exists, we will use it's value later in this script
|
# if /pihole.docker.tag file exists, we will use it's value later in this script
|
||||||
|
|||||||
@@ -30,9 +30,6 @@ addOrEditKeyValPair() {
|
|||||||
local key="${2}"
|
local key="${2}"
|
||||||
local value="${3}"
|
local value="${3}"
|
||||||
|
|
||||||
# touch file to prevent grep error if file does not exist yet
|
|
||||||
touch "${file}"
|
|
||||||
|
|
||||||
if grep -q "^${key}=" "${file}"; then
|
if grep -q "^${key}=" "${file}"; then
|
||||||
# Key already exists in file, modify the value
|
# Key already exists in file, modify the value
|
||||||
sed -i "/^${key}=/c\\${key}=${value}" "${file}"
|
sed -i "/^${key}=/c\\${key}=${value}" "${file}"
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ start() {
|
|||||||
stop() {
|
stop() {
|
||||||
if is_running; then
|
if is_running; then
|
||||||
kill "${FTL_PID}"
|
kill "${FTL_PID}"
|
||||||
# Give FTL 60 seconds to gracefully stop
|
# Give FTL 120 seconds to gracefully stop
|
||||||
i=1
|
i=1
|
||||||
while [ "${i}" -le 60 ]; do
|
while [ "${i}" -le 120 ]; do
|
||||||
if ! is_running; then
|
if ! is_running; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ ExecReload=/bin/kill -HUP $MAINPID
|
|||||||
ExecStopPost=+/opt/pihole/pihole-FTL-poststop.sh
|
ExecStopPost=+/opt/pihole/pihole-FTL-poststop.sh
|
||||||
|
|
||||||
# Use graceful shutdown with a reasonable timeout
|
# Use graceful shutdown with a reasonable timeout
|
||||||
TimeoutStopSec=60s
|
TimeoutStopSec=120s
|
||||||
|
|
||||||
# Make /usr, /boot, /etc and possibly some more folders read-only...
|
# Make /usr, /boot, /etc and possibly some more folders read-only...
|
||||||
ProtectSystem=full
|
ProtectSystem=full
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ def test_key_val_replacement_works(host):
|
|||||||
"""Confirms addOrEditKeyValPair either adds or replaces a key value pair in a given file"""
|
"""Confirms addOrEditKeyValPair either adds or replaces a key value pair in a given file"""
|
||||||
host.run("""
|
host.run("""
|
||||||
source /opt/pihole/utils.sh
|
source /opt/pihole/utils.sh
|
||||||
|
touch ./testoutput
|
||||||
addOrEditKeyValPair "./testoutput" "KEY_ONE" "value1"
|
addOrEditKeyValPair "./testoutput" "KEY_ONE" "value1"
|
||||||
addOrEditKeyValPair "./testoutput" "KEY_TWO" "value2"
|
addOrEditKeyValPair "./testoutput" "KEY_TWO" "value2"
|
||||||
addOrEditKeyValPair "./testoutput" "KEY_ONE" "value3"
|
addOrEditKeyValPair "./testoutput" "KEY_ONE" "value3"
|
||||||
|
|||||||
Reference in New Issue
Block a user