File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,11 +22,13 @@ deps_present() {
2222 bunx --no-install playwright install-deps --dry-run " ${browsers[@]} " > /dev/null 2>&1
2323}
2424
25- # Installs only from the cached files; anything apt would still fetch fails it instead.
25+ # dpkg, not apt: apt prefers a repository copy of a package whose version matches a cached file
26+ # and fetches it. The cache key pins the runner image, so the files are the exact set apt
27+ # installed there, and dpkg resolves their dependencies among themselves without the network.
2628install_from_cache () {
2729 [ -n " $cache " ] && compgen -G " $cache /*.deb" > /dev/null || return 1
2830 local output
29- if ! output=$( sudo apt-get install -y --no-install-recommends --no-download " $cache " /* .deb 2>&1 ) ; then
31+ if ! output=$( sudo DEBIAN_FRONTEND=noninteractive dpkg -i " $cache " /* .deb 2>&1 ) ; then
3032 printf ' %s\n' " $output " | tail -n 5 | sed ' s/^/Cache install failed: /'
3133 return 1
3234 fi
@@ -38,6 +40,8 @@ if ! deps_present; then
3840 if install_from_cache; then
3941 echo " Installed system dependencies from $cache "
4042 else
43+ # A failed dpkg run can leave packages half-configured; let apt finish or remove them first.
44+ sudo DEBIAN_FRONTEND=noninteractive apt-get -f install -y > /dev/null
4145 bunx --no-install playwright install-deps " ${browsers[@]} "
4246 if [ -n " $cache " ] && compgen -G ' /var/cache/apt/archives/*.deb' > /dev/null; then
4347 mkdir -p " $cache "
You can’t perform that action at this time.
0 commit comments