diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 diff --git a/core/Dockerfile b/core/Dockerfile index 0c83ca5..b7e0816 100644 --- a/core/Dockerfile +++ b/core/Dockerfile @@ -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" ] \ No newline at end of file +CMD [ "/kopano/start-service.sh" ] diff --git a/core/download_community.sh b/core/download_community.sh old mode 100644 new mode 100755 index 8cc26d9..3da5280 --- a/core/download_community.sh +++ b/core/download_community.sh @@ -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 diff --git a/download_community.sh b/download_community.sh new file mode 100755 index 0000000..3da5280 --- /dev/null +++ b/download_community.sh @@ -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 diff --git a/master-push.sh b/master-push.sh old mode 100644 new mode 100755 diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 75dda88..1b9a418 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -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" ] \ No newline at end of file +CMD [ "/kopano/start.sh" ] diff --git a/webapp/download_community.sh b/webapp/download_community.sh old mode 100644 new mode 100755 index 8cc26d9..3da5280 --- a/webapp/download_community.sh +++ b/webapp/download_community.sh @@ -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