1
0
mirror of https://github.com/zokradonh/kopano-docker.git synced 2026-08-11 16:32:59 +00:00

BugFixes and optimizations

fix shellcheck warnings on download_community
remove gzip
chmod from dockerfile to script itself
better error handling if filename returns empty
apply fix to match download archives for both amd64 and all
This commit is contained in:
Felix Bartels
2018-10-12 18:06:50 +02:00
committed by zokradonh
parent b100bde1ef
commit 954de3757e
7 changed files with 72 additions and 33 deletions
+3 -5
View File
@@ -39,11 +39,9 @@ ARG ADDITIONAL_KOPANO_PACKAGES
COPY download_community.sh /kopano/download_community.sh
RUN \
# community download
# community download
[ ${DOWNLOAD_COMMUNITY_PACKAGES} -eq 1 ] && \
chmod a+x /kopano/download_community.sh && \
/kopano/download_community.sh core && \
gzip -f9 Packages; \
# install
set -x && \
echo ${KOPANO_CORE_VERSION} > /kopano/buildversion && \
@@ -61,7 +59,7 @@ RUN \
ENV KOPANO_LOCALE="de_DE.UTF-8"
ENV KOPANO_USERSCRIPT_LOCALE="de_DE.UTF-8"
ENV LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV SERVICE_TO_START=server
@@ -70,4 +68,4 @@ RUN chmod a+x /kopano/start-service.sh
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD [ "/kopano/start-service.sh" ]
CMD [ "/kopano/start-service.sh" ]
Regular → Executable
+14 -8
View File
@@ -1,23 +1,29 @@
#!/bin/bash
# take component as first argument and fallback to core if none given
component=${1:-core}
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
# query community server by h5ai API
filename=$(curl -s -S -L -d "action=get&items%5Bhref%5D=%2Fcommunity%2F$1%3A%2F&items%5Bwhat%5D=1" -H \
filename=$(curl -s -S -L -d "action=get&items%5Bhref%5D=%2Fcommunity%2F$component%3A%2F&items%5Bwhat%5D=1" -H \
"Accept: application/json" https://download.kopano.io/community/ | jq '.items[].href' | \
grep Debian_9.0-a | sed 's#"##g' | sed "s#/community/$1:/##")
grep 'Debian_9.0-all\|Debian_9.0-amd64' | sed 's#"##g' | sed "s#/community/$component:/##")
filename=$(urldecode $filename)
if [ -z "${filename// }" ]; then
echo "unknown component"
exit 1
fi
filename=$(urldecode "$filename")
# download & extract packages
curl -s -S -L -o $filename https://download.kopano.io/community/$1:/${filename}
curl -s -S -L -o "$filename" https://download.kopano.io/community/"$component":/"${filename}"
tar xf $filename
tar xf "$filename"
# save disk space
rm $filename
rm "$filename"
# prepare directory to be apt source
apt-ftparchive packages ${filename%.tar.gz} >> Packages
apt-ftparchive packages "${filename%.tar.gz}" | gzip -9c > Packages.gz