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