1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/syncthing_ynh.git synced 2024-09-03 20:26:23 +02:00
This commit is contained in:
Éric Gaspar 2023-02-07 13:32:16 +01:00
parent 3d04c7f052
commit ac395ba809
10 changed files with 26 additions and 395 deletions

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/syncthing/syncthing/releases/download/v1.22.1/syncthing-linux-arm-v1.22.1.tar.gz
SOURCE_SUM=6506b24baa1cc22b088e4cf0b67eb738dc813f4b23865d8b8ff0456a2c2efa0b
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,6 +1,6 @@
<configuration>
<gui enabled="true" tls="false" debugging="false">
<address>127.0.0.1:__GUI_PORT__</address>
<address>127.0.0.1:__PORT_GUI__</address>
<authMode>ldap</authMode>
</gui>
<ldap>

View file

@ -1,13 +1,15 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
proxy_set_header Host 127.0.0.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:__GUI_PORT__/;
proxy_set_header Host 127.0.0.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
proxy_pass http://127.0.0.1:__PORT_GUI__/;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;

View file

@ -1,52 +0,0 @@
{
"name": "Syncthing",
"id": "syncthing",
"packaging_format": 1,
"description": {
"en": "Continuous file synchronization program",
"fr": "Programme de synchronisation de fichiers en continu"
},
"version": "1.22.1~ynh1",
"url": "https://syncthing.net/",
"upstream": {
"license": "MPL-2.0",
"website": "https://syncthing.net",
"userdoc": "https://docs.syncthing.net",
"code": "https://github.com/syncthing/syncthing"
},
"license": "MPL-2.0",
"maintainer": [
{
"name": "txmrl",
"email": "txmrl@txmrl.net"
},
{
"name": "yalh76"
}
],
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/syncthing",
"default": "/syncthing"
},
{
"name": "admin",
"type": "user"
}
]
}
}

View file

@ -5,7 +5,7 @@ name = "Syncthing"
description.en = "Continuous file synchronization program"
description.fr = "Programme de synchronisation de fichiers en continu"
version = "1.22.1~ynh1"
version = "1.23.1~ynh1"
maintainers = ["txmrl", "yalh76"]
@ -14,31 +14,26 @@ license = "MPL-2.0"
website = "https://syncthing.net"
userdoc = "https://docs.syncthing.net"
code = "https://github.com/syncthing/syncthing"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 4.3.0"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
yunohost = ">= 11.1.6"
architectures = "all"
multi_instance = true
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ldap = "not_relevant"
sso = "not_relevant"
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
[install.path]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "path"
default = "/syncthing"
[install.admin]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "user"
[resources]
@ -50,3 +45,9 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
[resources.permissions]
main.url = "/"
[resources.ports]
main.default = 22000
main.exposed = "TCP"
gui.default = 88384

View file

@ -9,81 +9,13 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
#REMOVEME? path=$YNH_APP_ARG_PATH
#REMOVEME? admin=$YNH_APP_ARG_ADMIN
architecture=$YNH_ARCH
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
#REMOVEME? ynh_script_progression --message="Validating installation parameters..."
#REMOVEME? install_dir=/var/www/$app
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
# Register (book) web path
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
#REMOVEME? ynh_script_progression --message="Storing installation settings..."
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
#REMOVEME? ynh_script_progression --message="Finding an available port..."
# Find an available port
#REMOVEME? port=$(ynh_find_port --port=22000)
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
#REMOVEME? gui_port=$(ynh_find_port --port=8384)
#REMOVEME? ynh_app_setting_set --app=$app --key=gui_port --value=$gui_port
# Open the port
ynh_script_progression --message="Configuring firewall..."
ynh_exec_warn_less yunohost firewall allow TCP $port
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring system user..."
# Create a system user
#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --source_id=$architecture
ynh_setup_source --dest_dir="$install_dir" --source_id=$YNH_ARCH
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
@ -97,22 +29,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..."
#REMOVEME? data_dir=/home/yunohost.app/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
mkdir -p $data_dir
chmod 750 "$data_dir"
chmod -R o-rwx "$data_dir"
chown -R $app:$app "$data_dir"
#=================================================
# ADD A CONFIGURATION
#=================================================
@ -164,22 +80,6 @@ ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access the GUI via the following URL"
#=================================================
# SETUP SSOWAT
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring permissions..."
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,18 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#=================================================
# STANDARD REMOVE
#=================================================
@ -42,25 +30,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE APP MAIN DIR
#=================================================
#REMOVEME? ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
#REMOVEME? ynh_secure_remove --file="$install_dir"
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..."
#REMOVEME? ynh_secure_remove --file="$data_dir"
fi
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
@ -69,26 +38,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
#REMOVEME? ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -10,47 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
#REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $install_dir "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# OPEN A PORT
#=================================================
ynh_script_progression --message="Configuring firewall..."
# Open the port
ynh_exec_warn_less yunohost firewall allow TCP $port
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
@ -58,14 +17,6 @@ ynh_script_progression --message="Restoring the NGINX web server configuration..
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================

View file

@ -9,43 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
architecture=$YNH_ARCH
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? gui_port=$(ynh_app_setting_get --app=$app --key=gui_port)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -55,82 +24,6 @@ ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# If gui_port doesn't exist, create it
if [ -z $gui_port ]; then
OLD_SYNCHOME="/home/yunohost.app/syncthing"
OLD_SYNCUSER=debian-syncthing
OLD_SYNCPORT=22000
OLD_GUIPORT=8384
OLD_CONFIG="$OLD_SYNCHOME/.config/syncthing/config.xml"
#REMOVEME? admin=$(ynh_app_setting_get $app allowed_users)
#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_delete --app="$app" --key="allowed_users"
#REMOVEME?
install_dir=/var/www/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
gui_port=$OLD_GUIPORT
#REMOVEME? ynh_app_setting_set --app=$app --key=gui_port --value=$gui_port
data_dir="/home/yunohost.app/$app"
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
port=$OLD_SYNCPORT
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
mkdir -p $install_dir
cp -R $OLD_SYNCHOME/.config $install_dir/.config
ynh_replace_string --match_string="~" --replace_string="$data_dir" --target_file="$install_dir/.config/syncthing/config.xml"
systemctl stop syncthing@$OLD_SYNCUSER.service
yunohost service remove syncthing@$OLD_SYNCUSER.service
systemctl disable syncthing@$OLD_SYNCUSER.service --quiet
ynh_secure_remove --file="/etc/apt/sources.list.d/syncthing.list"
#REMOVEME? ynh_system_user_delete --username="$SYNCUSER"
ynh_remove_logrotate
#REMOVEME? ynh_remove_app_dependencies
fi
# If port doesn't exist, create it
if [ -z $port ]; then
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=sync_port)
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
ynh_app_setting_delete --app=$app --key=sync_port
fi
# If data_dir doesn't exist, create it
if [ -z $data_dir ]; then
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=sync_home)
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
ynh_app_setting_delete --app="$app" --key="sync_home"
fi
# Cleaning legacy permissions
#REMOVEME? if ynh_legacy_permissions_exists; then
#REMOVEME? ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -140,7 +33,7 @@ then
ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --source_id=$architecture
ynh_setup_source --dest_dir="$install_dir" --source_id=$YNH_ARCH
fi
chmod 750 "$install_dir"
@ -208,13 +101,6 @@ ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access the GUI via the following URL"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

0
tests.toml Normal file
View file