Merge pull request #1883 from dsame/v-sedoli/fix-apt

Workaround for apt db locked by WALinuxAgent
This commit is contained in:
Maxim Lobanov
2020-11-02 20:13:46 +03:00
committed by GitHub
7 changed files with 66 additions and 2 deletions

View 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

View 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

View File

@@ -74,6 +74,11 @@
"script": "{{template_dir}}/scripts/base/apt.sh",
"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",
"script": "{{template_dir}}/scripts/base/limits.sh",
@@ -282,6 +287,11 @@
],
"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",
"scripts": [

View File

@@ -77,6 +77,11 @@
"script": "{{template_dir}}/scripts/base/apt.sh",
"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",
"script": "{{template_dir}}/scripts/base/limits.sh",
@@ -286,6 +291,11 @@
],
"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",
"scripts": [

View File

@@ -79,6 +79,11 @@
"script": "{{template_dir}}/scripts/base/apt.sh",
"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",
"script": "{{template_dir}}/scripts/base/limits.sh",
@@ -288,6 +293,11 @@
],
"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",
"scripts": [