1
0
mirror of https://github.com/zokradonh/kopano-docker synced 2025-06-07 07:56:12 +00:00
kopano-docker/base/create-kopano-repo.sh
Felix Bartels 0561a979bc
update to Debian Buster (#253)
* update to Debian Buster
* update webapp container
* update kdav image to buster
  * add some debug commands
* use onbuild to specify building of core repository only in one place
* remove ca-certificates and git from kdav image
  * git should not be needed since kdav has a builder stage
  * ca-certificates is already installed in an earlier stage
* upgrade to Debian 10 for Z-Push
* switch remaining Debian 9 repos in webapp
* use a new major version for the base image
  * since its now based on buster
* add new parameters to the onbuild step
* update repos in setup.sh
* switch default distribution in create repo script
2020-02-25 13:31:54 +01:00

60 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
set -eu
[ "$DEBUG" ] && set -x
function urldecode { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
function version_from_filename {
basename "$1" | awk -F"-" '{print $2}'
}
function h5ai_query {
component=${1:-core}
distribution=${2:-Debian_10}
channel=${3:-community} # could either be community, supported or limited
branch=${4:-""} # could either be empty, "master/tarballs/", "pre-final/tarballs/" or "final/tarballs/"
filename=$(curl -s -XPOST "https://download.kopano.io/$channel/?action=get&items\[href\]=/$channel/$component:/$branch&items\[what\]=1" | \
jq -r '.items[].href' | \
grep "$distribution-all\|$distribution-amd64" | sed "s#/$channel/$component:/##" | sed "s#/$channel/$component%3A/##")
if [ -z "${filename// }" ]; then
echo "unknown component"
exit 1
fi
filename=$(urldecode "$filename")
echo "$filename"
}
function dl_and_package_community {
# take component as first argument and fallback to core if none given
component=${1:-core}
distribution=${2:-Debian_10}
channel=${3:-community}
branch=${4:-""}
# query community server by h5ai API
filename=$(h5ai_query "$component" "$distribution" "$channel" "$branch")
filename2=$(basename "$filename")
# download & extract packages
curl -s -S -L -o "$filename2" https://download.kopano.io/"$channel"/"$component":/"${filename}"
tar xf "$filename2"
# save buildversion
#currentVersion=$(version_from_filename "$filename")
#echo "$component-$currentVersion" >> /kopano/buildversion
# save disk space
rm "$filename2"
mv "${filename2%.tar.gz}" "$component"
# prepare directory to be apt source
cd "$component"
apt-ftparchive packages . | gzip -9c > Packages.gz
cd ".."
}