aboutsummaryrefslogtreecommitdiff
path: root/src/powershell/install.sh
diff options
context:
space:
mode:
authoreitsupi <50911393+eitsupi@users.noreply.github.com>2022-10-11 01:33:01 +0300
committerGitHub <noreply@github.com>2022-10-11 01:33:01 +0300
commita8cb375d460840bbf8c91599d16fc87d9ee8b996 (patch)
tree73dd647775325582c17a452816457f5cec82004d /src/powershell/install.sh
parent065b5ec9e19d4f289a070c3d5337696fd2394dc0 (diff)
Ensure remove apt-update cache at the beginning and end of the scripts (#210)
* remove apt lists * bump versions
Diffstat (limited to 'src/powershell/install.sh')
-rwxr-xr-xsrc/powershell/install.sh17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/powershell/install.sh b/src/powershell/install.sh
index 328ae93..ea3b6e8 100755
--- a/src/powershell/install.sh
+++ b/src/powershell/install.sh
@@ -9,6 +9,9 @@
set -e
+# Clean up
+rm -rf /var/lib/apt/lists/*
+
POWERSHELL_VERSION=${VERSION:-"latest"}
MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
@@ -74,8 +77,10 @@ get_common_setting() {
apt_get_update()
{
- echo "Running apt-get update..."
- apt-get update -y
+ if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
+ echo "Running apt-get update..."
+ apt-get update -y
+ fi
}
# Checks if packages are installed and installs them if not
@@ -118,8 +123,7 @@ install_using_github() {
# Fall back on direct download if no apt package exists in microsoft pool
check_packages curl ca-certificates gnupg2 dirmngr libc6 libgcc1 libgssapi-krb5-2 libstdc++6 libunwind8 libuuid1 zlib1g libicu[0-9][0-9]
if ! type git > /dev/null 2>&1; then
- apt_get_update
- apt-get install -y --no-install-recommends git
+ check_packages git
fi
if [ "${architecture}" = "amd64" ]; then
architecture="x64"
@@ -161,4 +165,7 @@ if [ "${use_github}" = "true" ]; then
install_using_github
fi
-echo "Done!" \ No newline at end of file
+# Clean up
+rm -rf /var/lib/apt/lists/*
+
+echo "Done!"