diff --git a/doc/.gitkeep b/doc/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..e69de29 diff --git a/doc/screenshots/.gitkeep b/doc/screenshots/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/doc/screenshots/screenshot1.png b/doc/screenshots/screenshot1.png new file mode 100644 index 0000000..d3b6c8b Binary files /dev/null and b/doc/screenshots/screenshot1.png differ diff --git a/manifest.json b/manifest.json index 7134bd5..10384c4 100644 --- a/manifest.json +++ b/manifest.json @@ -8,6 +8,13 @@ }, "version": "1.17.0~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": [ { diff --git a/scripts/backup b/scripts/backup index cb832ff..11eb9f9 100644 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting + true } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -42,6 +42,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP THE DATA DIRECTORY +#================================================= + +ynh_backup --src_path="$sync_home" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= @@ -56,13 +62,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# BACKUP THE DATA DIRECTORY -#================================================= -ynh_print_info --message="Backing up data directory..." - -ynh_backup --src_path="$sync_home" --is_big - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index caac7fc..d6bb455 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -93,7 +93,7 @@ then domain="$old_domain" path_url="$new_path" # Create a dedicated NGINX config - ynh_add_nginx_config "gui_port" + ynh_add_nginx_config fi # Change the domain for NGINX diff --git a/scripts/install b/scripts/install index 7a559d6..fe5fbfb 100644 --- a/scripts/install +++ b/scripts/install @@ -30,9 +30,6 @@ admin=$YNH_APP_ARG_ADMIN app=$YNH_APP_INSTANCE_NAME -# Configure sync folder -sync_home="/home/yunohost.app/$app" - #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -52,7 +49,6 @@ ynh_script_progression --message="Storing installation settings..." 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 @@ -78,7 +74,7 @@ ynh_exec_warn_less yunohost firewall allow TCP $sync_port ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -99,7 +95,7 @@ chown -R $app:$app "$final_path" ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated NGINX config -ynh_add_nginx_config "gui_port" +ynh_add_nginx_config #================================================= # SPECIFIC SETUP @@ -108,8 +104,11 @@ ynh_add_nginx_config "gui_port" #================================================= ynh_script_progression --message="Creating sync directory..." -# Make directories and set rights -mkdir -p "$sync_home" +sync_home=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=sync_home --value=$sync_home + +mkdir -p $sync_home + chmod 750 "$sync_home" chmod -R o-rwx "$sync_home" chown -R $app:$app "$sync_home" @@ -147,12 +146,6 @@ ynh_replace_string --match_string="tcp://default" ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= -ynh_script_progression --message="Storing the config file checksum..." - -# Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$config_file" #================================================= diff --git a/scripts/restore b/scripts/restore index f9eaca4..b735318 100644 --- a/scripts/restore +++ b/scripts/restore @@ -79,22 +79,21 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" -#================================================= -# SPECIFIC RESTORATION #================================================= # RECREATE SYNC DIRECTORY #================================================= ynh_script_progression --message="Recreating sync directory..." -# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup. ynh_restore_file --origin_path="$sync_home" --not_mandatory -# Make directories and set rights -mkdir -p "$sync_home" +mkdir -p $sync_home + chmod 750 "$sync_home" chmod -R o-rwx "$sync_home" chown -R $app:$app "$sync_home" +#================================================= +# SPECIFIC RESTORATION #================================================= # RESTORE SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d38071a..e2b6fa6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -32,18 +32,34 @@ ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --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 () { + # 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_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..." -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - # If gui_port doesn't exist, create it if [ -z $gui_port ]; then OLD_SYNCHOME="/home/yunohost.app/syncthing" @@ -85,40 +101,13 @@ if [ -z $gui_port ]; then ynh_remove_app_dependencies -else +fi - #================================================= - # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP - #================================================= - ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." - - # Inform the backup/restore process that it should not save the data directory - # Use only for the previous backup script that doesn't set 'is_big' - ynh_app_setting_set --app=$app --key=backup_core_only --value=1 - - # Backup the current version of the app - ynh_backup_before_upgrade - - # Remove the option backup_core_only after the backup. - ynh_app_setting_delete --app=$app --key=backup_core_only - - 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_script_progression --message="Stopping a systemd service..." - - ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + ynh_app_setting_delete --app=$app --key=is_public fi #================================================= @@ -127,7 +116,7 @@ fi ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -151,7 +140,7 @@ chown -R $app:$app "$final_path" ynh_script_progression --message="Upgrading NGINX web server configuration..." # Create a dedicated NGINX config -ynh_add_nginx_config "gui_port" +ynh_add_nginx_config #================================================= # SPECIFIC UPGRADE @@ -173,9 +162,7 @@ ynh_script_progression --message="Updating a config file..." config_file="$final_path/.config/syncthing/config.xml" -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 --file="$config_file" +ynh_add_config --template="../conf/config.xml" --destination="$config_file" chmod 400 "$config_file" chown $app:$app "$config_file"