1
0
mirror of https://github.com/zokradonh/kopano-docker synced 2025-06-07 07:56:12 +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

0
build.sh Normal file → Executable file
View File

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" ]

22
core/download_community.sh Normal file → Executable file
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

29
download_community.sh Executable file
View File

@ -0,0 +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$component%3A%2F&items%5Bwhat%5D=1" -H \
"Accept: application/json" https://download.kopano.io/community/ | jq '.items[].href' | \
grep 'Debian_9.0-all\|Debian_9.0-amd64' | sed 's#"##g' | sed "s#/community/$component:/##")
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/"$component":/"${filename}"
tar xf "$filename"
# save disk space
rm "$filename"
# prepare directory to be apt source
apt-ftparchive packages "${filename%.tar.gz}" | gzip -9c > Packages.gz

0
master-push.sh Normal file → Executable file
View File

View File

@ -12,15 +12,17 @@ ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install --no-install-recommends -y \
curl \
gpg \
ca-certificates \
moreutils \
locales \
apt-transport-https \
apt-utils jq \
apt-utils \
ca-certificates \
curl \
dumb-init \
python3 && \
gpg \
jq \
locales \
moreutils \
python3 \
&& \
rm -rf /var/cache/apt /var/lib/apt/lists
# If you have active Kopano subscription you can change KOPANO_WEBAPP_REPOSITORY_URL to
@ -43,12 +45,10 @@ COPY download_community.sh /kopano/download_community.sh
# install kopano web app and refresh ca-certificates
RUN \
# community download
# community download
[ ${DOWNLOAD_COMMUNITY_PACKAGES} -eq 1 ] && \
chmod a+x /kopano/download_community.sh && \
/kopano/download_community.sh core && \
/kopano/download_community.sh webapp && \
gzip -f9 Packages; \
# install
set -x && \
echo ${KOPANO_CORE_VERSION} > /kopano/buildversion && \
@ -133,7 +133,7 @@ COPY start.sh /kopano/start.sh
RUN chmod a+x /kopano/start.sh
ENV LANG en_US.UTF-8
ENV LANG en_US.UTF-8
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD [ "/kopano/start.sh" ]
CMD [ "/kopano/start.sh" ]

22
webapp/download_community.sh Normal file → Executable file
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