mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
Merge pull request #1883 from dsame/v-sedoli/fix-apt
Workaround for apt db locked by WALinuxAgent
This commit is contained in:
7
images/linux/scripts/base/apt-mock-remove.sh
Normal file
7
images/linux/scripts/base/apt-mock-remove.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
prefix=/usr/local/bin
|
||||||
|
|
||||||
|
for tool in apt apt-get apt-fast;do
|
||||||
|
sudo rm -f $prefix/$tool
|
||||||
|
done
|
||||||
27
images/linux/scripts/base/apt-mock.sh
Normal file
27
images/linux/scripts/base/apt-mock.sh
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
# A temporary workaround for https://github.com/Azure/azure-linux-extensions/issues/1238
|
||||||
|
|
||||||
|
prefix=/usr/local/bin
|
||||||
|
|
||||||
|
for tool in apt apt-get apt-fast;do
|
||||||
|
real_tool=`which $tool`
|
||||||
|
cat >$prefix/$tool <<EOT
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
i=1
|
||||||
|
while [ \$i -le 30 ];do
|
||||||
|
fuser /var/lib/dpkg/lock >/dev/null 2>&1
|
||||||
|
result=\$?
|
||||||
|
if [ \$result -eq 0 ];then
|
||||||
|
sleep 1
|
||||||
|
echo "/var/lib/dpkg/locked... retry \$i"
|
||||||
|
i=\$((i + 1))
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
$real_tool "\$@"
|
||||||
|
EOT
|
||||||
|
chmod +x $prefix/$tool
|
||||||
|
done
|
||||||
@@ -74,6 +74,11 @@
|
|||||||
"script": "{{template_dir}}/scripts/base/apt.sh",
|
"script": "{{template_dir}}/scripts/base/apt.sh",
|
||||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "{{template_dir}}/scripts/base/apt-mock.sh",
|
||||||
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"script": "{{template_dir}}/scripts/base/limits.sh",
|
"script": "{{template_dir}}/scripts/base/limits.sh",
|
||||||
@@ -282,6 +287,11 @@
|
|||||||
],
|
],
|
||||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "{{template_dir}}/scripts/base/apt-mock-remove.sh",
|
||||||
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
|
|||||||
@@ -77,6 +77,11 @@
|
|||||||
"script": "{{template_dir}}/scripts/base/apt.sh",
|
"script": "{{template_dir}}/scripts/base/apt.sh",
|
||||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "{{template_dir}}/scripts/base/apt-mock.sh",
|
||||||
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"script": "{{template_dir}}/scripts/base/limits.sh",
|
"script": "{{template_dir}}/scripts/base/limits.sh",
|
||||||
@@ -286,6 +291,11 @@
|
|||||||
],
|
],
|
||||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "{{template_dir}}/scripts/base/apt-mock-remove.sh",
|
||||||
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
|
|||||||
@@ -79,6 +79,11 @@
|
|||||||
"script": "{{template_dir}}/scripts/base/apt.sh",
|
"script": "{{template_dir}}/scripts/base/apt.sh",
|
||||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "{{template_dir}}/scripts/base/apt-mock.sh",
|
||||||
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"script": "{{template_dir}}/scripts/base/limits.sh",
|
"script": "{{template_dir}}/scripts/base/limits.sh",
|
||||||
@@ -288,6 +293,11 @@
|
|||||||
],
|
],
|
||||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "{{template_dir}}/scripts/base/apt-mock-remove.sh",
|
||||||
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
|
|||||||
Reference in New Issue
Block a user