mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 06:08:07 +00:00
Merge pull request #757 from al-cheb/al-cheb/clean_cache_packages
Clean up apt package cache
This commit is contained in:
16
images/linux/scripts/installers/cleanup.sh
Normal file
16
images/linux/scripts/installers/cleanup.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# before cleanup
|
||||
before=$(df / -Pm | awk 'NR==2{print $4}')
|
||||
|
||||
# clears out the local repository of retrieved package files
|
||||
# It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial
|
||||
apt-get clean
|
||||
|
||||
# after cleanup
|
||||
after=$(df / -Pm | awk 'NR==2{print $4}')
|
||||
|
||||
# display size
|
||||
echo "Before: $before MB"
|
||||
echo "After : $after MB"
|
||||
echo "Delta : $(($after-$before)) MB"
|
||||
@@ -289,6 +289,13 @@
|
||||
],
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"scripts":[
|
||||
"{{template_dir}}/scripts/installers/cleanup.sh"
|
||||
],
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"source": "{{user `metadata_file`}}",
|
||||
|
||||
@@ -293,6 +293,13 @@
|
||||
],
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"scripts":[
|
||||
"{{template_dir}}/scripts/installers/cleanup.sh"
|
||||
],
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"source": "{{user `metadata_file`}}",
|
||||
|
||||
Reference in New Issue
Block a user