From 4eedf8a746c86432bc8bf8be4af42e851843cc71 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Tue, 27 Dec 2016 10:59:24 -0800 Subject: [PATCH 1/2] Always update package cache where we can. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 3bda5b58..ea0d59bf 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -79,7 +79,6 @@ if [[ $(command -v apt-get) ]]; then #Debian Family ############################################# PKG_MANAGER="apt-get" - PKG_CACHE="/var/lib/apt/lists/" UPDATE_PKG_CACHE="${PKG_MANAGER} update" PKG_INSTALL="${PKG_MANAGER} --yes --no-install-recommends install" # grep -c will return 1 retVal on 0 matches, block this throwing the set -e with an OR TRUE @@ -108,8 +107,8 @@ elif [ $(command -v rpm) ]; then else PKG_MANAGER="yum" fi - PKG_CACHE="/var/cache/${PKG_MANAGER}" - UPDATE_PKG_CACHE="${PKG_MANAGER} check-update" + # Fedora and family update cache on every PKG_INSTALL call, no need for a separate update. + UPDATE_PKG_CACHE=":" PKG_INSTALL="${PKG_MANAGER} install -y" PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l" INSTALLER_DEPS=(git iproute net-tools newt procps-ng) @@ -718,19 +717,13 @@ update_pacakge_cache() { #Running apt-get update/upgrade with minimal output can cause some issues with #requiring user input (e.g password for phpmyadmin see #218) - #Check to see if apt-get update has already been run today - #it needs to have been run at least once on new installs! - timestamp=$(stat -c %Y ${PKG_CACHE}) - timestampAsDate=$(date -d @"${timestamp}" "+%b %e") - today=$(date "+%b %e") + #Update package cache on apt based OSes. Do this every time since + #it's quick and packages can be updated at any time. - if [ ! "${today}" == "${timestampAsDate}" ]; then - #update package lists echo ":::" - echo -n "::: ${PKG_MANAGER} update has not been run today. Running now..." + echo -n "::: Updating local cache of available packages..." ${UPDATE_PKG_CACHE} &> /dev/null echo " done!" - fi } notify_package_updates_available() { From a328326e3920e387d1609306dbffc3004a514e44 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Tue, 27 Dec 2016 11:41:07 -0800 Subject: [PATCH 2/2] Formatting Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index ea0d59bf..1638829d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -720,10 +720,10 @@ update_pacakge_cache() { #Update package cache on apt based OSes. Do this every time since #it's quick and packages can be updated at any time. - echo ":::" - echo -n "::: Updating local cache of available packages..." - ${UPDATE_PKG_CACHE} &> /dev/null - echo " done!" + echo ":::" + echo -n "::: Updating local cache of available packages..." + ${UPDATE_PKG_CACHE} &> /dev/null + echo " done!" } notify_package_updates_available() {