1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/syncthing_ynh.git synced 2024-09-03 20:26:23 +02:00

Apply example_ynh

This commit is contained in:
yalh76 2019-05-17 01:33:38 +02:00
parent c2ffe48063
commit 2ddf324c40
8 changed files with 186 additions and 159 deletions

View file

@ -27,15 +27,15 @@ How to configure this app: by an admin panel, a plain file with SSH, or any othe
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/syncthing%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/syncthing/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/syncthing%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/syncthing/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/syncthing%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/syncthing/)
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/syncthing%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/syncthing/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/syncthing%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/syncthing/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/syncthing%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/syncthing/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/syncthing_ynh/issues
* App website: https://syncthing.net/
* Git App website: https://github.com/syncthing/syncthing
* Upstream app repository: https://github.com/syncthing/syncthing
* YunoHost website: https://yunohost.org/
---

View file

@ -14,7 +14,7 @@
"email": "txmrl@txmrl.net"
},
"requirements": {
"yunohost": ">= 3.4"
"yunohost": ">= 3.5"
},
"multi_instance": false,
"services": [

View file

@ -23,40 +23,40 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_print_info "Backing up the main app directory..."
ynh_print_info --message="Backing up the main app directory..."
ynh_backup "$final_path"
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_print_info "Backing up nginx web server configuration..."
ynh_print_info --message="Backing up nginx web server configuration..."
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_print_info "Backing up systemd configuration..."
ynh_print_info --message="Backing up systemd configuration..."
ynh_backup "/etc/systemd/system/$app.service"
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -24,13 +24,15 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
ynh_print_info --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get $app final_path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get "$app" db_name)
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
@ -50,10 +52,17 @@ fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_print_info --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_print_info "Updating nginx web server configuration..."
ynh_print_info --message="Updating nginx web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -61,7 +70,7 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
if [ $change_path -eq 1 ]
then
# Make a backup of the original nginx config file if modified
ynh_backup_if_checksum_is_different "$nginx_conf_path"
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper
domain="$old_domain"
path_url="$new_path"
@ -73,10 +82,10 @@ fi
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum "$nginx_conf_path"
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
@ -87,15 +96,22 @@ fi
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_print_info --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start"
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
ynh_print_info --message="Reloading nginx web server..."
systemctl reload nginx
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Change of URL completed for $app"
ynh_print_info --message="Change of URL completed for $app"

View file

@ -35,52 +35,52 @@ sync_home="/home/yunohost.app/$app"
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_print_info "Validating installation parameters..."
ynh_print_info --message="Validating installation parameters..."
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register $app $domain $path_url
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_print_info "Storing installation settings..."
ynh_print_info --message="Storing installation settings..."
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app admin $admin
ynh_app_setting_set $app sync_home $sync_home
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=sync_home --value=$sync_home
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_print_info "Configuring firewall..."
ynh_print_info --message="Configuring firewall..."
gui_port=$(ynh_find_port 8384)
ynh_app_setting_set $app gui_port $gui_port
gui_port=$(ynh_find_port --port=8384)
ynh_app_setting_set --app=$app --key=gui_port --value=$gui_port
sync_port=$(ynh_find_port 22000)
sync_port=$(ynh_find_port --port=22000)
# Open this port
ynh_exec_warn_less yunohost firewall allow TCP $sync_port
ynh_app_setting_set $app sync_port $sync_port
ynh_app_setting_set --app=$app s--key=ync_port --value=$sync_port
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info "Setting up source files..."
ynh_print_info --message="Setting up source files..."
ynh_app_setting_set $app final_path $final_path
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
ynh_setup_source --dest_dir="$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info "Configuring nginx web server..."
ynh_print_info --message="Configuring nginx web server..."
# Create a dedicated nginx config
ynh_add_nginx_config "gui_port"
@ -88,7 +88,7 @@ ynh_add_nginx_config "gui_port"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Configuring system user..."
ynh_print_info --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
@ -98,7 +98,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# CREATE SYNC DIRECTORY
#=================================================
ynh_print_info "Creating sync directory..."
ynh_print_info --message="Creating sync directory..."
# Make directories and set rights
mkdir -p "$sync_home"
@ -107,7 +107,7 @@ chown -R "$app": "$sync_home"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_print_info "Configuring a systemd service..."
ynh_print_info --message="Configuring a systemd service..."
# Create a dedicated systemd config
ynh_add_systemd_config
@ -115,14 +115,14 @@ ynh_add_systemd_config
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_print_info "Modifying a config file..."
ynh_print_info --message="Modifying a config file..."
mkdir -p "$final_path/.config/syncthing"
config_file="$final_path/.config/syncthing/config.xml"
cp "../conf/config.xml" "$config_file"
ynh_replace_string "__GUI_PORT__" "$gui_port" "$config_file"
ynh_replace_string "__SYNC_HOME__" "$sync_home" "$config_file"
ynh_replace_string --match_string="__GUI_PORT__" --replace_string="$gui_port" --target_file="$config_file"
ynh_replace_string --match_string="__SYNC_HOME__" --replace_string="$sync_home" --target_file="$config_file"
#=================================================
# FIX LISTENING SERVICE
@ -130,18 +130,18 @@ ynh_replace_string "__SYNC_HOME__" "$sync_home" "$config_file"
chown -R $app: $final_path
ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_match="Access the GUI via the following URL"
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access the GUI via the following URL"
ynh_replace_string "<listenAddress>tcp://default</listenAddress>" "<listenAddress>default</listenAddress>" "$config_file"
ynh_replace_string --match_string="<listenAddress>tcp://default</listenAddress>" --replace_string="<listenAddress>default</listenAddress>" --target_file="$config_file"
ynh_systemd_action --action=stop --service_name=$app --log_path=systemd
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "$config_file"
ynh_store_file_checksum --file="$config_file"
#=================================================
# GENERIC FINALIZATION
@ -158,30 +158,30 @@ chown -R $app: $final_path
yunohost service add $app --description "$app daemon for Syncthing"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_print_info --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
#=================================================
ynh_print_info "Configuring SSOwat..."
ynh_print_info --message="Configuring SSOwat..."
# Make app public
ynh_app_setting_set $app unprotected_uris "/"
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
ynh_print_info --message="Reloading nginx web server..."
systemctl reload nginx
#=================================================
# START SYNCTHING SERVICES
#=================================================
ynh_print_info "Starting Syncthing services..."
ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_match="Access the GUI via the following URL"
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Installation of $app completed"
ynh_print_info --message="Installation of $app completed"

View file

@ -12,15 +12,15 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get $app final_path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
sync_port=$(ynh_app_setting_get $app sync_port)
sync_port=$(ynh_app_setting_get --app=$app --key=sync_port)
#=================================================
# STANDARD REMOVE
@ -31,14 +31,14 @@ sync_port=$(ynh_app_setting_get $app sync_port)
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status $app >/dev/null 2>&1
then
ynh_print_info "Removing $app service"
ynh_print_info --message="Removing $app service..."
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_print_info "Stopping and removing the systemd service"
ynh_print_info --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_remove_systemd_config
@ -46,15 +46,15 @@ ynh_remove_systemd_config
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_print_info "Removing app main directory"
ynh_print_info --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove "$final_path"
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_print_info "Removing nginx web server configuration"
ynh_print_info --message="Removing nginx web server configuration..."
# Remove the dedicated nginx config
ynh_remove_nginx_config
@ -63,7 +63,7 @@ ynh_remove_nginx_config
# CLOSE A PORT
#=================================================
ynh_print_info "Closing port $sync_port"
ynh_print_info --message="Closing port $sync_port"
ynh_exec_warn_less yunohost firewall disallow TCP $sync_port
#=================================================
@ -71,13 +71,13 @@ ynh_exec_warn_less yunohost firewall disallow TCP $sync_port
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_print_info "Removing the dedicated system user"
ynh_print_info --message="Removing the dedicated system user..."
# Delete a system user
ynh_system_user_delete $app
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Removal of $app completed"
ynh_print_info --message="Removal of $app completed"

View file

@ -23,24 +23,24 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading settings..."
ynh_print_info --message="Loading settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path)
sync_home=$(ynh_app_setting_get $app sync_home)
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
sync_home=$(ynh_app_setting_get --app=$app --key=sync_home)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_print_info "Validating restoration parameters..."
ynh_print_info --message="Validating restoration parameters..."
ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}"
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die "There is already a directory: $final_path "
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
@ -48,19 +48,19 @@ test ! -d $final_path \
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_print_info "Restoring the app main directory..."
ynh_print_info --message="Restoring the app main directory..."
ynh_restore_file "$final_path"
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_print_info "Recreating the dedicated system user..."
ynh_print_info --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
@ -77,7 +77,7 @@ chown -R "$app": $final_path
#=================================================
# RECREATE SYNC DIRECTORY
#=================================================
ynh_print_info "Recreating sync directory..."
ynh_print_info --message="Recreating sync directory..."
# Make directories and set rights
mkdir -p "$sync_home"
@ -86,9 +86,9 @@ chown -R "$app": "$sync_home"
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_print_info "Restoring the systemd configuration..."
ynh_print_info --message="Restoring the systemd configuration..."
ynh_restore_file "/etc/systemd/system/$app.service"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service
#=================================================
@ -97,24 +97,24 @@ systemctl enable $app.service
yunohost service add $app --description "$app daemon for Syncthing"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_print_info --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"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
ynh_print_info --message="Reloading nginx web server..."
systemctl reload nginx
#=================================================
# START SYNCTHING SERVICES
#=================================================
ynh_print_info "Starting Syncthing services..."
ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_match="Access the GUI via the following URL"
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Restoration completed for $app"
ynh_print_info --message="Restoration completed for $app"

View file

@ -12,23 +12,29 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get $app final_path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
sync_home=$(ynh_app_setting_get $app sync_home)
sync_port=$(ynh_app_setting_get $app sync_port)
gui_port=$(ynh_app_setting_get $app gui_port)
sync_home=$(ynh_app_setting_get --app=$app --key=sync_home)
sync_port=$(ynh_app_setting_get --app=$app --key=sync_port)
gui_port=$(ynh_app_setting_get --app=$app --key=gui_port)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_print_info "Ensuring downward compatibility..."
ynh_print_info --message="Ensuring downward compatibility..."
# If gui_port doesn't exist, create it
if [ -z $gui_port ]; then
@ -40,20 +46,20 @@ if [ -z $gui_port ]; then
OLD_CONFIG="$OLD_SYNCHOME/.config/syncthing/config.xml"
admin=$(ynh_app_setting_get $app allowed_users)
ynh_app_setting_set $app admin $admin
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_delete --app="$app" --key="allowed_users"
final_path=/var/www/$app
ynh_app_setting_set $app final_path $final_path
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
gui_port=$OLD_GUIPORT
ynh_app_setting_set $app gui_port $gui_port
ynh_app_setting_set --app=$app --key=gui_port --value=$gui_port
sync_home="/home/yunohost.app/$app"
ynh_app_setting_set $app sync_home $sync_home
ynh_app_setting_set --app=$app --key=sync_home --value=$sync_home
sync_port=$OLD_SYNCPORT
ynh_app_setting_set $app sync_port $sync_port
ynh_app_setting_set --app=$app --key=sync_port --value=$sync_port
mkdir -p $final_path
cp -R $OLD_SYNCHOME/.config $final_path/.config
@ -74,43 +80,48 @@ if [ -z $gui_port ]; then
else
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info "Backing up the app before upgrading (may take a while)..."
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STOP SYNCTHING SERVICES
#=================================================
ynh_print_info "Stopping Syncthing services..."
ynh_systemd_action --action=stop --service_name=$app --log_path=systemd
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_print_info --message="Stopping Syncthing services..."
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_print_info --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info "Upgrading nginx web server configuration..."
ynh_print_info --message="Upgrading nginx web server configuration..."
# Create a dedicated nginx config
ynh_add_nginx_config "gui_port"
@ -118,7 +129,7 @@ ynh_add_nginx_config "gui_port"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Making sure dedicated system user exists..."
ynh_print_info --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
@ -128,7 +139,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# CREATE SYNC DIRECTORY
#=================================================
ynh_print_info "Creating sync directory..."
ynh_print_info --message="Creating sync directory..."
# Make directories and set rights
mkdir -p "$sync_home"
@ -140,14 +151,14 @@ chown -R "$app": "$sync_home"
config_file="$final_path/.config/syncthing/config.xml"
ynh_backup_if_checksum_is_different "$config_file"
ynh_backup_if_checksum_is_different --file="$config_file"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum "$config_file"
ynh_store_file_checksum --file="$config_file"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_print_info "Upgrading systemd configuration..."
ynh_print_info --message="Upgrading systemd configuration..."
# Create a dedicated systemd config
ynh_add_systemd_config
@ -164,26 +175,26 @@ chown -R $app: $final_path
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info "Upgrading SSOwat configuration..."
ynh_print_info --message="Upgrading SSOwat configuration..."
ynh_app_setting_set $app unprotected_uris "/"
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_print_info --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
#=================================================
ynh_print_info "Reloading nginx web server..."
ynh_print_info --message="Reloading nginx web server..."
systemctl reload nginx
#=================================================
# START SYNCTHING SERVICES
#=================================================
ynh_print_info "Starting Syncthing services..."
ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_match="Access the GUI via the following URL"
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Upgrade of $app completed"
ynh_print_info --message="Upgrade of $app completed"