mirror of
https://github.com/bashclub/zamba-lxc-toolbox.git
synced 2024-11-07 19:31:58 +01:00
gitea: add updater called by apt-hook
This commit is contained in:
parent
522a02352d
commit
498702b394
@ -17,7 +17,7 @@ echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main"
|
||||
|
||||
apt update
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq postgresql nginx git ssl-cert unzip zip
|
||||
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install --no-install-recommends -y -qq postgresql nginx git ssl-cert unzip zip
|
||||
|
||||
systemctl enable --now postgresql
|
||||
|
||||
@ -36,6 +36,32 @@ mkdir -p /${LXC_SHAREFS_MOUNTPOINT}/
|
||||
chown -R git:git /${LXC_SHAREFS_MOUNTPOINT}/
|
||||
chmod -R 750 /${LXC_SHAREFS_MOUNTPOINT}/
|
||||
|
||||
cat << EOF > /usr/local/bin/update-gitea
|
||||
PATH="/bin:/usr/bin:/usr/local/bin"
|
||||
echo "Checking github for new gitea version"
|
||||
current_version=\$(curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest | grep "tag_name" | cut -d '"' -f4)
|
||||
installed_version=\$(echo v\$(gitea --version | cut -d ' ' -f3))
|
||||
echo "Installed gitea version is \$installed_version"
|
||||
if [ \$installed_version != \$current_version ]; then
|
||||
echo "New gitea version \$current_version available. Stopping gitea.service"
|
||||
systemctl stop gitea.service
|
||||
echo "Downloading gitea version \$current_version..."
|
||||
curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep '\linux-amd64$' | wget -q -O /usr/local/bin/gitea -i -
|
||||
chmod +x /usr/local/bin/gitea
|
||||
echo "Starting gitea.service..."
|
||||
systemctl start gitea.service
|
||||
echo "gitea update finished!"
|
||||
else
|
||||
echo "gitea version is up-to-date!"
|
||||
fi
|
||||
EOF
|
||||
chmod +x /usr/local/bin/update-gitea
|
||||
|
||||
cat << EOF > /etc/apt/apt.conf.d/80-gitea-apt-hook
|
||||
DPkg::Post-Invoke {"/usr/local/bin/update-gitea";};
|
||||
EOF
|
||||
chmod +x /etc/apt/apt.conf.d/80-gitea-apt-hook
|
||||
|
||||
cat << EOF > /etc/systemd/system/gitea.service
|
||||
[Unit]
|
||||
Description=Gitea
|
||||
|
Loading…
Reference in New Issue
Block a user