Files
salt-states/gitea/files/install.sh
2023-11-27 19:44:34 -05:00

18 lines
571 B
Bash

#!/bin/bash
{% 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