1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gotosocial_ynh.git synced 2024-09-03 19:16:06 +02:00

automatic conversion

This commit is contained in:
OniriCorpe 2024-01-08 17:50:43 +01:00
parent b6996d9464
commit 76b15d70e1
14 changed files with 376 additions and 298 deletions

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/superseriousbusiness/gotosocial/releases/download/v0.13.0/gotosocial_0.13.0_linux_arm64.tar.gz
SOURCE_SUM=cd93eb377ff86f241a3957fc81b08607b3df89bb70c3d857bb2ad107db917678
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_EXTRACT=true
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=gotosocial_0.13.0_linux_arm64.tar.gz

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/superseriousbusiness/gotosocial/releases/download/v0.13.0/gotosocial_0.13.0_linux_armv6.tar.gz
SOURCE_SUM=9d67def302645987279ea76a64e72eda2d05318bd2aea42109dce097e65b2087
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_EXTRACT=true
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=gotosocial_0.13.0_linux_armv6.tar.gz

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/superseriousbusiness/gotosocial/releases/download/v0.13.0/gotosocial_0.13.0_linux_armv7.tar.gz
SOURCE_SUM=2bff982d96333528d6479aef16d3686038a9d01f11c5043a536f2b7a463fd881
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_EXTRACT=true
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=gotosocial_0.13.0_linux_armv7.tar.gz

View file

@ -504,7 +504,7 @@ storage-backend: "__STORAGE_BACKEND__"
# Only required when running with the local storage backend. # Only required when running with the local storage backend.
# Examples: ["/home/gotosocial/storage", "/opt/gotosocial/datastorage"] # Examples: ["/home/gotosocial/storage", "/opt/gotosocial/datastorage"]
# Default: "/gotosocial/storage" # Default: "/gotosocial/storage"
storage-local-base-path: "__DATADIR__" storage-local-base-path: "__DATA_DIR__"
# String. API endpoint of the S3 compatible service. # String. API endpoint of the S3 compatible service.
# Only required when running with the s3 storage backend. # Only required when running with the s3 storage backend.

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/superseriousbusiness/gotosocial/releases/download/v0.13.0/gotosocial_0.13.0_linux_386.tar.gz
SOURCE_SUM=0b75d0c2b55877f6f2c1a8a1d723aa1c868bee902a9689f3cde8410c8b680d89
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_EXTRACT=true
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=gotosocial_0.13.0_linux_386.tar.gz

View file

@ -8,8 +8,8 @@ Restart=on-failure
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__/ WorkingDirectory=__INSTALL_DIR__/
ExecStart=__FINALPATH__/gotosocial --config-path config.yaml server start ExecStart=__INSTALL_DIR__/gotosocial --config-path config.yaml server start
StandardOutput=append:/var/log/__APP__/__APP__.log StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit StandardError=inherit

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/superseriousbusiness/gotosocial/releases/download/v0.13.0/gotosocial_0.13.0_linux_amd64.tar.gz
SOURCE_SUM=fce2f2e3cb0af23542f1f15887cf967dedcae849971c56ee9ce4284a4593a70c
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_EXTRACT=true
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=gotosocial_0.13.0_linux_amd64.tar.gz

113
manifest.toml Normal file
View file

@ -0,0 +1,113 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "gotosocial"
name = "GoToSocial"
description.en = "Fast ActivityPub social network server written in Go"
description.fr = "Serveur de réseau social véloce basé sur ActivityPub écrit en Go"
version = "0.13.0~ynh1"
maintainers = ["OniriCorpe"]
[upstream]
license = "AGPL-3.0-only"
website = "https://gotosocial.org/"
demo = ""
admindoc = "https://docs.gotosocial.org/en/latest/"
userdoc = "https://docs.gotosocial.org/en/latest/"
code = "https://github.com/superseriousbusiness/gotosocial"
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 = ">= 11.2.6"
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"]
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, ...
[install]
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
[install.admin]
# this is a generic question - ask strings are automatically handled by Yunohost's core
help.en = "Must be in lower case and without special characters."
help.fr = "Doit être en minuscule et sans caractère special."
type = "string"
example = "johndoe"
[install.email]
ask.en = "The email adress of your admin account."
ask.fr = "L'adresse e-mail de votre compte admin."
type = "string"
example = "johndoe@example.com"
[install.password]
# this is a generic question - ask strings are automatically handled by Yunohost's core
help.en = "Must contain: upper case, lower case, number and special character."
help.fr = "Il doit contenir : majuscule, minuscule, chiffre et caractère spécial."
type = "password"
[install.accounts_registration_open]
ask.en = "Open registration?"
ask.fr = "Inscriptions ouvertes ?"
help.en = "Do you want people to be able to just submit sign up requests (true), or do you want invite only (false)?"
help.fr = "Voulez-vous que les gens puissent envoyer des demandes d'inscription (true) ou voulez-vous que les inscriptions soient uniquement sur invitation (false) ?"
type = "boolean"
default = false
[install.accounts_approval_required]
ask.en = "Registration approval?"
ask.fr = "Vérification manuelle des inscriptions ?"
help.en = "Do sign up requests require approval from an admin/moderator before an account can sign in/use the server?"
help.fr = "Les demandes d'inscription doivent-elles être approuvées par un-e administrateur-ice/modérateur-ice avant qu'un compte puisse se connecter et utiliser le serveur ?"
type = "boolean"
default = true
[install.accounts_reason_required]
ask.en = "Request registration reason?"
ask.fr = "Demande de motif pour les inscriptions ?"
help.en = "Are sign up requests required to submit a reason for the request (eg., an explanation of why they want to join the instance)?"
help.fr = "Les demandes d'inscription doivent-elles être accompagnée d'un motif (par exemple, une explication de la raison pour laquelle la personne veut rejoindre l'instance) ?"
type = "boolean"
default = true
[resources]
[resources.sources.main]
in_subdir = false
i386.url = "https://github.com/superseriousbusiness/gotosocial/releases/download/v0.13.0/gotosocial_0.13.0_linux_386.tar.gz"
i386.sha256 = "0b75d0c2b55877f6f2c1a8a1d723aa1c868bee902a9689f3cde8410c8b680d89"
amd64.url = "https://github.com/superseriousbusiness/gotosocial/releases/download/v0.13.0/gotosocial_0.13.0_linux_amd64.tar.gz"
amd64.sha256 = "fce2f2e3cb0af23542f1f15887cf967dedcae849971c56ee9ce4284a4593a70c"
armel.url = "https://github.com/superseriousbusiness/gotosocial/releases/download/v0.13.0/gotosocial_0.13.0_linux_armv6.tar.gz"
armel.sha256 = "9d67def302645987279ea76a64e72eda2d05318bd2aea42109dce097e65b2087"
arm64.url = "https://github.com/superseriousbusiness/gotosocial/releases/download/v0.13.0/gotosocial_0.13.0_linux_arm64.tar.gz"
arm64.sha256 = "cd93eb377ff86f241a3957fc81b08607b3df89bb70c3d857bb2ad107db917678"
armhf.url = "https://github.com/superseriousbusiness/gotosocial/releases/download/v0.13.0/gotosocial_0.13.0_linux_armv7.tar.gz"
armhf.sha256 = "2bff982d96333528d6479aef16d3686038a9d01f11c5043a536f2b7a463fd881"
[resources.system_user]
[resources.install_dir]
[resources.data_dir]
[resources.permissions]
main.url = "/"
[resources.ports]
main.default = 8095
[resources.apt]
packages = "postgresql, postgresql-contrib"
[resources.database]
type = "postgresql"

View file

@ -5,7 +5,7 @@
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app
pkg_dependencies="postgresql postgresql-contrib" #REMOVEME? pkg_dependencies="postgresql postgresql-contrib"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -14,27 +14,27 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script. ### Remove this function if there's nothing to clean before calling the remove script.
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..." #REMOVEME? ynh_print_info --message="Loading installation settings..."
app="$YNH_APP_INSTANCE_NAME" #REMOVEME? app="$YNH_APP_INSTANCE_NAME"
domain=$(ynh_app_setting_get --app="$app" --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app="$app" --key=domain)
db_name=$(ynh_app_setting_get --app="$app" --key=db_name) #REMOVEME? db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
final_path=$(ynh_app_setting_get --app="$app" --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app="$app" --key=install_dir)
datadir=$(ynh_app_setting_get --app="$app" --key=datadir) #REMOVEME? data_dir=$(ynh_app_setting_get --app="$app" --key=data_dir)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
@ -50,13 +50,13 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$final_path" ynh_backup --src_path="$install_dir"
#================================================= #=================================================
# BACKUP THE DATA DIR # BACKUP THE DATA DIR
#================================================= #=================================================
ynh_backup --src_path="$datadir" --is_big ynh_backup --src_path="$data_dir" --is_big
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION

View file

@ -13,37 +13,37 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script. ### Remove this function if there's nothing to clean before calling the remove script.
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
app="$YNH_APP_INSTANCE_NAME" #REMOVEME? app="$YNH_APP_INSTANCE_NAME"
landing_page_user="" landing_page_user=""
domain="$YNH_APP_ARG_DOMAIN" #REMOVEME? domain="$YNH_APP_ARG_DOMAIN"
path_url="/" path="/"
client_max_body_size="100M" client_max_body_size="100M"
admin="$YNH_APP_ARG_ADMIN" #REMOVEME? admin="$YNH_APP_ARG_ADMIN"
email="$YNH_APP_ARG_EMAIL" #REMOVEME? email="$YNH_APP_ARG_EMAIL"
password="$YNH_APP_ARG_PASSWORD" #REMOVEME? password="$YNH_APP_ARG_PASSWORD"
# Config stuff: # Config stuff:
cache_memory_target="100MiB" cache_memory_target="100MiB"
accounts_registration_open=$(convert_bool "$YNH_APP_ARG_ACCOUNTS_REGISTRATION_OPEN") #REMOVEME? accounts_registration_open=$(convert_bool "$YNH_APP_ARG_ACCOUNTS_REGISTRATION_OPEN")
accounts_approval_required=$(convert_bool "$YNH_APP_ARG_ACCOUNTS_APPROVAL_REQUIRED") #REMOVEME? accounts_approval_required=$(convert_bool "$YNH_APP_ARG_ACCOUNTS_APPROVAL_REQUIRED")
accounts_reason_required=$(convert_bool "$YNH_APP_ARG_ACCOUNTS_REASON_REQUIRED") #REMOVEME? accounts_reason_required=$(convert_bool "$YNH_APP_ARG_ACCOUNTS_REASON_REQUIRED")
accounts_allow_custom_css="false" accounts_allow_custom_css="false"
accounts_custom_css_length="10000" accounts_custom_css_length="10000"
@ -98,30 +98,30 @@ advanced_rate_limit_requests="300"
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1 #REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path="/var/www/$app" #REMOVEME? install_dir="/var/www/$app"
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" #REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
ynh_webpath_register --app="$app" --domain="$domain" --path_url="$path_url" #REMOVEME? ynh_webpath_register --app="$app" --domain="$domain" --path="$path"
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path" #REMOVEME? ynh_app_setting_set --app="$app" --key=install_dir --value="$install_dir"
ynh_app_setting_set --app="$app" --key=landing_page_user --value="$landing_page_user" ynh_app_setting_set --app="$app" --key=landing_page_user --value="$landing_page_user"
ynh_app_setting_set --app="$app" --key=domain --value="$domain" #REMOVEME? ynh_app_setting_set --app="$app" --key=domain --value="$domain"
ynh_app_setting_set --app="$app" --key=path_url --value="$path_url" #REMOVEME? ynh_app_setting_set --app="$app" --key=path --value="$path"
ynh_app_setting_set --app="$app" --key=client_max_body_size --value="$client_max_body_size" ynh_app_setting_set --app="$app" --key=client_max_body_size --value="$client_max_body_size"
ynh_app_setting_set --app="$app" --key=admin --value="$admin" #REMOVEME? ynh_app_setting_set --app="$app" --key=admin --value="$admin"
ynh_app_setting_set --app="$app" --key=email --value="$email" ynh_app_setting_set --app="$app" --key=email --value="$email"
ynh_app_setting_set --app="$app" --key=password --value="$password" #REMOVEME? ynh_app_setting_set --app="$app" --key=password --value="$password"
ynh_app_setting_set --app="$app" --key=cache_memory_target --value="$cache_memory_target" ynh_app_setting_set --app="$app" --key=cache_memory_target --value="$cache_memory_target"
@ -169,9 +169,9 @@ ynh_app_setting_set --app="$app" --key=oidc_client_secret --value="$oidc_client_
ynh_app_setting_set --app="$app" --key=oidc_client_secret --value="$oidc_link_existing" ynh_app_setting_set --app="$app" --key=oidc_client_secret --value="$oidc_link_existing"
ynh_app_setting_set --app="$app" --key=smtp_host --value="$smtp_host" ynh_app_setting_set --app="$app" --key=smtp_host --value="$smtp_host"
ynh_app_setting_set --app="$app" --key=smtp_port --value="$smtp_port" #REMOVEME? ynh_app_setting_set --app="$app" --key=smtp_port --value="$smtp_port"
ynh_app_setting_set --app="$app" --key=smtp_username --value="$smtp_username" ynh_app_setting_set --app="$app" --key=smtp_username --value="$smtp_username"
ynh_app_setting_set --app="$app" --key=smtp_password --value="$smtp_password" #REMOVEME? ynh_app_setting_set --app="$app" --key=smtp_password --value="$smtp_password"
ynh_app_setting_set --app="$app" --key=smtp_from --value="$smtp_from" ynh_app_setting_set --app="$app" --key=smtp_from --value="$smtp_from"
ynh_app_setting_set --app="$app" --key=smtp_disclose_recipients --value="$smtp_disclose_recipients" ynh_app_setting_set --app="$app" --key=smtp_disclose_recipients --value="$smtp_disclose_recipients"
@ -183,40 +183,40 @@ ynh_app_setting_set --app="$app" --key=advanced_rate_limit_requests --value="$ad
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Finding an available port..." --weight=1 #REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port # Find an available port
port=$(ynh_find_port --port=8095) #REMOVEME? port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app="$app" --key=port --value="$port" #REMOVEME? ynh_app_setting_set --app="$app" --key=port --value="$port"
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=5 #REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=5
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies" #REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." --weight=1 #REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user # Create a system user
ynh_system_user_create --username="$app" --home_dir="$final_path" #REMOVEME? ynh_system_user_create --username="$app" --home_dir="$install_dir"
#================================================= #=================================================
# CREATE A POSTGRESQL DATABASE # CREATE A POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=5 #REMOVEME? ynh_script_progression --message="Creating a PostgreSQL database..." --weight=5
db_name=$(ynh_sanitize_dbid --db_name="$app") #REMOVEME? db_name=$(ynh_sanitize_dbid --db_name="$app")
db_user="$db_name" #REMOVEME? db_user="$db_name"
db_pwd=$(ynh_string_random --length=30) #REMOVEME? db_pwd=$(ynh_string_random --length=30)
ynh_app_setting_set --app="$app" --key=db_name --value="$db_name" #REMOVEME? ynh_app_setting_set --app="$app" --key=db_name --value="$db_name"
ynh_app_setting_set --app="$app" --key=db_user --value="$db_user" #REMOVEME? ynh_app_setting_set --app="$app" --key=db_user --value="$db_user"
ynh_app_setting_set --app="$app" --key=db_pwd --value="$db_pwd" #REMOVEME? ynh_app_setting_set --app="$app" --key=db_pwd --value="$db_pwd"
ynh_psql_test_if_first_run #REMOVEME? ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd" #REMOVEME? ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -231,7 +231,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1
architecture=$(detect_arch) architecture=$(detect_arch)
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" ynh_setup_source --dest_dir="$install_dir"
# FIXME: this should be managed by the core in the future # FIXME: this should be managed by the core in the future
# Here, as a packager, you may have to tweak the ownerhsip/permissions # Here, as a packager, you may have to tweak the ownerhsip/permissions
@ -239,9 +239,9 @@ ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
# files in some cases. # files in some cases.
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder _ # But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder _
# this will be treated as a security issue. # this will be treated as a security issue.
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$final_path" chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -256,10 +256,10 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Creating a data directory..." --weight=1 ynh_script_progression --message="Creating a data directory..." --weight=1
datadir=/home/yunohost.app/$app #REMOVEME? data_dir=/home/yunohost.app/$app
ynh_app_setting_set --app="$app" --key=datadir --value="$datadir" #REMOVEME? ynh_app_setting_set --app="$app" --key=data_dir --value="$data_dir"
mkdir -p "$datadir" mkdir -p "$data_dir"
# FIXME: this should be managed by the core in the future # FIXME: this should be managed by the core in the future
# Here, as a packager, you may have to tweak the ownerhsip/permissions # Here, as a packager, you may have to tweak the ownerhsip/permissions
@ -267,22 +267,22 @@ mkdir -p "$datadir"
# files in some cases. # files in some cases.
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - # But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
# this will be treated as a security issue. # this will be treated as a security issue.
chmod 750 "$datadir" chmod 750 "$data_dir"
chmod -R o-rwx "$datadir" chmod -R o-rwx "$data_dir"
chown -R "$app:www-data" "$datadir" chown -R "$app:www-data" "$data_dir"
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="config.yaml" --destination="$final_path/config.yaml" ynh_add_config --template="config.yaml" --destination="$install_dir/config.yaml"
# FIXME: this should be handled by the core in the future # FIXME: this should be handled by the core in the future
# You may need to use chmod 600 instead of 400, # You may need to use chmod 600 instead of 400,
# for example if the app is expected to be able to modify its own config # for example if the app is expected to be able to modify its own config
chmod 400 "$final_path/config.yaml" chmod 400 "$install_dir/config.yaml"
chown "$app:$app" "$final_path/config.yaml" chown "$app:$app" "$install_dir/config.yaml"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -322,12 +322,12 @@ yunohost service add "$app" --description="Gotosocial server" --log="/var/log/$a
#================================================= #=================================================
ynh_script_progression --message="Creating gotosocial admin user..." --weight=1 ynh_script_progression --message="Creating gotosocial admin user..." --weight=1
# using "/var/www/$app" instead of "$final_path" as a temporary workaround for this bug: # using "/var/www/$app" instead of "$install_dir" as a temporary workaround for this bug:
# bad_ynh_exec_syntax() false positive: https://github.com/YunoHost/package_linter/issues/123 # bad_ynh_exec_syntax() false positive: https://github.com/YunoHost/package_linter/issues/123
ynh_exec_warn_less /var/www/"$app"/gotosocial --config-path "$final_path/config.yaml" admin account create --username "$admin" --email "$email" --password "$password" ynh_exec_warn_less /var/www/"$app"/gotosocial --config-path "$install_dir/config.yaml" admin account create --username "$admin" --email "$email" --password "$password"
ynh_exec_warn_less /var/www/"$app"/gotosocial --config-path "$final_path/config.yaml" admin account promote --username "$admin" ynh_exec_warn_less /var/www/"$app"/gotosocial --config-path "$install_dir/config.yaml" admin account promote --username "$admin"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -340,17 +340,17 @@ ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1 #REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
# Everyone can access the app. # Everyone can access the app.
ynh_permission_update --permission="main" --add="visitors" #REMOVEME? ynh_permission_update --permission="main" --add="visitors"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1 #REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -12,16 +12,16 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app="$YNH_APP_INSTANCE_NAME" #REMOVEME? app="$YNH_APP_INSTANCE_NAME"
domain=$(ynh_app_setting_get --app="$app" --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app="$app" --key=domain)
port=$(ynh_app_setting_get --app="$app" --key=port) #REMOVEME? port=$(ynh_app_setting_get --app="$app" --key=port)
db_name=$(ynh_app_setting_get --app="$app" --key=db_name) #REMOVEME? db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
db_user=$(ynh_app_setting_get --app="$app" --key=db_user) #REMOVEME? db_user=$(ynh_app_setting_get --app="$app" --key=db_user)
final_path=$(ynh_app_setting_get --app="$app" --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app="$app" --key=install_dir)
datadir=$(ynh_app_setting_get --app="$app" --key=datadir) #REMOVEME? data_dir=$(ynh_app_setting_get --app="$app" --key=data_dir)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -47,26 +47,26 @@ ynh_remove_systemd_config
#================================================= #=================================================
# REMOVE THE POSTGRESQL DATABASE # REMOVE THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=5 #REMOVEME? ynh_script_progression --message="Removing the PostgreSQL database..." --weight=5
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name" #REMOVEME? ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name"
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." --weight=5 #REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=5
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies #REMOVEME? ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1 #REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" #REMOVEME? ynh_secure_remove --file="$install_dir"
#================================================= #=================================================
# REMOVE APP DATA DIR # REMOVE APP DATA DIR
@ -74,7 +74,7 @@ ynh_secure_remove --file="$final_path"
ynh_script_progression --message="Removing app data directory..." --weight=1 ynh_script_progression --message="Removing app data directory..." --weight=1
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$datadir" #REMOVEME? ynh_secure_remove --file="$data_dir"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
@ -125,10 +125,10 @@ ynh_secure_remove --file="/var/log/$app"
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1 #REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user # Delete a system user
ynh_system_user_delete --username="$app" #REMOVEME? ynh_system_user_delete --username="$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -14,98 +14,98 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
#### Remove this function if there's nothing to clean before calling the remove script. #### Remove this function if there's nothing to clean before calling the remove script.
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app="$YNH_APP_INSTANCE_NAME" #REMOVEME? app="$YNH_APP_INSTANCE_NAME"
final_path=$(ynh_app_setting_get --app="$app" --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app="$app" --key=install_dir)
landing_page_user=$(ynh_app_setting_get --app="$app" --key=landing_page_user) #REMOVEME? landing_page_user=$(ynh_app_setting_get --app="$app" --key=landing_page_user)
domain=$(ynh_app_setting_get --app="$app" --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app="$app" --key=domain)
port=$(ynh_app_setting_get --app="$app" --key=port) #REMOVEME? port=$(ynh_app_setting_get --app="$app" --key=port)
path_url=$(ynh_app_setting_get --app="$app" --key=path_url) #REMOVEME? path=$(ynh_app_setting_get --app="$app" --key=path)
client_max_body_size=$(ynh_app_setting_get --app="$app" --key=client_max_body_size) #REMOVEME? client_max_body_size=$(ynh_app_setting_get --app="$app" --key=client_max_body_size)
db_name=$(ynh_app_setting_get --app="$app" --key=db_name) #REMOVEME? db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
db_user=$(ynh_app_setting_get --app="$app" --key=db_user) #REMOVEME? db_user=$(ynh_app_setting_get --app="$app" --key=db_user)
db_pwd=$(ynh_app_setting_get --app="$app" --key=db_pwd) #REMOVEME? db_pwd=$(ynh_app_setting_get --app="$app" --key=db_pwd)
datadir=$(ynh_app_setting_get --app="$app" --key=datadir) #REMOVEME? data_dir=$(ynh_app_setting_get --app="$app" --key=data_dir)
cache_memory_target=$(ynh_app_setting_get --app="$app" --key=cache_memory_target) #REMOVEME? cache_memory_target=$(ynh_app_setting_get --app="$app" --key=cache_memory_target)
instance_federation_mode=$(ynh_app_setting_get --app="$app" --key=instance_federation_mode) #REMOVEME? instance_federation_mode=$(ynh_app_setting_get --app="$app" --key=instance_federation_mode)
instance_expose_peers=$(ynh_app_setting_get --app="$app" --key=instance_expose_peers) #REMOVEME? instance_expose_peers=$(ynh_app_setting_get --app="$app" --key=instance_expose_peers)
instance_expose_suspended=$(ynh_app_setting_get --app="$app" --key=instance_expose_suspended) #REMOVEME? instance_expose_suspended=$(ynh_app_setting_get --app="$app" --key=instance_expose_suspended)
instance_expose_suspended_web=$(ynh_app_setting_get --app="$app" --key=instance_expose_suspended_web) #REMOVEME? instance_expose_suspended_web=$(ynh_app_setting_get --app="$app" --key=instance_expose_suspended_web)
instance_expose_public_timeline=$(ynh_app_setting_get --app="$app" --key=instance_expose_public_timeline) #REMOVEME? instance_expose_public_timeline=$(ynh_app_setting_get --app="$app" --key=instance_expose_public_timeline)
instance_deliver_to_shared_inboxes=$(ynh_app_setting_get --app="$app" --key=instance_deliver_to_shared_inboxes) #REMOVEME? instance_deliver_to_shared_inboxes=$(ynh_app_setting_get --app="$app" --key=instance_deliver_to_shared_inboxes)
instance_inject_mastodon_version=$(ynh_app_setting_get --app="$app" --key=instance_inject_mastodon_version) #REMOVEME? instance_inject_mastodon_version=$(ynh_app_setting_get --app="$app" --key=instance_inject_mastodon_version)
accounts_registration_open=$(ynh_app_setting_get --app="$app" --key=accounts_registration_open) #REMOVEME? accounts_registration_open=$(ynh_app_setting_get --app="$app" --key=accounts_registration_open)
accounts_approval_required=$(ynh_app_setting_get --app="$app" --key=accounts_approval_required) #REMOVEME? accounts_approval_required=$(ynh_app_setting_get --app="$app" --key=accounts_approval_required)
accounts_reason_required=$(ynh_app_setting_get --app="$app" --key=accounts_reason_required) #REMOVEME? accounts_reason_required=$(ynh_app_setting_get --app="$app" --key=accounts_reason_required)
accounts_allow_custom_css=$(ynh_app_setting_get --app="$app" --key=accounts_allow_custom_css) #REMOVEME? accounts_allow_custom_css=$(ynh_app_setting_get --app="$app" --key=accounts_allow_custom_css)
accounts_custom_css_length=$(ynh_app_setting_get --app="$app" --key=accounts_custom_css_length) #REMOVEME? accounts_custom_css_length=$(ynh_app_setting_get --app="$app" --key=accounts_custom_css_length)
media_image_max_size=$(ynh_app_setting_get --app="$app" --key=media_image_max_size) #REMOVEME? media_image_max_size=$(ynh_app_setting_get --app="$app" --key=media_image_max_size)
media_video_max_size=$(ynh_app_setting_get --app="$app" --key=media_video_max_size) #REMOVEME? media_video_max_size=$(ynh_app_setting_get --app="$app" --key=media_video_max_size)
media_description_min_chars=$(ynh_app_setting_get --app="$app" --key=media_description_min_chars) #REMOVEME? media_description_min_chars=$(ynh_app_setting_get --app="$app" --key=media_description_min_chars)
media_description_max_chars=$(ynh_app_setting_get --app="$app" --key=media_description_max_chars) #REMOVEME? media_description_max_chars=$(ynh_app_setting_get --app="$app" --key=media_description_max_chars)
media_remote_cache_days=$(ynh_app_setting_get --app="$app" --key=media_remote_cache_days) #REMOVEME? media_remote_cache_days=$(ynh_app_setting_get --app="$app" --key=media_remote_cache_days)
media_emoji_local_max_size=$(ynh_app_setting_get --app="$app" --key=media_emoji_local_max_size) #REMOVEME? media_emoji_local_max_size=$(ynh_app_setting_get --app="$app" --key=media_emoji_local_max_size)
media_emoji_remote_max_size=$(ynh_app_setting_get --app="$app" --key=media_emoji_remote_max_size) #REMOVEME? media_emoji_remote_max_size=$(ynh_app_setting_get --app="$app" --key=media_emoji_remote_max_size)
storage_backend=$(ynh_app_setting_get --app="$app" --key=storage_backend) #REMOVEME? storage_backend=$(ynh_app_setting_get --app="$app" --key=storage_backend)
storage_s3_endpoint=$(ynh_app_setting_get --app="$app" --key=storage_s3_endpoint) #REMOVEME? storage_s3_endpoint=$(ynh_app_setting_get --app="$app" --key=storage_s3_endpoint)
storage_s3_proxy=$(ynh_app_setting_get --app="$app" --key=storage_s3_proxy) #REMOVEME? storage_s3_proxy=$(ynh_app_setting_get --app="$app" --key=storage_s3_proxy)
storage_s3_access_key=$(ynh_app_setting_get --app="$app" --key=storage_s3_access_key) #REMOVEME? storage_s3_access_key=$(ynh_app_setting_get --app="$app" --key=storage_s3_access_key)
storage_s3_secret_key=$(ynh_app_setting_get --app="$app" --key=storage_s3_secret_key) #REMOVEME? storage_s3_secret_key=$(ynh_app_setting_get --app="$app" --key=storage_s3_secret_key)
storage_s3_bucket=$(ynh_app_setting_get --app="$app" --key=storage_s3_bucket) #REMOVEME? storage_s3_bucket=$(ynh_app_setting_get --app="$app" --key=storage_s3_bucket)
statuses_max_chars=$(ynh_app_setting_get --app="$app" --key=statuses_max_chars) #REMOVEME? statuses_max_chars=$(ynh_app_setting_get --app="$app" --key=statuses_max_chars)
statuses_cw_max_chars=$(ynh_app_setting_get --app="$app" --key=statuses_cw_max_chars) #REMOVEME? statuses_cw_max_chars=$(ynh_app_setting_get --app="$app" --key=statuses_cw_max_chars)
statuses_poll_max_options=$(ynh_app_setting_get --app="$app" --key=statuses_poll_max_options) #REMOVEME? statuses_poll_max_options=$(ynh_app_setting_get --app="$app" --key=statuses_poll_max_options)
statuses_poll_option_max_chars=$(ynh_app_setting_get --app="$app" --key=statuses_poll_option_max_chars) #REMOVEME? statuses_poll_option_max_chars=$(ynh_app_setting_get --app="$app" --key=statuses_poll_option_max_chars)
statuses_media_max_files=$(ynh_app_setting_get --app="$app" --key=statuses_media_max_files) #REMOVEME? statuses_media_max_files=$(ynh_app_setting_get --app="$app" --key=statuses_media_max_files)
oidc_enabled=$(ynh_app_setting_get --app="$app" --key=oidc_enabled) #REMOVEME? oidc_enabled=$(ynh_app_setting_get --app="$app" --key=oidc_enabled)
oidc_idp_name=$(ynh_app_setting_get --app="$app" --key=oidc_idp_name) #REMOVEME? oidc_idp_name=$(ynh_app_setting_get --app="$app" --key=oidc_idp_name)
oidc_skip_verification=$(ynh_app_setting_get --app="$app" --key=oidc_skip_verification) #REMOVEME? oidc_skip_verification=$(ynh_app_setting_get --app="$app" --key=oidc_skip_verification)
oidc_issuer=$(ynh_app_setting_get --app="$app" --key=oidc_issuer) #REMOVEME? oidc_issuer=$(ynh_app_setting_get --app="$app" --key=oidc_issuer)
oidc_client_id=$(ynh_app_setting_get --app="$app" --key=oidc_client_id) #REMOVEME? oidc_client_id=$(ynh_app_setting_get --app="$app" --key=oidc_client_id)
oidc_client_secret=$(ynh_app_setting_get --app="$app" --key=oidc_client_secret) #REMOVEME? oidc_client_secret=$(ynh_app_setting_get --app="$app" --key=oidc_client_secret)
oidc_link_existing=$(ynh_app_setting_get --app="$app" --key=oidc_link_existing) #REMOVEME? oidc_link_existing=$(ynh_app_setting_get --app="$app" --key=oidc_link_existing)
smtp_host=$(ynh_app_setting_get --app="$app" --key=smtp_host) #REMOVEME? smtp_host=$(ynh_app_setting_get --app="$app" --key=smtp_host)
smtp_port=$(ynh_app_setting_get --app="$app" --key=smtp_port) #REMOVEME? smtp_port=$(ynh_app_setting_get --app="$app" --key=smtp_port)
smtp_username=$(ynh_app_setting_get --app="$app" --key=smtp_username) #REMOVEME? smtp_username=$(ynh_app_setting_get --app="$app" --key=smtp_username)
smtp_password=$(ynh_app_setting_get --app="$app" --key=smtp_password) #REMOVEME? smtp_password=$(ynh_app_setting_get --app="$app" --key=smtp_password)
smtp_from=$(ynh_app_setting_get --app="$app" --key=smtp_from) #REMOVEME? smtp_from=$(ynh_app_setting_get --app="$app" --key=smtp_from)
smtp_disclose_recipients=$(ynh_app_setting_get --app="$app" --key=smtp_disclose_recipients) #REMOVEME? smtp_disclose_recipients=$(ynh_app_setting_get --app="$app" --key=smtp_disclose_recipients)
advanced_cookies_samesite=$(ynh_app_setting_get --app="$app" --key=advanced_cookies_samesite) #REMOVEME? advanced_cookies_samesite=$(ynh_app_setting_get --app="$app" --key=advanced_cookies_samesite)
advanced_rate_limit_requests=$(ynh_app_setting_get --app="$app" --key=advanced_rate_limit_requests) #REMOVEME? advanced_rate_limit_requests=$(ynh_app_setting_get --app="$app" --key=advanced_rate_limit_requests)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1 #REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d "$final_path" \ #REMOVEME? test ! -d "$install_dir" \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $install_dir "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
@ -119,17 +119,17 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 #REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username="$app" --home_dir="$final_path" #REMOVEME? ynh_system_user_create --username="$app" --home_dir="$install_dir"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$install_dir"
# FIXME: this should be managed by the core in the future # FIXME: this should be managed by the core in the future
# Here, as a packager, you may have to tweak the ownerhsip/permissions # Here, as a packager, you may have to tweak the ownerhsip/permissions
@ -137,18 +137,18 @@ ynh_restore_file --origin_path="$final_path"
# files in some cases. # files in some cases.
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - # But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
# this will be treated as a security issue. # this will be treated as a security issue.
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$final_path" chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# RESTORE THE DATA DIRECTORY # RESTORE THE DATA DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=5 ynh_script_progression --message="Restoring the data directory..." --weight=5
ynh_restore_file --origin_path="$datadir" --not_mandatory ynh_restore_file --origin_path="$data_dir" --not_mandatory
mkdir -p "$datadir" mkdir -p "$data_dir"
# FIXME: this should be managed by the core in the future # FIXME: this should be managed by the core in the future
# Here, as a packager, you may have to tweak the ownerhsip/permissions # Here, as a packager, you may have to tweak the ownerhsip/permissions
@ -156,27 +156,27 @@ mkdir -p "$datadir"
# files in some cases. # files in some cases.
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - # But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
# this will be treated as a security issue. # this will be treated as a security issue.
chmod 750 "$datadir" chmod 750 "$data_dir"
chmod -R o-rwx "$datadir" chmod -R o-rwx "$data_dir"
chown -R "$app:www-data" "$datadir" chown -R "$app:www-data" "$data_dir"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=5 #REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=5
# Define and install dependencies # Define and install dependencies
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies" #REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# RESTORE THE POSTGRESQL DATABASE # RESTORE THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=5 #REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=5
ynh_psql_test_if_first_run #REMOVEME? ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd" #REMOVEME? ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd"
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database="$db_name" ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database="$db_name"
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database="$db_name" ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database="$db_name"
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS citext;" --database="$db_name" ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS citext;" --database="$db_name"
@ -197,12 +197,12 @@ architecture="$(detect_arch)"
# compare if the system arch is different from the binary arch # compare if the system arch is different from the binary arch
# if so, download the correct binary # if so, download the correct binary
if [ "$architecture" != "$(file "$final_path"/gotosocial | cut -d ',' -f 2 | tr -d ' ')" ] if [ "$architecture" != "$(file "$install_dir"/gotosocial | cut -d ',' -f 2 | tr -d ' ')" ]
then then
ynh_script_progression --message="Migrating binary architecture..." ynh_script_progression --message="Migrating binary architecture..."
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" --keep="config.yaml" ynh_setup_source --dest_dir="$install_dir" --keep="config.yaml"
fi fi
# FIXME: this should be managed by the core in the future # FIXME: this should be managed by the core in the future
@ -211,9 +211,9 @@ fi
# files in some cases. # files in some cases.
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder _ # But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder _
# this will be treated as a security issue. # this will be treated as a security issue.
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$final_path" chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# RESTORE VARIOUS FILES # RESTORE VARIOUS FILES

View file

@ -12,80 +12,80 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." #REMOVEME? ynh_script_progression --message="Loading installation settings..."
app="$YNH_APP_INSTANCE_NAME" #REMOVEME? app="$YNH_APP_INSTANCE_NAME"
final_path=$(ynh_app_setting_get --app="$app" --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app="$app" --key=install_dir)
landing_page_user=$(ynh_app_setting_get --app="$app" --key=landing_page_user) #REMOVEME? landing_page_user=$(ynh_app_setting_get --app="$app" --key=landing_page_user)
domain=$(ynh_app_setting_get --app="$app" --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app="$app" --key=domain)
port=$(ynh_app_setting_get --app="$app" --key=port) #REMOVEME? port=$(ynh_app_setting_get --app="$app" --key=port)
path_url=$(ynh_app_setting_get --app="$app" --key=path_url) #REMOVEME? path=$(ynh_app_setting_get --app="$app" --key=path)
client_max_body_size=$(ynh_app_setting_get --app="$app" --key=client_max_body_size) #REMOVEME? client_max_body_size=$(ynh_app_setting_get --app="$app" --key=client_max_body_size)
db_name=$(ynh_app_setting_get --app="$app" --key=db_name) #REMOVEME? db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
db_user=$(ynh_app_setting_get --app="$app" --key=db_user) #REMOVEME? db_user=$(ynh_app_setting_get --app="$app" --key=db_user)
db_pwd=$(ynh_app_setting_get --app="$app" --key=db_pwd) #REMOVEME? db_pwd=$(ynh_app_setting_get --app="$app" --key=db_pwd)
datadir=$(ynh_app_setting_get --app="$app" --key=datadir) #REMOVEME? data_dir=$(ynh_app_setting_get --app="$app" --key=data_dir)
cache_memory_target=$(ynh_app_setting_get --app="$app" --key=cache_memory_target) #REMOVEME? cache_memory_target=$(ynh_app_setting_get --app="$app" --key=cache_memory_target)
instance_federation_mode=$(ynh_app_setting_get --app="$app" --key=instance_federation_mode) #REMOVEME? instance_federation_mode=$(ynh_app_setting_get --app="$app" --key=instance_federation_mode)
instance_expose_peers=$(ynh_app_setting_get --app="$app" --key=instance_expose_peers) #REMOVEME? instance_expose_peers=$(ynh_app_setting_get --app="$app" --key=instance_expose_peers)
instance_expose_suspended=$(ynh_app_setting_get --app="$app" --key=instance_expose_suspended) #REMOVEME? instance_expose_suspended=$(ynh_app_setting_get --app="$app" --key=instance_expose_suspended)
instance_expose_suspended_web=$(ynh_app_setting_get --app="$app" --key=instance_expose_suspended_web) #REMOVEME? instance_expose_suspended_web=$(ynh_app_setting_get --app="$app" --key=instance_expose_suspended_web)
instance_expose_public_timeline=$(ynh_app_setting_get --app="$app" --key=instance_expose_public_timeline) #REMOVEME? instance_expose_public_timeline=$(ynh_app_setting_get --app="$app" --key=instance_expose_public_timeline)
instance_deliver_to_shared_inboxes=$(ynh_app_setting_get --app="$app" --key=instance_deliver_to_shared_inboxes) #REMOVEME? instance_deliver_to_shared_inboxes=$(ynh_app_setting_get --app="$app" --key=instance_deliver_to_shared_inboxes)
instance_inject_mastodon_version=$(ynh_app_setting_get --app="$app" --key=instance_inject_mastodon_version) #REMOVEME? instance_inject_mastodon_version=$(ynh_app_setting_get --app="$app" --key=instance_inject_mastodon_version)
accounts_registration_open=$(ynh_app_setting_get --app="$app" --key=accounts_registration_open) #REMOVEME? accounts_registration_open=$(ynh_app_setting_get --app="$app" --key=accounts_registration_open)
accounts_approval_required=$(ynh_app_setting_get --app="$app" --key=accounts_approval_required) #REMOVEME? accounts_approval_required=$(ynh_app_setting_get --app="$app" --key=accounts_approval_required)
accounts_reason_required=$(ynh_app_setting_get --app="$app" --key=accounts_reason_required) #REMOVEME? accounts_reason_required=$(ynh_app_setting_get --app="$app" --key=accounts_reason_required)
accounts_allow_custom_css=$(ynh_app_setting_get --app="$app" --key=accounts_allow_custom_css) #REMOVEME? accounts_allow_custom_css=$(ynh_app_setting_get --app="$app" --key=accounts_allow_custom_css)
accounts_custom_css_length=$(ynh_app_setting_get --app="$app" --key=accounts_custom_css_length) #REMOVEME? accounts_custom_css_length=$(ynh_app_setting_get --app="$app" --key=accounts_custom_css_length)
media_image_max_size=$(ynh_app_setting_get --app="$app" --key=media_image_max_size) #REMOVEME? media_image_max_size=$(ynh_app_setting_get --app="$app" --key=media_image_max_size)
media_video_max_size=$(ynh_app_setting_get --app="$app" --key=media_video_max_size) #REMOVEME? media_video_max_size=$(ynh_app_setting_get --app="$app" --key=media_video_max_size)
media_description_min_chars=$(ynh_app_setting_get --app="$app" --key=media_description_min_chars) #REMOVEME? media_description_min_chars=$(ynh_app_setting_get --app="$app" --key=media_description_min_chars)
media_description_max_chars=$(ynh_app_setting_get --app="$app" --key=media_description_max_chars) #REMOVEME? media_description_max_chars=$(ynh_app_setting_get --app="$app" --key=media_description_max_chars)
media_remote_cache_days=$(ynh_app_setting_get --app="$app" --key=media_remote_cache_days) #REMOVEME? media_remote_cache_days=$(ynh_app_setting_get --app="$app" --key=media_remote_cache_days)
media_emoji_local_max_size=$(ynh_app_setting_get --app="$app" --key=media_emoji_local_max_size) #REMOVEME? media_emoji_local_max_size=$(ynh_app_setting_get --app="$app" --key=media_emoji_local_max_size)
media_emoji_remote_max_size=$(ynh_app_setting_get --app="$app" --key=media_emoji_remote_max_size) #REMOVEME? media_emoji_remote_max_size=$(ynh_app_setting_get --app="$app" --key=media_emoji_remote_max_size)
storage_backend=$(ynh_app_setting_get --app="$app" --key=storage_backend) #REMOVEME? storage_backend=$(ynh_app_setting_get --app="$app" --key=storage_backend)
storage_s3_endpoint=$(ynh_app_setting_get --app="$app" --key=storage_s3_endpoint) #REMOVEME? storage_s3_endpoint=$(ynh_app_setting_get --app="$app" --key=storage_s3_endpoint)
storage_s3_proxy=$(ynh_app_setting_get --app="$app" --key=storage_s3_proxy) #REMOVEME? storage_s3_proxy=$(ynh_app_setting_get --app="$app" --key=storage_s3_proxy)
storage_s3_access_key=$(ynh_app_setting_get --app="$app" --key=storage_s3_access_key) #REMOVEME? storage_s3_access_key=$(ynh_app_setting_get --app="$app" --key=storage_s3_access_key)
storage_s3_secret_key=$(ynh_app_setting_get --app="$app" --key=storage_s3_secret_key) #REMOVEME? storage_s3_secret_key=$(ynh_app_setting_get --app="$app" --key=storage_s3_secret_key)
storage_s3_bucket=$(ynh_app_setting_get --app="$app" --key=storage_s3_bucket) #REMOVEME? storage_s3_bucket=$(ynh_app_setting_get --app="$app" --key=storage_s3_bucket)
statuses_max_chars=$(ynh_app_setting_get --app="$app" --key=statuses_max_chars) #REMOVEME? statuses_max_chars=$(ynh_app_setting_get --app="$app" --key=statuses_max_chars)
statuses_cw_max_chars=$(ynh_app_setting_get --app="$app" --key=statuses_cw_max_chars) #REMOVEME? statuses_cw_max_chars=$(ynh_app_setting_get --app="$app" --key=statuses_cw_max_chars)
statuses_poll_max_options=$(ynh_app_setting_get --app="$app" --key=statuses_poll_max_options) #REMOVEME? statuses_poll_max_options=$(ynh_app_setting_get --app="$app" --key=statuses_poll_max_options)
statuses_poll_option_max_chars=$(ynh_app_setting_get --app="$app" --key=statuses_poll_option_max_chars) #REMOVEME? statuses_poll_option_max_chars=$(ynh_app_setting_get --app="$app" --key=statuses_poll_option_max_chars)
statuses_media_max_files=$(ynh_app_setting_get --app="$app" --key=statuses_media_max_files) #REMOVEME? statuses_media_max_files=$(ynh_app_setting_get --app="$app" --key=statuses_media_max_files)
oidc_enabled=$(ynh_app_setting_get --app="$app" --key=oidc_enabled) #REMOVEME? oidc_enabled=$(ynh_app_setting_get --app="$app" --key=oidc_enabled)
oidc_idp_name=$(ynh_app_setting_get --app="$app" --key=oidc_idp_name) #REMOVEME? oidc_idp_name=$(ynh_app_setting_get --app="$app" --key=oidc_idp_name)
oidc_skip_verification=$(ynh_app_setting_get --app="$app" --key=oidc_skip_verification) #REMOVEME? oidc_skip_verification=$(ynh_app_setting_get --app="$app" --key=oidc_skip_verification)
oidc_issuer=$(ynh_app_setting_get --app="$app" --key=oidc_issuer) #REMOVEME? oidc_issuer=$(ynh_app_setting_get --app="$app" --key=oidc_issuer)
oidc_client_id=$(ynh_app_setting_get --app="$app" --key=oidc_client_id) #REMOVEME? oidc_client_id=$(ynh_app_setting_get --app="$app" --key=oidc_client_id)
oidc_client_secret=$(ynh_app_setting_get --app="$app" --key=oidc_client_secret) #REMOVEME? oidc_client_secret=$(ynh_app_setting_get --app="$app" --key=oidc_client_secret)
oidc_link_existing=$(ynh_app_setting_get --app="$app" --key=oidc_link_existing) #REMOVEME? oidc_link_existing=$(ynh_app_setting_get --app="$app" --key=oidc_link_existing)
smtp_host=$(ynh_app_setting_get --app="$app" --key=smtp_host) #REMOVEME? smtp_host=$(ynh_app_setting_get --app="$app" --key=smtp_host)
smtp_port=$(ynh_app_setting_get --app="$app" --key=smtp_port) #REMOVEME? smtp_port=$(ynh_app_setting_get --app="$app" --key=smtp_port)
smtp_username=$(ynh_app_setting_get --app="$app" --key=smtp_username) #REMOVEME? smtp_username=$(ynh_app_setting_get --app="$app" --key=smtp_username)
smtp_password=$(ynh_app_setting_get --app="$app" --key=smtp_password) #REMOVEME? smtp_password=$(ynh_app_setting_get --app="$app" --key=smtp_password)
smtp_from=$(ynh_app_setting_get --app="$app" --key=smtp_from) #REMOVEME? smtp_from=$(ynh_app_setting_get --app="$app" --key=smtp_from)
smtp_disclose_recipients=$(ynh_app_setting_get --app="$app" --key=smtp_disclose_recipients) #REMOVEME? smtp_disclose_recipients=$(ynh_app_setting_get --app="$app" --key=smtp_disclose_recipients)
advanced_cookies_samesite=$(ynh_app_setting_get --app="$app" --key=advanced_cookies_samesite) #REMOVEME? advanced_cookies_samesite=$(ynh_app_setting_get --app="$app" --key=advanced_cookies_samesite)
advanced_rate_limit_requests=$(ynh_app_setting_get --app="$app" --key=advanced_rate_limit_requests) #REMOVEME? advanced_rate_limit_requests=$(ynh_app_setting_get --app="$app" --key=advanced_rate_limit_requests)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -102,16 +102,16 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." #REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade #REMOVEME? ynh_backup_before_upgrade
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup #REMOVEME? ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
@ -131,9 +131,9 @@ ynh_script_progression --message="Ensuring downward compatibility..."
if ynh_compare_current_package_version --comparison lt --version 0.2.1~ynh4 || [ -z "$db_user" ] if ynh_compare_current_package_version --comparison lt --version 0.2.1~ynh4 || [ -z "$db_user" ]
then then
# import old parameters # import old parameters
registration_open=$(ynh_app_setting_get --app="$app" --key=registration_open) #REMOVEME? registration_open=$(ynh_app_setting_get --app="$app" --key=registration_open)
registration_approval=$(ynh_app_setting_get --app="$app" --key=registration_approval) #REMOVEME? registration_approval=$(ynh_app_setting_get --app="$app" --key=registration_approval)
registration_reason=$(ynh_app_setting_get --app="$app" --key=registration_reason) #REMOVEME? registration_reason=$(ynh_app_setting_get --app="$app" --key=registration_reason)
# declaration of new parameters # declaration of new parameters
client_max_body_size="100M" client_max_body_size="100M"
media_image_max_size="2097152" media_image_max_size="2097152"
@ -152,7 +152,7 @@ then
registration_reason=$(convert_bool "$registration_reason") registration_reason=$(convert_bool "$registration_reason")
# fix db_user existence # fix db_user existence
db_user=$db_name db_user=$db_name
ynh_app_setting_set --app="$app" --key=db_user --value="$db_user" #REMOVEME? ynh_app_setting_set --app="$app" --key=db_user --value="$db_user"
# registration of new parameters # registration of new parameters
ynh_app_setting_set --app="$app" --key=client_max_body_size --value="$client_max_body_size" ynh_app_setting_set --app="$app" --key=client_max_body_size --value="$client_max_body_size"
ynh_app_setting_set --app="$app" --key=media_image_max_size --value="$media_image_max_size" ynh_app_setting_set --app="$app" --key=media_image_max_size --value="$media_image_max_size"
@ -175,9 +175,9 @@ fi
if ynh_compare_current_package_version --comparison lt --version 0.3.7~ynh1 || [ -z "$instance_expose_peers" ] if ynh_compare_current_package_version --comparison lt --version 0.3.7~ynh1 || [ -z "$instance_expose_peers" ]
then then
# import old parameters # import old parameters
registration_open=$(ynh_app_setting_get --app="$app" --key=registration_open) #REMOVEME? registration_open=$(ynh_app_setting_get --app="$app" --key=registration_open)
registration_approval=$(ynh_app_setting_get --app="$app" --key=registration_approval) #REMOVEME? registration_approval=$(ynh_app_setting_get --app="$app" --key=registration_approval)
registration_reason=$(ynh_app_setting_get --app="$app" --key=registration_reason) #REMOVEME? registration_reason=$(ynh_app_setting_get --app="$app" --key=registration_reason)
# declaration of new parameters # declaration of new parameters
instance_expose_peers="false" instance_expose_peers="false"
instance_expose_suspended="false" instance_expose_suspended="false"
@ -270,9 +270,9 @@ then
smtp_disclose_recipients="false" smtp_disclose_recipients="false"
# registration of parameters # registration of parameters
ynh_app_setting_set --app="$app" --key=smtp_host --value="$smtp_host" ynh_app_setting_set --app="$app" --key=smtp_host --value="$smtp_host"
ynh_app_setting_set --app="$app" --key=smtp_port --value="$smtp_port" #REMOVEME? ynh_app_setting_set --app="$app" --key=smtp_port --value="$smtp_port"
ynh_app_setting_set --app="$app" --key=smtp_username --value="$smtp_username" ynh_app_setting_set --app="$app" --key=smtp_username --value="$smtp_username"
ynh_app_setting_set --app="$app" --key=smtp_password --value="$smtp_password" #REMOVEME? ynh_app_setting_set --app="$app" --key=smtp_password --value="$smtp_password"
ynh_app_setting_set --app="$app" --key=smtp_from --value="$smtp_from" ynh_app_setting_set --app="$app" --key=smtp_from --value="$smtp_from"
ynh_app_setting_set --app="$app" --key=smtp_disclose_recipients --value="$smtp_disclose_recipients" ynh_app_setting_set --app="$app" --key=smtp_disclose_recipients --value="$smtp_disclose_recipients"
fi fi
@ -281,10 +281,10 @@ fi
if ynh_compare_current_package_version --comparison lt --version 0.8.0~ynh3 if ynh_compare_current_package_version --comparison lt --version 0.8.0~ynh3
then then
# get settings from problem key # get settings from problem key
allow_custom_css=$(ynh_app_setting_get --app="$app" --key=allow_custom_css) #REMOVEME? allow_custom_css=$(ynh_app_setting_get --app="$app" --key=allow_custom_css)
approval_required=$(ynh_app_setting_get --app="$app" --key=approval_required) #REMOVEME? approval_required=$(ynh_app_setting_get --app="$app" --key=approval_required)
reason_required=$(ynh_app_setting_get --app="$app" --key=reason_required) #REMOVEME? reason_required=$(ynh_app_setting_get --app="$app" --key=reason_required)
registration_open=$(ynh_app_setting_get --app="$app" --key=registration_open) #REMOVEME? registration_open=$(ynh_app_setting_get --app="$app" --key=registration_open)
# apply setting to correct key if set on old key # apply setting to correct key if set on old key
if [ -n "$allow_custom_css" ] if [ -n "$allow_custom_css" ]
then then
@ -368,10 +368,10 @@ fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." #REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username="$app" --home_dir="$final_path" #REMOVEME? ynh_system_user_create --username="$app" --home_dir="$install_dir"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -385,7 +385,7 @@ then
architecture=$(detect_arch) architecture=$(detect_arch)
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" --keep="config.yaml" ynh_setup_source --dest_dir="$install_dir" --keep="config.yaml"
fi fi
# FIXME: this should be managed by the core in the future # FIXME: this should be managed by the core in the future
@ -394,9 +394,9 @@ fi
# files in some cases. # files in some cases.
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - # But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
# this will be treated as a security issue. # this will be treated as a security issue.
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$final_path" chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -409,9 +409,9 @@ ynh_add_nginx_config
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." #REMOVEME? ynh_script_progression --message="Upgrading dependencies..."
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies" #REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
@ -423,13 +423,13 @@ ynh_script_progression --message="Updating a configuration file..."
### The file will automatically be backed-up if it's found to be manually modified (because ### The file will automatically be backed-up if it's found to be manually modified (because
### ynh_add_config keeps track of the file's checksum) ### ynh_add_config keeps track of the file's checksum)
ynh_add_config --template="config.yaml" --destination="$final_path/config.yaml" ynh_add_config --template="config.yaml" --destination="$install_dir/config.yaml"
# FIXME: this should be handled by the core in the future # FIXME: this should be handled by the core in the future
# You may need to use chmod 600 instead of 400, # You may need to use chmod 600 instead of 400,
# for example if the app is expected to be able to modify its own config # for example if the app is expected to be able to modify its own config
chmod 400 "$final_path/config.yaml" chmod 400 "$install_dir/config.yaml"
chown "$app:$app" "$final_path/config.yaml" chown "$app:$app" "$install_dir/config.yaml"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -474,9 +474,9 @@ ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." #REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT