diff --git a/cross/gitea/Makefile b/cross/gitea/Makefile
index 4012872a48e..a2fac19e905 100644
--- a/cross/gitea/Makefile
+++ b/cross/gitea/Makefile
@@ -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
diff --git a/cross/gitea/digests b/cross/gitea/digests
index bb24a8d040f..dfdd3d59f0f 100644
--- a/cross/gitea/digests
+++ b/cross/gitea/digests
@@ -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
diff --git a/spk/gitea/Makefile b/spk/gitea/Makefile
index 1727c0c1490..67f81df9bdb 100644
--- a/spk/gitea/Makefile
+++ b/spk/gitea/Makefile
@@ -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
\ No newline at end of file
diff --git a/spk/gitea/src/config.ini b/spk/gitea/src/config.ini
new file mode 100644
index 00000000000..843eec23ab0
--- /dev/null
+++ b/spk/gitea/src/config.ini
@@ -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
\ No newline at end of file
diff --git a/spk/gitea/src/service-setup.sh b/spk/gitea/src/service-setup.sh
index 94fd0c7b7c8..113c51b529c 100644
--- a/spk/gitea/src/service-setup.sh
+++ b/spk/gitea/src/service-setup.sh
@@ -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
+}
\ No newline at end of file
diff --git a/spk/gitea/src/wizard/install_uifile b/spk/gitea/src/wizard/install_uifile
index 6c27fb2f3e1..2cd3f0e76b2 100644
--- a/spk/gitea/src/wizard/install_uifile
+++ b/spk/gitea/src/wizard/install_uifile
@@ -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 'sc-gitea' in DSM. The shared folder above is configured at installation time to be accessible by this user. Please read Permission Management for details."
+ }
]
}
]
diff --git a/spk/gitea/src/wizard/install_uifile_plk b/spk/gitea/src/wizard/install_uifile_plk
new file mode 100644
index 00000000000..c70bbf6a37c
--- /dev/null
+++ b/spk/gitea/src/wizard/install_uifile_plk
@@ -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 'sc-gitea' w DSM. Powyższy folder współdzielony jest skonfigurowany podczas instalacji tak, aby był dostępny dla tego użytkownika. Przeczytaj Zarządzanie uprawnieniami, aby uzyskać szczegółowe informacje."
+ }
+ ]
+ }
+]
diff --git a/spk/gitea/src/wizard/upgrade_uifile b/spk/gitea/src/wizard/upgrade_uifile
new file mode 100644
index 00000000000..57e4b67b67c
--- /dev/null
+++ b/spk/gitea/src/wizard/upgrade_uifile
@@ -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 /var/packages/gitea/var/conf.ini as needed."
+ },{
+ "desc": "Remember to restart Gitea package afterwards."
+ }]
+}]
\ No newline at end of file
diff --git a/spk/gitea/src/wizard/upgrade_uifile_plk b/spk/gitea/src/wizard/upgrade_uifile_plk
new file mode 100644
index 00000000000..2f428cbaebb
--- /dev/null
+++ b/spk/gitea/src/wizard/upgrade_uifile_plk
@@ -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 /var/packages/gitea/var/conf.ini według potrzeb."
+ },{
+ "desc": "Pamiętaj, aby po zmianach ponownie uruchomić pakiet Gitea."
+ }]
+}]
\ No newline at end of file