mirror of
https://github.com/zokradonh/kopano-docker
synced 2025-06-07 16:06:14 +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:
parent
b100bde1ef
commit
954de3757e
@ -41,9 +41,7 @@ COPY download_community.sh /kopano/download_community.sh
|
||||
RUN \
|
||||
# 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 && \
|
||||
|
22
core/download_community.sh
Normal file → Executable file
22
core/download_community.sh
Normal file → Executable 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
29
download_community.sh
Executable 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
0
master-push.sh
Normal file → Executable 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
|
||||
@ -45,10 +47,8 @@ COPY download_community.sh /kopano/download_community.sh
|
||||
RUN \
|
||||
# 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 && \
|
||||
|
22
webapp/download_community.sh
Normal file → Executable file
22
webapp/download_community.sh
Normal file → Executable 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user