From 4cd598ae103c66d89b62fd2addbefe635a5ec4bf Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 20 Feb 2017 17:28:38 -0800 Subject: [PATCH] Check support files installed and permissions. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 6 +++--- test/test_automated_install.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 11ffbec2..715d6e95 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1175,8 +1175,8 @@ FTLinstall() { if sha1sum --status --quiet -c "${binary}".sha1; then echo -n "transferred... " 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 - chmod 0666 /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 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port cd "${orig_dir}" echo "done." return 0 @@ -1236,7 +1236,7 @@ FTLdetect() { binary="pihole-FTL-linux-x86_32" fi - FTLdownload "${binary}" || return 1 + FTLinstall "${binary}" || return 1 } diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 250accf7..1fb1a20a 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -388,6 +388,20 @@ def test_FTL_binary_installed_and_responsive_no_errors(Pihole): expected_stdout = 'v' 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 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 '''