Skip to content

Commit 608eb63

Browse files
committed
Fix apt for old Debian versions
1 parent e002082 commit 608eb63

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

.github/workflows/create-images.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ jobs:
9191
-
9292
name: Start container
9393
run: docker start imagine-${{ matrix.php-version }}
94+
-
95+
name: Temp
96+
run: docker exec -t imagine-${{ matrix.php-version }} ls -al /usr/local/bin/
97+
-
98+
name: Fix apt
99+
run: docker exec -t imagine-${{ matrix.php-version }} imagine-fix-apt
94100
-
95101
name: Update apt cache
96102
run: docker exec -t imagine-${{ matrix.php-version }} apt-get update -q

docker/Dockerfile.base

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr
1111

1212
COPY imagine-utilities /usr/local/bin/
1313

14-
COPY imagine-install /usr/local/bin/
14+
COPY --chmod=0777 imagine-install /usr/local/bin/
15+
16+
COPY --chmod=0777 imagine-fix-apt /usr/local/bin/

docker/imagine-fix-apt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
if grep -q 'VERSION="8 (jessie)"' /etc/os-release; then
4+
distro=jessie
5+
elif grep -q 'VERSION="9 (stretch)"' /etc/os-release; then
6+
distro=stretch
7+
else
8+
exit 0
9+
fi
10+
11+
deb_archive=http://archive.kernel.org/debian-archive
12+
deb_archive_security=http://archive.kernel.org/debian-archive/debian-security
13+
sed -ri "s;^(\s*deb\s+http://(httpredir|deb).debian.org/debian\s+$distro-updates\b.*);#\1;" /etc/apt/sources.list
14+
sed -ri "s;^(\s*deb\s+)http://(httpredir|deb).debian.org;\1$deb_archive;" /etc/apt/sources.list
15+
sed -ri "s;^(\s*deb\s+)http://security.debian.org/debian-security;\1$deb_archive_security;" /etc/apt/sources.list
16+
sed -ri "s;^(\s*deb\s+)http://security.debian.org;\1$deb_archive_security;" /etc/apt/sources.list
17+
18+
tmp="$(mktemp)"
19+
DEBIAN_FRONTEND=noninteractive apt-get update -q 2>"$tmp"
20+
if grep -qE ' KEYEXPIRED [0-9]' "$tmp"; then
21+
printf 'APT::Get::AllowUnauthenticated "true";\n' >/etc/apt/apt.conf.d/99unauthenticated
22+
fi
23+
rm "$tmp"

0 commit comments

Comments
 (0)