加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
update.sh 1.55 KB
一键复制 编辑 原始数据 按行查看 历史
Renata Slupetska 提交于 2024-10-23 11:47 . Update update.sh
#!/bin/bash
set -euo pipefail
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
if [ -n "${1-}" ]; then
latestRelease=$(curl -s "https://s.espocrm.com/release/info/?version=$1")
else
latestRelease=$(curl -s "https://s.espocrm.com/release/latest")
fi
version=$(echo $latestRelease | jq -r '.version')
downloadUrl=$(echo $latestRelease | jq -r '.package')
sha256=$(echo $latestRelease | jq -r '.packageSha256')
declare variantList=(
'apache'
'fpm'
'fpm-alpine'
)
declare -A distributions=(
[apache]='debian'
[fpm]='debian'
[fpm-alpine]='alpine'
)
declare -A cmds=(
[apache]='apache2-foreground'
[fpm]='php-fpm'
[fpm-alpine]='php-fpm'
)
declare -A additions=(
[apache]='\
RUN a2enmod rewrite;\
'
[fpm]=''
[fpm-alpine]=''
)
travisEnv=
for variant in "${variantList[@]}"
do
dist="${distributions[$variant]}"
cmd="${cmds[$variant]}"
addition="${additions[$variant]}"
mkdir -p "$variant"
cp docker-*.sh "$variant"/
sed -i '/# entrypoint-utils.sh/r entrypoint-utils.sh' $variant/docker-*.sh
sed -r \
-e 's#%%VARIANT%%#'"$variant"'#' \
-e 's#%%ESPOCRM_VERSION%%#'"$version"'#' \
-e 's#%%ESPOCRM_DOWNLOAD_URL%%#'"$downloadUrl"'#' \
-e 's#%%ESPOCRM_SHA256%%#'"$sha256"'#' \
-e 's#%%ADDITIONS%%#'"$addition"'#' \
-e 's#%%CMD%%#'"$cmd"'#' \
"./Dockerfile-$dist.template" > "$variant/Dockerfile"
travisEnv+='\n - VARIANT='"$variant"
done
travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)"
echo "$travis" > .travis.yml
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化