Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added script for automatic update existing Gitea using gitea-spk package, updated readme #31

Open
wants to merge 3 commits into
base: gitea
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 updating existing Gitea on Synology NAS - 2020 update

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.

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:
Expand Down
37 changes: 37 additions & 0 deletions cron_gitea_update.sh
Original file line number Diff line number Diff line change
@@ -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