From 5ecb78e4e776fa31f3e3c95b2050f81b025b0aa1 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Fri, 17 Apr 2020 23:56:19 +0200 Subject: [PATCH] Wait for apt instead of failing... --- sub_scripts/launcher.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sub_scripts/launcher.sh b/sub_scripts/launcher.sh index a96a8f5..c5b3e3f 100755 --- a/sub_scripts/launcher.sh +++ b/sub_scripts/launcher.sh @@ -295,6 +295,18 @@ $(cat "$script_dir/sub_scripts/Build_lxc.log")" # Count the number of lines of the current yunohost log file. COPY_LOG 1 + # Wait for apt to be available before the test. + for try in `seq 1 17` + do + # Check if /var/lib/dpkg/lock is used by another process + if sudo lxc-attach -n $lxc_name -- lsof /var/lib/dpkg/lock > /dev/null + then + echo "apt is already in use..." + # Sleep an exponential time at each round + sleep $(( try * try )) + fi + done + # Copy the package into the container. rsync -rq --delete "$package_path" "$lxc_name": >> "$test_result" 2>&1