From 0cafeee86296b9f19e6425055e0c4037eff41985 Mon Sep 17 00:00:00 2001
From: Josh Spicer <joshspicer@github.com>
Date: Tue, 23 Aug 2022 09:17:08 -0400
Subject: favor correctness by removing `apt update ...` short-circuiting (#98)

* favor correctness by removing apt update shortciruiting

* Update install.sh

* apt_get_upadate in node

* update test
---
 src/git-lfs/install.sh | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

(limited to 'src/git-lfs')

diff --git a/src/git-lfs/install.sh b/src/git-lfs/install.sh
index 03e22e5..d88a379 100755
--- a/src/git-lfs/install.sh
+++ b/src/git-lfs/install.sh
@@ -105,21 +105,16 @@ receive_gpg_keys() {
     fi
 }
 
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
 {
-    if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
-        echo "Running apt-get update..."
-        apt-get update
-    else
-        echo "Skipping apt-get update."
-    fi
+    echo "Running apt-get update..."
+    apt-get update -y
 }
 
 # Checks if packages are installed and installs them if not
 check_packages() {
     if ! dpkg -s "$@" > /dev/null 2>&1; then
-        apt_get_update_if_needed
+        apt_get_update
         apt-get -y install --no-install-recommends "$@"
     fi
 }
@@ -183,7 +178,7 @@ export DEBIAN_FRONTEND=noninteractive
 . /etc/os-release
 check_packages curl ca-certificates gnupg2 dirmngr apt-transport-https
 if ! type git > /dev/null 2>&1; then
-    apt_get_update_if_needed
+    apt_get_update
     apt-get -y install --no-install-recommends git
 fi
 if [ "${ID}" = "debian" ]; then
-- 
cgit v1.2.3