From e176011912161bae7746c6af6cc1e688ce2d1507 Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Thu, 11 Aug 2016 10:01:29 +0200 Subject: Allow repository update to be disabled --- default.prf | 3 +++ include/consts | 1 + include/profiles | 9 +++++++++ include/tests_ports_packages | 10 +++++++--- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/default.prf b/default.prf index 0695ec47..9e797561 100644 --- a/default.prf +++ b/default.prf @@ -51,6 +51,9 @@ pause-between-tests=0 # Enable quick mode (no waiting for keypresses, same as --quick option) quick=no +# Refresh software repositories to help detecting vulnerable packages +refresh-repositories=yes + # Show inline tips about the tool show-tool-tips=yes diff --git a/include/consts b/include/consts index 8dda8540..ef8ebd98 100644 --- a/include/consts +++ b/include/consts @@ -165,6 +165,7 @@ unset LANG PROFILEVALUE="" PSBINARY="ps" REDIS_RUNNING=0 + REFRESH_REPOSITORIES=1 REMOTE_LOGGING_ENABLED=0 RESOLV_DOMAINNAME="" RKHUNTERBINARY="" diff --git a/include/profiles b/include/profiles index b191ff2d..81c56a50 100644 --- a/include/profiles +++ b/include/profiles @@ -207,6 +207,15 @@ AddSetting "quick" "${SETTING_QUICK_MODE}" "Quick mode (non-interactive)" ;; + # Refresh software repositories + refresh-repositories) + SETTING_REFRESH_REPOSITORIES=1 # default is yes + FIND=$(echo "${VALUE}" | egrep "^(0|false|no)$") && REFRESH_REPOSITORIES=0 + if [ ! -z "${FIND}" ]; then SETTING_REFRESH_REPOSITORIES=0; fi + Debug "Refreshing repositories set to ${SETTING_REFRESH_REPOSITORIES}" + AddSetting "refresh-repositories" "${SETTING_REFRESH_REPOSITORIES}" "Refresh repositories (for vulnerable package detection)" + ;; + # Inline tips about tool (default enabled) show_tool_tips | show-tool-tips) SETTING_SHOW_TOOL_TIPS=1 # default is yes diff --git a/include/tests_ports_packages b/include/tests_ports_packages index e4234367..fa986c21 100644 --- a/include/tests_ports_packages +++ b/include/tests_ports_packages @@ -989,9 +989,13 @@ # Multiple ways to do this. Some require extra packages to be installed, # others require potential firewall ports to be open, outbound. This is the # "most friendly" way. - LogText "Action: updating portage with emerge-webrsync" - /usr/bin/emerge-webrsync --quiet 2> /dev/null - LogText "Result: emerge-webrsync finished" + if [ ${REFRESH_REPOSITORIES} -eq 1 ]; then + LogText "Action: updating portage with emerge-webrsync" + /usr/bin/emerge-webrsync --quiet 2> /dev/null + LogText "Result: emerge-webrsync finished" + else + LogText "Result: using a possibly outdated repository, as updating is disabled" + fi LogText "Test: checking if /usr/bin/glsa-check exists" if [ -x /usr/bin/glsa-check ]; then PACKAGE_AUDIT_TOOL_FOUND=1 -- cgit v1.2.3