From 1579ba96cd66fde160bdc9b3d204d8d427e43472 Mon Sep 17 00:00:00 2001 From: jogerj <30559735+jogerj@users.noreply.github.com> Date: Sat, 8 Oct 2022 01:30:32 +0700 Subject: [PATCH] Add check for certbot image architecture --- init-letsencrypt.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/init-letsencrypt.sh b/init-letsencrypt.sh index a3f3cb01..e25bd281 100755 --- a/init-letsencrypt.sh +++ b/init-letsencrypt.sh @@ -11,6 +11,21 @@ data_path="./data/certbot" email="" # Adding a valid address is strongly recommended staging=0 # Set to 1 if you're testing your setup to avoid hitting request limits +# check correct architecture +if [ -f docker-compose.yml ]; then + arch="$(uname -m)" + if [[ "$arch" == "x86_64" ]]; then + sed -i 's/image: certbot\/certbot.*$/image: certbot\/certbot:latest/g' docker-compose.yml + elif [[ $(echo -e "$arch" | grep -e "arm" -e "aarch") ]]; then + if [[ $(echo -e "$arch" | grep -e "armv8" -e "aarch64") ]]; then + sed -i 's/image: certbot\/certbot.*$/image: certbot\/certbot:arm64v8-latest/g' docker-compose.yml + else + sed -i 's/image: certbot\/certbot.*$/image: certbot\/certbot:arm32v6-latest/g' docker-compose.yml + fi + fi +fi + + if [ -d "$data_path" ]; then read -p "Existing data found for $domains. Continue and replace existing certificate? (y/N) " decision if [ "$decision" != "Y" ] && [ "$decision" != "y" ]; then