Skip to content

Commit 7e4bea1

Browse files
committed
Clean up
1 parent e0d0d4b commit 7e4bea1

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

src/ci/scripts/free-disk-space.sh

+23-12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
# MACROS
66
# ======
77

8+
list_installed_dpkg() {
9+
dpkg --get-selections $@ | grep -v deinstall | awk '{print $1}'
10+
}
11+
812
# macro to print a line of equals
913
# # (silly but works)
1014
printSeparationLine() {
@@ -150,18 +154,25 @@ printSavedSpace $SAVED "Haskell runtime"
150154

151155
BEFORE=$(getAvailableSpace)
152156

153-
sudo apt-get remove -y '^aspnetcore-.*' || echo "::warning::The command [sudo apt-get remove -y '^aspnetcore-.*'] failed to complete successfully. Proceeding..."
154-
sudo apt-get remove -y '^dotnet-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^dotnet-.*' --fix-missing] failed to complete successfully. Proceeding..."
155-
sudo apt-get remove -y '^llvm-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^llvm-.*' --fix-missing] failed to complete successfully. Proceeding..."
156-
sudo apt-get remove -y 'php.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y 'php.*' --fix-missing] failed to complete successfully. Proceeding..."
157-
sudo apt-get remove -y '^mongodb-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mongodb-.*' --fix-missing] failed to complete successfully. Proceeding..."
158-
sudo apt-get remove -y '^mysql-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mysql-.*' --fix-missing] failed to complete successfully. Proceeding..."
159-
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing || echo "::warning::The command [sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing] failed to complete successfully. Proceeding..."
160-
sudo apt-get remove -y google-cloud-sdk --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-sdk --fix-missing] failed to complete successfully. Proceeding..."
161-
sudo apt-get remove -y google-cloud-cli --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-cli --fix-missing] failed to complete successfully. Proceeding..."
162-
sudo apt-get remove -y microsoft-edge-stable --fix-missing || echo "::debug::The command [sudo apt-get remove -y microsoft-edge-stable --fix-missing] failed to complete successfully. Proceeding..."
163-
sudo apt-get remove -y snapd --fix-missing || echo "::debug::The command [sudo apt-get remove -y snapd --fix-missing] failed to complete successfully. Proceeding..."
164-
sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding..."
157+
pkgs=$(list_installed_dpkg \
158+
'aspnetcore-*' \
159+
'dotnet-*' \
160+
'llvm-*' \
161+
'*php*' \
162+
'mongodb-*' \
163+
'mysql-*' \
164+
'azure-cli' \
165+
'google-chrome-stable' \
166+
'firefox' \
167+
'powershell' \
168+
'mono-devel' \
169+
'libgl1-mesa-dri' \
170+
'google-cloud-*' \
171+
'gcloud-*' \
172+
'microsoft-edge-*' \
173+
'snapd' \
174+
|| true)
175+
sudo apt-get remove --autoremove -y $pkgs || echo "::warning::The command [sudo apt-get remove -y] failed to complete successfully. Proceeding..."
165176
sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed to complete successfully. Proceeding..."
166177

167178
AFTER=$(getAvailableSpace)

0 commit comments

Comments
 (0)