mirror of
https://github.com/YunoHost-Apps/gotosocial_ynh.git
synced 2024-09-03 19:16:06 +02:00
Revert "Revert "quoting all variables""
This reverts commit 8e6ac9dc1c
.
This commit is contained in:
parent
96c01e75f6
commit
d69f7b019e
5 changed files with 146 additions and 146 deletions
|
@ -26,15 +26,15 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Loading installation settings..."
|
ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app="$YNH_APP_INSTANCE_NAME"
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||||
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
datadir=$(ynh_app_setting_get --app="$app" --key=datadir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
|
|
@ -24,22 +24,22 @@ ynh_abort_if_errors
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app="$YNH_APP_INSTANCE_NAME"
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain="$YNH_APP_ARG_DOMAIN"
|
||||||
path_url="/"
|
path_url="/"
|
||||||
|
|
||||||
client_max_body_size="100M"
|
client_max_body_size="100M"
|
||||||
|
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin="$YNH_APP_ARG_ADMIN"
|
||||||
email=$YNH_APP_ARG_EMAIL
|
email="$YNH_APP_ARG_EMAIL"
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
password="$YNH_APP_ARG_PASSWORD"
|
||||||
|
|
||||||
# Config stuff:
|
# Config stuff:
|
||||||
|
|
||||||
registration_open=$(convert_bool $YNH_APP_ARG_REGISTRATION_OPEN)
|
registration_open=$(convert_bool "$YNH_APP_ARG_REGISTRATION_OPEN")
|
||||||
registration_approval=$(convert_bool $YNH_APP_ARG_REGISTRATION_APPROVAL)
|
registration_approval=$(convert_bool "$YNH_APP_ARG_REGISTRATION_APPROVAL")
|
||||||
registration_reason=$(convert_bool $YNH_APP_ARG_REGISTRATION_REASON)
|
registration_reason=$(convert_bool "$YNH_APP_ARG_REGISTRATION_REASON")
|
||||||
|
|
||||||
media_image_max_size="2097152"
|
media_image_max_size="2097152"
|
||||||
media_video_max_size="10485760"
|
media_video_max_size="10485760"
|
||||||
|
@ -59,42 +59,42 @@ statuses_media_max_files="6"
|
||||||
|
|
||||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
|
|
||||||
final_path=/var/www/$app
|
final_path="/var/www/$app"
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
ynh_webpath_register --app="$app" --domain="$domain" --path_url="$path_url"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
ynh_app_setting_set --app="$app" --key=domain --value="$domain"
|
||||||
ynh_app_setting_set --app=$app --key=path_url --value=$path_url
|
ynh_app_setting_set --app="$app" --key=path_url --value="$path_url"
|
||||||
|
|
||||||
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
|
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
|
ynh_app_setting_set --app="$app" --key=password --value="$password"
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=registration_open --value=$registration_open
|
ynh_app_setting_set --app="$app" --key=registration_open --value="$registration_open"
|
||||||
ynh_app_setting_set --app=$app --key=registration_approval --value=$registration_approval
|
ynh_app_setting_set --app="$app" --key=registration_approval --value="$registration_approval"
|
||||||
ynh_app_setting_set --app=$app --key=registration_reason --value=$registration_reason
|
ynh_app_setting_set --app="$app" --key=registration_reason --value="$registration_reason"
|
||||||
|
|
||||||
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"
|
||||||
ynh_app_setting_set --app=$app --key=media_video_max_size --value=$media_video_max_size
|
ynh_app_setting_set --app="$app" --key=media_video_max_size --value="$media_video_max_size"
|
||||||
ynh_app_setting_set --app=$app --key=media_description_min_chars --value=$media_description_min_chars
|
ynh_app_setting_set --app="$app" --key=media_description_min_chars --value="$media_description_min_chars"
|
||||||
ynh_app_setting_set --app=$app --key=media_description_max_chars --value=$media_description_max_chars
|
ynh_app_setting_set --app="$app" --key=media_description_max_chars --value="$media_description_max_chars"
|
||||||
ynh_app_setting_set --app=$app --key=media_remote_cache_days --value=$media_remote_cache_days
|
ynh_app_setting_set --app="$app" --key=media_remote_cache_days --value="$media_remote_cache_days"
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=statuses_max_chars --value=$statuses_max_chars
|
ynh_app_setting_set --app="$app" --key=statuses_max_chars --value="$statuses_max_chars"
|
||||||
ynh_app_setting_set --app=$app --key=statuses_cw_max_chars --value=$statuses_cw_max_chars
|
ynh_app_setting_set --app="$app" --key=statuses_cw_max_chars --value="$statuses_cw_max_chars"
|
||||||
ynh_app_setting_set --app=$app --key=statuses_poll_max_options --value=$statuses_poll_max_options
|
ynh_app_setting_set --app="$app" --key=statuses_poll_max_options --value="$statuses_poll_max_options"
|
||||||
ynh_app_setting_set --app=$app --key=statuses_poll_option_max_chars --value=$statuses_poll_option_max_chars
|
ynh_app_setting_set --app="$app" --key=statuses_poll_option_max_chars --value="$statuses_poll_option_max_chars"
|
||||||
ynh_app_setting_set --app=$app --key=statuses_media_max_files --value=$statuses_media_max_files
|
ynh_app_setting_set --app="$app" --key=statuses_media_max_files --value="$statuses_media_max_files"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -105,14 +105,14 @@ ynh_script_progression --message="Finding an available port..." --weight=1
|
||||||
|
|
||||||
# Find an available port
|
# Find an available port
|
||||||
port=$(ynh_find_port --port=8095)
|
port=$(ynh_find_port --port=8095)
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
ynh_app_setting_set --app="$app" --key=port --value="$port"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=5
|
ynh_script_progression --message="Installing dependencies..." --weight=5
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
@ -120,21 +120,21 @@ ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
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"
|
ynh_system_user_create --username="$app" --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A POSTGRESQL DATABASE
|
# CREATE A POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=5
|
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=5
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
db_name=$(ynh_sanitize_dbid --db_name="$app")
|
||||||
db_user=$db_name
|
db_user="$db_name"
|
||||||
db_pwd=$(ynh_string_random --length=30)
|
db_pwd=$(ynh_string_random --length=30)
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --app="$app" --key=db_name --value="$db_name"
|
||||||
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
ynh_app_setting_set --app="$app" --key=db_user --value="$db_user"
|
||||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
ynh_app_setting_set --app="$app" --key=db_pwd --value="$db_pwd"
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
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
|
||||||
|
@ -149,7 +149,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="$final_path" --source_id="$architecture"
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -159,7 +159,7 @@ ynh_setup_source --dest_dir="$final_path" --source_id=$architecture
|
||||||
# this will be treated as a security issue.
|
# this will be treated as a security issue.
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R "$app:www-data" "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -175,9 +175,9 @@ 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
|
datadir=/home/yunohost.app/$app
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
ynh_app_setting_set --app="$app" --key=datadir --value="$datadir"
|
||||||
|
|
||||||
mkdir -p $datadir
|
mkdir -p "$datadir"
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -187,7 +187,7 @@ mkdir -p $datadir
|
||||||
# this will be treated as a security issue.
|
# this will be treated as a security issue.
|
||||||
chmod 750 "$datadir"
|
chmod 750 "$datadir"
|
||||||
chmod -R o-rwx "$datadir"
|
chmod -R o-rwx "$datadir"
|
||||||
chown -R $app:www-data "$datadir"
|
chown -R "$app:www-data" "$datadir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
|
@ -200,7 +200,7 @@ ynh_add_config --template="config.yaml" --destination="$final_path/config.yaml"
|
||||||
# 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 "$final_path/config.yaml"
|
||||||
chown $app:$app "$final_path/config.yaml"
|
chown "$app:$app" "$final_path/config.yaml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
@ -225,7 +225,7 @@ ynh_use_logrotate
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description="Gotosocial server" --log="/var/log/$app/$app.log"
|
yunohost service add "$app" --description="Gotosocial server" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE ADMIN USER
|
# CREATE ADMIN USER
|
||||||
|
@ -244,7 +244,7 @@ ynh_script_progression --message="Creating gotosocial admin user..." --weight=1
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
|
|
@ -14,14 +14,14 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app="$YNH_APP_INSTANCE_NAME"
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app="$app" --key=port)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||||
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
db_user=$(ynh_app_setting_get --app="$app" --key=db_user)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
datadir=$(ynh_app_setting_get --app="$app" --key=datadir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
@ -30,10 +30,10 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
if ynh_exec_warn_less yunohost service status "$app" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||||
yunohost service remove $app
|
yunohost service remove "$app"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -50,7 +50,7 @@ ynh_remove_systemd_config
|
||||||
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=5
|
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
|
ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
|
@ -99,7 +99,7 @@ ynh_remove_logrotate
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
if yunohost firewall list | grep -q "\- $port$"
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Closing port $port..." --weight=1
|
ynh_script_progression --message="Closing port $port..." --weight=1
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
ynh_exec_warn_less yunohost firewall disallow TCP "$port"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -120,7 +120,7 @@ ynh_secure_remove --file="/var/log/$app"
|
||||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
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
|
ynh_system_user_delete --username="$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -26,44 +26,44 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app="$YNH_APP_INSTANCE_NAME"
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app="$app" --key=port)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path_url)
|
path_url=$(ynh_app_setting_get --app="$app" --key=path_url)
|
||||||
|
|
||||||
client_max_body_size=$(ynh_app_setting_get --app=$app --key=client_max_body_size)
|
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)
|
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
db_pwd=$(ynh_app_setting_get --app="$app" --key=db_pwd)
|
||||||
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
datadir=$(ynh_app_setting_get --app="$app" --key=datadir)
|
||||||
|
|
||||||
registration_open=$(ynh_app_setting_get --app=$app --key=registration_open)
|
registration_open=$(ynh_app_setting_get --app="$app" --key=registration_open)
|
||||||
registration_approval=$(ynh_app_setting_get --app=$app --key=registration_approval)
|
registration_approval=$(ynh_app_setting_get --app="$app" --key=registration_approval)
|
||||||
registration_reason=$(ynh_app_setting_get --app=$app --key=registration_reason)
|
registration_reason=$(ynh_app_setting_get --app="$app" --key=registration_reason)
|
||||||
|
|
||||||
media_image_max_size=$(ynh_app_setting_get --app=$app --key=media_image_max_size)
|
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)
|
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)
|
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)
|
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)
|
media_remote_cache_days=$(ynh_app_setting_get --app="$app" --key=media_remote_cache_days)
|
||||||
|
|
||||||
statuses_max_chars=$(ynh_app_setting_get --app=$app --key=statuses_max_chars)
|
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)
|
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)
|
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)
|
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)
|
statuses_media_max_files=$(ynh_app_setting_get --app="$app" --key=statuses_media_max_files)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||||
|
|
||||||
test ! -d $final_path \
|
test ! -d "$final_path" \
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|| ynh_die --message="There is already a directory: $final_path "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -81,7 +81,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
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"
|
ynh_system_user_create --username="$app" --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
|
@ -98,7 +98,7 @@ ynh_restore_file --origin_path="$final_path"
|
||||||
# this will be treated as a security issue.
|
# this will be treated as a security issue.
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R "$app:www-data" "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
|
@ -107,7 +107,7 @@ ynh_script_progression --message="Restoring the data directory..." --weight=5
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||||
|
|
||||||
mkdir -p $datadir
|
mkdir -p "$datadir"
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -117,7 +117,7 @@ mkdir -p $datadir
|
||||||
# this will be treated as a security issue.
|
# this will be treated as a security issue.
|
||||||
chmod 750 "$datadir"
|
chmod 750 "$datadir"
|
||||||
chmod -R o-rwx "$datadir"
|
chmod -R o-rwx "$datadir"
|
||||||
chown -R $app:www-data "$datadir"
|
chown -R "$app:www-data" "$datadir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
|
@ -127,7 +127,7 @@ chown -R $app:www-data "$datadir"
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=5
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=5
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE POSTGRESQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
|
@ -135,18 +135,18 @@ ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=5
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=5
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
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"
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" --database=$db_name
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" --database="$db_name"
|
||||||
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE VARIOUS FILES
|
# RESTORE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
mkdir -p /var/log/$app
|
mkdir -p "/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
|
@ -154,21 +154,21 @@ mkdir -p /var/log/$app
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable "$app.service" --quiet
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description="Gotosocial server" --log="/var/log/$app/$app.log"
|
yunohost service add "$app" --description="Gotosocial server" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
|
|
|
@ -14,37 +14,37 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app="$YNH_APP_INSTANCE_NAME"
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app="$app" --key=port)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path_url)
|
path_url=$(ynh_app_setting_get --app="$app" --key=path_url)
|
||||||
|
|
||||||
client_max_body_size=$(ynh_app_setting_get --app=$app --key=client_max_body_size)
|
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)
|
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||||
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
db_user=$(ynh_app_setting_get --app="$app" --key=db_user)
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
db_pwd=$(ynh_app_setting_get --app="$app" --key=db_pwd)
|
||||||
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
datadir=$(ynh_app_setting_get --app="$app" --key=datadir)
|
||||||
|
|
||||||
registration_open=$(ynh_app_setting_get --app=$app --key=registration_open)
|
registration_open=$(ynh_app_setting_get --app="$app" --key=registration_open)
|
||||||
registration_approval=$(ynh_app_setting_get --app=$app --key=registration_approval)
|
registration_approval=$(ynh_app_setting_get --app="$app" --key=registration_approval)
|
||||||
registration_reason=$(ynh_app_setting_get --app=$app --key=registration_reason)
|
registration_reason=$(ynh_app_setting_get --app="$app" --key=registration_reason)
|
||||||
|
|
||||||
media_image_max_size=$(ynh_app_setting_get --app=$app --key=media_image_max_size)
|
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)
|
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)
|
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)
|
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)
|
media_remote_cache_days=$(ynh_app_setting_get --app="$app" --key=media_remote_cache_days)
|
||||||
|
|
||||||
statuses_max_chars=$(ynh_app_setting_get --app=$app --key=statuses_max_chars)
|
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)
|
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)
|
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)
|
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)
|
statuses_media_max_files=$(ynh_app_setting_get --app="$app" --key=statuses_media_max_files)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
|
@ -79,7 +79,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..."
|
ynh_script_progression --message="Stopping a systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
@ -109,21 +109,21 @@ then
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
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"
|
||||||
ynh_app_setting_set --app=$app --key=media_video_max_size --value=$media_video_max_size
|
ynh_app_setting_set --app="$app" --key=media_video_max_size --value="$media_video_max_size"
|
||||||
ynh_app_setting_set --app=$app --key=media_description_min_chars --value=$media_description_min_chars
|
ynh_app_setting_set --app="$app" --key=media_description_min_chars --value="$media_description_min_chars"
|
||||||
ynh_app_setting_set --app=$app --key=media_description_max_chars --value=$media_description_max_chars
|
ynh_app_setting_set --app="$app" --key=media_description_max_chars --value="$media_description_max_chars"
|
||||||
ynh_app_setting_set --app=$app --key=media_remote_cache_days --value=$media_remote_cache_days
|
ynh_app_setting_set --app="$app" --key=media_remote_cache_days --value="$media_remote_cache_days"
|
||||||
ynh_app_setting_set --app=$app --key=statuses_max_chars --value=$statuses_max_chars
|
ynh_app_setting_set --app="$app" --key=statuses_max_chars --value="$statuses_max_chars"
|
||||||
ynh_app_setting_set --app=$app --key=statuses_cw_max_chars --value=$statuses_cw_max_chars
|
ynh_app_setting_set --app="$app" --key=statuses_cw_max_chars --value="$statuses_cw_max_chars"
|
||||||
ynh_app_setting_set --app=$app --key=statuses_poll_max_options --value=$statuses_poll_max_options
|
ynh_app_setting_set --app="$app" --key=statuses_poll_max_options --value="$statuses_poll_max_options"
|
||||||
ynh_app_setting_set --app=$app --key=statuses_poll_option_max_chars --value=$statuses_poll_option_max_chars
|
ynh_app_setting_set --app="$app" --key=statuses_poll_option_max_chars --value="$statuses_poll_option_max_chars"
|
||||||
ynh_app_setting_set --app=$app --key=statuses_media_max_files --value=$statuses_media_max_files
|
ynh_app_setting_set --app="$app" --key=statuses_media_max_files --value="$statuses_media_max_files"
|
||||||
# registration of converted parameters
|
# registration of converted parameters
|
||||||
ynh_app_setting_set --app=$app --key=statuses_media_max_files --value=$registration_open
|
ynh_app_setting_set --app="$app" --key=statuses_media_max_files --value="$registration_open"
|
||||||
ynh_app_setting_set --app=$app --key=statuses_media_max_files --value=$registration_approval
|
ynh_app_setting_set --app="$app" --key=statuses_media_max_files --value="$registration_approval"
|
||||||
ynh_app_setting_set --app=$app --key=statuses_media_max_files --value=$registration_reason
|
ynh_app_setting_set --app="$app" --key=statuses_media_max_files --value="$registration_reason"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -132,7 +132,7 @@ fi
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
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"
|
ynh_system_user_create --username="$app" --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
@ -146,7 +146,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="$final_path" --source_id="$architecture" --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
|
||||||
|
@ -157,7 +157,7 @@ fi
|
||||||
# this will be treated as a security issue.
|
# this will be treated as a security issue.
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R "$app:www-data" "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -172,7 +172,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading dependencies..."
|
ynh_script_progression --message="Upgrading dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
|
@ -190,7 +190,7 @@ ynh_add_config --template="config.yaml" --destination="$final_path/config.yaml"
|
||||||
# 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 "$final_path/config.yaml"
|
||||||
chown $app:$app "$final_path/config.yaml"
|
chown "$app:$app" "$final_path/config.yaml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
@ -215,14 +215,14 @@ ynh_use_logrotate --non-append
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add $app --description="Gotosocial server" --log="/var/log/$app/$app.log"
|
yunohost service add "$app" --description="Gotosocial server" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
Loading…
Add table
Reference in a new issue