19 lines
600 B
Bash
19 lines
600 B
Bash
#!/bin/bash
|
|
{# code: lang=jinja-shell #}
|
|
{% set gitea_version = salt.pillar.get('gitea:version') %}
|
|
{% set base_path = salt.pillar.get('gitea:path') %}
|
|
|
|
URL="https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-linux-amd64"
|
|
|
|
# We can't replace the gitea bin while it's running
|
|
systemctl stop gitea || true
|
|
|
|
wget --quiet "${URL}" -O "{{ base_path }}/bin/gitea.tmp"
|
|
if [ $? -eq 0 ]; then
|
|
chmod +x "{{ base_path }}/bin/gitea.tmp"
|
|
mv -v "{{ base_path }}/bin/gitea.tmp" "{{ base_path }}/bin/gitea"
|
|
else
|
|
rm -f "{{ base_path }}/bin/gitea.tmp"
|
|
exit 1
|
|
fi
|