nextcloud-fpm/patch-nextcloud.sh
Aaron Riedel 1dfeb16d03
Some checks reported errors
continuous-integration/drone/push Build encountered an error
change CI to fully build the image
2024-07-22 15:15:30 +02:00

24 lines
No EOL
1.3 KiB
Bash

#!/usr/bin/env sh
set -e
set -x
echo "starting patch script"
echo "clone nextcloud/docker"
git clone https://git.ar21.de/aaron/nextcloud-docker.git
echo "get latest major version"
major_version=$(find nextcloud-docker -maxdepth 1 -type d -printf "%f\n" | grep -E '^[0-9]+$' | sort -n | tail -1)
if [ -z "nextcloud-docker/$major_version" ]; then
echo "Could not determine version."
exit 1
else
echo "Nextcloud $major_version found"
fi
echo "patch the Dockerfile"
cd "nextcloud-docker/$major_version/fpm/"
sed -i "$(awk '/^ENTRYPOINT /{line=NR} END{print line}' Dockerfile)s+^+# begin of patch\nRUN apt-get update && apt-get install -y libmagickcore-6.q16-6-extra tesseract-ocr tesseract-ocr-deu tesseract-ocr-eng ocrmypdf libbz2-dev && docker-php-ext-install bz2 && apt-get clean autoclean && apt-get autoremove -y\nADD https://raw.githubusercontent.com/tesseract-ocr/tessdata/main/deu.traineddata /usr/share/tesseract-ocr/tessdata/\nADD https://raw.githubusercontent.com/tesseract-ocr/tessdata/main/eng.traineddata /usr/share/tesseract-ocr/tessdata/\n# end of patch\n+" Dockerfile
echo "determine tags"
full_version=$(grep -oP '(?<=^ENV NEXTCLOUD_VERSION ).*' Dockerfile)
echo "found $full_version"
cd ~
echo $full_version > .tags
echo "move Dockerfile to workdir"
cp nextcloud-docker/$major_version/fpm/Dockerfile .