Check support files installed and permissions.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
Dan Schaper 2017-02-20 17:28:38 -08:00
parent 8eeb8ad779
commit 4cd598ae10
No known key found for this signature in database
GPG Key ID: 572E999E385B7BFC
2 changed files with 17 additions and 3 deletions

View File

@ -1175,8 +1175,8 @@ FTLinstall() {
if sha1sum --status --quiet -c "${binary}".sha1; then if sha1sum --status --quiet -c "${binary}".sha1; then
echo -n "transferred... " echo -n "transferred... "
install -T -m 0755 /tmp/${binary} /usr/bin/pihole-FTL install -T -m 0755 /tmp/${binary} /usr/bin/pihole-FTL
touch /var/log/pihole-FTL.log /var/run/pihole-FTL.pid /var/run/pihole-FTL.port touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port
chmod 0666 /var/log/pihole-FTL.log /var/run/pihole-FTL.pid /var/run/pihole-FTL.port chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port
cd "${orig_dir}" cd "${orig_dir}"
echo "done." echo "done."
return 0 return 0
@ -1236,7 +1236,7 @@ FTLdetect() {
binary="pihole-FTL-linux-x86_32" binary="pihole-FTL-linux-x86_32"
fi fi
FTLdownload "${binary}" || return 1 FTLinstall "${binary}" || return 1
} }

View File

@ -388,6 +388,20 @@ def test_FTL_binary_installed_and_responsive_no_errors(Pihole):
expected_stdout = 'v' expected_stdout = 'v'
assert expected_stdout in installed_binary.stdout assert expected_stdout in installed_binary.stdout
def test_FTL_support_files_installed(Pihole):
''' confirms FTL support files are installed '''
support_files = Pihole.run('''
source /opt/pihole/basic-install.sh
FTLdetect
stat -c '%a %n' /var/log/pihole-FTL.log
stat -c '%a %n' /run/pihole-FTL.port
stat -c '%a %n' /run/pihole-FTL.pid
ls -lac /run
''')
assert '644 pihole-FTL.port' in support_files.stdout
assert '644 pihole-FTL.pid' in support_files.stdout
assert '644 pihole-FTL.log' in support_files.stdout
# Helper functions # Helper functions
def mock_command(script, args, container): def mock_command(script, args, container):
''' Allows for setup of commands we don't really want to have to run for real in unit tests ''' ''' Allows for setup of commands we don't really want to have to run for real in unit tests '''