From d82ed25d839cb81eb53eacd6909319ae6f00842d Mon Sep 17 00:00:00 2001 From: "wiktor.kobiela" Date: Mon, 22 Jun 2020 13:14:04 +0200 Subject: [PATCH 1/2] Added script to automate package creation for update. It is possible to create automated cron job for Gitea update with this script. Updated readme. --- README.md | 18 ++++++++++++++++++ cron_gitea_update.sh | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 cron_gitea_update.sh diff --git a/README.md b/README.md index b62a953..8db2a9e 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,24 @@ Fork from [gogs-spk](https://github.com/alexandregz/gogs-spk) to create a SPK pa The Gitea package requires the **[Git Server](https://www.synology.com/en-global/dsm/packages/Git)** package. +### Automatic cron job for Synology NAS - 2020 update + +To create automatic cron job, clone `cron_gitea_update.sh` file and set it inside Task Schedule to run and update Gitea automatically when new stable release comes up. + +You can also run this script manually from SSH console of your NAS, if you want to update it when you are ready, not when new release comes up. + +To setup this script, only required changes should be made at lines 24 and 34: + +`24: DOWNLOAD_URL=https://github.com/go-gitea/gitea/releases/download/v${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-XXX.xz` + +`34: sudo synopkg install /tmp/gitea/gitea-spk/gitea-${GITEA_VERSION}-linux-XXX.spk` + +where instead of `XXX` you should insert your NAS CPU architecture, for example `arm64` or `arm-6` as shown below. + +If Gitea package won't start automatically, you can just turn it on in Package Manager. + +This script is using gitea-spk packgage from flipswitchingmonkey and was tested with Gitea 1.11 and 1.12 on May and June 2020. Works OK. Huge thanks for [salesgroup](https://github.com/salesgroup) for sharing. + ### Package creation To create the package, clone the repository: diff --git a/cron_gitea_update.sh b/cron_gitea_update.sh new file mode 100644 index 0000000..cb5e35f --- /dev/null +++ b/cron_gitea_update.sh @@ -0,0 +1,37 @@ +#!/bin/bash +GITEA_INSTALLED=`/volume1/@appstore/Gitea/gitea/gitea --version | cut -d \ -f 3` + +LATEST_URL=`curl -Ls -o /dev/null -w %{url_effective} https://github.com/go-gitea/gitea/releases/latest` +#https://github.com/go-gitea/gitea/releases/tag/v1.11.3 + +echo LATEST_URL = ${LATEST_URL} +GITEA_VERSION=${LATEST_URL##*/v} + +if [ "${GITEA_INSTALLED}" == "${GITEA_VERSION}" ]; then + echo "Same version" + exit 0 +fi + +#Install +echo "Installed:"${GITEA_INSTALLED} +echo "LATEST:"${GITEA_VERSION} +rm -rf /tmp/gitea +mkdir /tmp/gitea +cd /tmp/gitea +git clone https://github.com/flipswitchingmonkey/gitea-spk.git +cd gitea-spk + +DOWNLOAD_URL=https://github.com/go-gitea/gitea/releases/download/v${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-arm64.xz +echo ${DOWNLOAD_URL} + +wget ${DOWNLOAD_URL} +xz --decompress gitea-*.xz +./create_spk.sh + + +sudo synoservice --stop pkgctl-Gitea +sudo synoservice --status pkgctl-Gitea +sudo synopkg install /tmp/gitea/gitea-spk/gitea-${GITEA_VERSION}-linux-arm64.spk +sudo synoservice --start pkgctl-Gitea + +exit 1 From e1aa714f010a0c585923ea636f6af47cc102609f Mon Sep 17 00:00:00 2001 From: "wiktor.kobiela" Date: Mon, 22 Jun 2020 13:20:48 +0200 Subject: [PATCH 2/2] Readme correction --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8db2a9e..5f87ef5 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ Fork from [gogs-spk](https://github.com/alexandregz/gogs-spk) to create a SPK pa The Gitea package requires the **[Git Server](https://www.synology.com/en-global/dsm/packages/Git)** package. -### Automatic cron job for Synology NAS - 2020 update +### Automatic cron job for updating existing Gitea on Synology NAS - 2020 update -To create automatic cron job, clone `cron_gitea_update.sh` file and set it inside Task Schedule to run and update Gitea automatically when new stable release comes up. +To create automatic cron job for updating your Gitea, clone `cron_gitea_update.sh` file and set it inside Task Schedule to run and update Gitea automatically when new stable release comes up. You can also run this script manually from SSH console of your NAS, if you want to update it when you are ready, not when new release comes up.