Skip to content

Commit

Permalink
Update Gitea to v1.21.4 (SynoCommunity#5929)
Browse files Browse the repository at this point in the history
* Try to use redesigned shared folder structure
* Updates after code review
* Update upgrade uifile
* Improve appearance on upgrade
* Bump to 1.20.6
* Add polish translations
* Update Gitea to v1.21.4
* Bump other makefiles
* Apply suggestions from code review
Co-authored-by: Michael Reid <[email protected]>

---------

Co-authored-by: Michael Reid <[email protected]>
  • Loading branch information
wkobiela and mreid-tt authored Jan 22, 2024
1 parent 971e443 commit 8873f21
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 82 deletions.
2 changes: 1 addition & 1 deletion cross/gitea/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_NAME = gitea
PKG_VERS = 1.17.3
PKG_VERS = 1.21.4
PKG_EXT = tar.gz
PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/go-gitea/gitea/archive
Expand Down
6 changes: 3 additions & 3 deletions cross/gitea/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
gitea-1.17.3.tar.gz SHA1 1ddc9f464214a9ae6c08ece66a66da6d5129ab5c
gitea-1.17.3.tar.gz SHA256 37c5357802395d7c0684b5a09cd2c2cbf426be20a7fa91178f4e8923584f7feb
gitea-1.17.3.tar.gz MD5 3565b8d2f77687f95a3d95dd9680673c
gitea-1.21.4.tar.gz SHA1 e51c2fcec35ccfe13597ae1726545459e4f3ad80
gitea-1.21.4.tar.gz SHA256 d6464552df69636bfe5883e54870fe31eec0e602954ab16b94d297f3913498a5
gitea-1.21.4.tar.gz MD5 b1e10d3c9b12d26003ba7827d8b74e4d
27 changes: 15 additions & 12 deletions spk/gitea/Makefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
SPK_NAME = gitea
SPK_VERS = 1.17.3
SPK_REV = 10
SPK_VERS = 1.21.4
SPK_REV = 11
SPK_ICON = src/$(SPK_NAME).png

MAINTAINER = wkobiela
DESCRIPTION = Gitea is a community managed lightweight code hosting solution written in Go.
DISPLAY_NAME = Gitea
CHANGELOG = "1. Update to v1.17.3."
CHANGELOG = "1. Update to v1.21.4."

LICENSE = MIT

DEPENDS = cross/$(SPK_NAME)
SPK_DEPENDS = "git>=2"

SERVICE_USER = auto
SERVICE_SETUP = src/service-setup.sh
STARTABLE = yes
WIZARDS_DIR = src/wizard
SERVICE_WIZARD_SHARE = wizard_gitea_dir

# Use shared folder provided by DSM for DSM 6 too (not only for DSM 7).
USE_DATA_SHARE_WORKER = yes
SERVICE_USER = auto
SERVICE_SETUP = src/service-setup.sh
STARTABLE = yes
WIZARDS_DIR = src/wizard/
SERVICE_WIZARD_SHARENAME = wizard_shared_folder_name

SERVICE_PORT = 8418
SERVICE_PORT_TITLE = Gitea (HTTP)
SERVICE_PORT_TITLE = $(DISPLAY_NAME) (HTTP)
ADMIN_PORT = $(SERVICE_PORT)

include ../../mk/spksrc.spk.mk

.PHONY: gitea_extra_install
gitea_extra_install:
@$(MSG) "Install config.ini file"
@install -m 755 -d $(STAGING_DIR)/var
@install -m 644 src/config.ini $(STAGING_DIR)/var/config.ini
8 changes: 8 additions & 0 deletions spk/gitea/src/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[repository]
ROOT = @share_path@/gitea-repositories
[server]
SSH_DOMAIN = @ip_address@
DOMAIN = @ip_address@
ROOT_URL = http://@ip_address@:@service_port@/
[lfs]
PATH = @share_path@/lfs
43 changes: 17 additions & 26 deletions spk/gitea/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,32 @@ CONF_FILE="${SYNOPKG_PKGVAR}/conf.ini"
PATH="/var/packages/git/target/bin:${PATH}"

if [ $SYNOPKG_DSM_VERSION_MAJOR -lt 7 ]; then
SYNOPKG_PKGHOME="${SYNOPKG_PKGDEST}"
SYNOPKG_PKGHOME="${SYNOPKG_PKGVAR}"
fi

ENV="PATH=${PATH} HOME=${SYNOPKG_PKGHOME}"

SERVICE_COMMAND="env ${ENV} ${GITEA} web --port ${SERVICE_PORT} --pid ${PID_FILE}"
SVC_BACKGROUND=y

service_preinst ()
{
if [ "${SYNOPKG_PKG_STATUS}" == "INSTALL" ] && [ $SYNOPKG_DSM_VERSION_MAJOR -lt 6 ]; then
SHARED_FOLDER="${wizard_volume}/${wizard_gitea_dir}"
if [ ! -d "${SHARED_FOLDER}" ]; then
mkdir -p "${SHARED_FOLDER}" || {
echo "Failed to create directory \"${SHARED_FOLDER}\"."
exit 1
}
fi
set_syno_permissions "${SHARED_FOLDER}" "${EFF_USER}"
fi
}

service_postinst ()
{
if [ "${SYNOPKG_PKG_STATUS}" == "INSTALL" ]; then
SHARED_FOLDER="${wizard_volume}/${wizard_gitea_dir}"
IP=$(ip route get 1 | awk '{print $(NF);exit}')
# Default configuration with shared folder
{
echo "[repository]"
echo "ROOT = ${SHARED_FOLDER}/gitea-repositories"
echo "[server]"
echo "LFS_CONTENT_PATH = ${SHARED_FOLDER}/lfs"
echo "SSH_DOMAIN = ${IP:=localhost}"
echo "DOMAIN = ${IP:=localhost}"
echo "ROOT_URL = http://${IP:=localhost}:${SERVICE_PORT}/"
} > "$CONF_FILE"

sed -i -e "s|@share_path@|${SHARE_PATH}|g" ${CFG_FILE}
sed -i -e "s|@ip_address@|${IP:=localhost}|g" ${CFG_FILE}
sed -i -e "s|@service_port@|${SERVICE_PORT}|g" ${CFG_FILE}
fi
}

# service_restore is called by post_upgrade before restoring files from ${TMP_DIR}
service_restore ()
{
if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
# make a copy of the new config file before it gets overwritten by restore
# overwrite existing *.new files in ${TMP_DIR}/ as all files in ${TMP_DIR}/
# are restored to ${SYNOPKG_PKGVAR}/
[ -f "${SYNOPKG_PKGVAR}/conf.ini" ] && cp -f ${SYNOPKG_PKGVAR}/conf.ini ${TMP_DIR}/conf.ini.new
fi
}
53 changes: 13 additions & 40 deletions spk/gitea/src/wizard/install_uifile
Original file line number Diff line number Diff line change
@@ -1,58 +1,31 @@
[
{
"step_title": "Basic configuration",
"step_title": "Gitea configuration",
"items": [
{
"type": "combobox",
"desc": "Please select a volume to use for the gitea folder",
"subitems": [
{
"key": "wizard_volume",
"desc": "volume name",
"displayField": "display_name",
"valueField": "volume_path",
"editable": false,
"mode": "remote",
"api_store": {
"api": "SYNO.Core.Storage.Volume",
"method": "list",
"version": 1,
"baseParams": {
"limit": -1,
"offset": 0,
"location": "internal"
},
"root": "volumes",
"idProperty": "volume_path",
"fields": [
"display_name",
"volume_path"
]
},
"validator": {
"fn": "{console.log(arguments);return true;}"
}
}
]
},
{
"type": "textfield",
"desc": "Repository shared folder name (using the volume chosen above)",
"desc": "Please specify a shared folder for this package. This share is created at installation when it does not already exist.",
"subitems": [
{
"key": "wizard_gitea_dir",
"desc": "Repository shared folder",
"defaultValue": "git",
"key": "wizard_shared_folder_name",
"desc": "Shared Folder",
"defaultValue": "gitea-share",
"validator": {
"allowBlank": false,
"regex": {
"expr": "/^[\\w _-]+$/",
"errorText": "Subdirectories are not supported."
"errorText": "Subdirectories are not supported."
}
}
}
]
}
}, {
"desc": "If you let the installer create the shared folder, it is created under the same volume as the package is installed. If you want to use a different volume for the share, you must create the shared folder in DSM Control Panel before, and enter the name of the existing share in the field above."
}, {
"desc": ""
}, {
"desc": "This package runs as internal service user <b>'sc-gitea'</b> in DSM. The shared folder above is configured at installation time to be accessible by this user. Please read <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a> for details."
}
]
}
]
31 changes: 31 additions & 0 deletions spk/gitea/src/wizard/install_uifile_plk
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[
{
"step_title": "Konfiguracja Gitea",
"items": [
{
"type": "textfield",
"desc": "Wybierz folder współdzielony. Jeśli jeszcze nie istnieje, zostanie stworzony podczas instalacji.",
"subitems": [
{
"key": "wizard_shared_folder_name",
"desc": "Folder wspóldzielony",
"defaultValue": "gitea-share",
"validator": {
"allowBlank": false,
"regex": {
"expr": "/^[\\w _-]+$/",
"errorText": "Podkatalogi nie są obsługiwane."
}
}
}
]
}, {
"desc": "Jeśli zezwolisz instalatorowi na utworzenie folderu współdzielonego, zostanie on utworzony na tym samym wolumenie, na którym instalowany jest pakiet. Jeśli chcesz użyć innego wolumenu, musisz wcześniej utworzyć folder współdzielony w Panelu Sterowania DSM i wpisać nazwę istniejącego folderu współdzielonego w powyższym polu."
}, {
"desc": ""
}, {
"desc": "Ten pakiet uruchamia się jako użytkownik usługi wewnętrznej <b>'sc-gitea'</b> w DSM. Powyższy folder współdzielony jest skonfigurowany podczas instalacji tak, aby był dostępny dla tego użytkownika. Przeczytaj <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Zarządzanie uprawnieniami</a>, aby uzyskać szczegółowe informacje."
}
]
}
]
10 changes: 10 additions & 0 deletions spk/gitea/src/wizard/upgrade_uifile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[{
"step_title": "Updating Gitea",
"items": [{
"desc": "Please, be aware that configuration file may require some manual adjustments."
},{
"desc": "Check Gitea admin panel after upgrade and adjust <b>/var/packages/gitea/var/conf.ini</b> as needed."
},{
"desc": "Remember to restart Gitea package afterwards."
}]
}]
10 changes: 10 additions & 0 deletions spk/gitea/src/wizard/upgrade_uifile_plk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[{
"step_title": "Aktualizacja Gitea",
"items": [{
"desc": "Uwaga: plik konfiguracyjny może wymagać manualnego dopasowania."
},{
"desc": "Po aktualizacji sprawdź panel administracyjny Gitea i edytuj plik <b>/var/packages/gitea/var/conf.ini</b> według potrzeb."
},{
"desc": "Pamiętaj, aby po zmianach ponownie uruchomić pakiet Gitea."
}]
}]

0 comments on commit 8873f21

Please sign in to comment.