mirror of
https://github.com/YunoHost-Apps/gotosocial_ynh.git
synced 2024-09-03 19:16:06 +02:00
clean script
This commit is contained in:
parent
87f5ed63bf
commit
8024930655
1 changed files with 12 additions and 104 deletions
116
scripts/install
116
scripts/install
|
@ -13,26 +13,20 @@ source /usr/share/yunohost/helpers
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#REMOVEME? app="$YNH_APP_INSTANCE_NAME"
|
|
||||||
|
|
||||||
landing_page_user=""
|
landing_page_user=""
|
||||||
|
|
||||||
#REMOVEME? domain="$YNH_APP_ARG_DOMAIN"
|
domain="$YNH_APP_ARG_DOMAIN"
|
||||||
path="/"
|
path="/"
|
||||||
|
|
||||||
client_max_body_size="100M"
|
client_max_body_size="100M"
|
||||||
|
|
||||||
#REMOVEME? admin="$YNH_APP_ARG_ADMIN"
|
|
||||||
#REMOVEME? email="$YNH_APP_ARG_EMAIL"
|
|
||||||
#REMOVEME? password="$YNH_APP_ARG_PASSWORD"
|
|
||||||
|
|
||||||
# Config stuff:
|
# Config stuff:
|
||||||
|
|
||||||
cache_memory_target="100MiB"
|
cache_memory_target="100MiB"
|
||||||
|
|
||||||
#REMOVEME? accounts_registration_open=$(convert_bool "$YNH_APP_ARG_ACCOUNTS_REGISTRATION_OPEN")
|
accounts_registration_open=$(convert_bool "$YNH_APP_ARG_ACCOUNTS_REGISTRATION_OPEN")
|
||||||
#REMOVEME? accounts_approval_required=$(convert_bool "$YNH_APP_ARG_ACCOUNTS_APPROVAL_REQUIRED")
|
accounts_approval_required=$(convert_bool "$YNH_APP_ARG_ACCOUNTS_APPROVAL_REQUIRED")
|
||||||
#REMOVEME? accounts_reason_required=$(convert_bool "$YNH_APP_ARG_ACCOUNTS_REASON_REQUIRED")
|
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"
|
||||||
|
|
||||||
|
@ -83,34 +77,23 @@ smtp_disclose_recipients="false"
|
||||||
advanced_cookies_samesite="lax"
|
advanced_cookies_samesite="lax"
|
||||||
advanced_rate_limit_requests="300"
|
advanced_rate_limit_requests="300"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1
|
|
||||||
|
|
||||||
#REMOVEME? install_dir="/var/www/$app"
|
|
||||||
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
|
|
||||||
|
|
||||||
#REMOVEME? ynh_webpath_register --app="$app" --domain="$domain" --path="$path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1
|
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||||
|
|
||||||
#REMOVEME? ynh_app_setting_set --app="$app" --key=install_dir --value="$install_dir"
|
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"
|
||||||
|
|
||||||
#REMOVEME? ynh_app_setting_set --app="$app" --key=domain --value="$domain"
|
ynh_app_setting_set --app="$app" --key=domain --value="$domain"
|
||||||
#REMOVEME? ynh_app_setting_set --app="$app" --key=path --value="$path"
|
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"
|
||||||
|
|
||||||
#REMOVEME? 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"
|
||||||
#REMOVEME? 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=cache_memory_target --value="$cache_memory_target"
|
ynh_app_setting_set --app="$app" --key=cache_memory_target --value="$cache_memory_target"
|
||||||
|
|
||||||
|
@ -158,55 +141,15 @@ 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"
|
||||||
#REMOVEME? ynh_app_setting_set --app="$app" --key=smtp_port --value="$smtp_port"
|
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"
|
||||||
#REMOVEME? ynh_app_setting_set --app="$app" --key=smtp_password --value="$smtp_password"
|
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"
|
||||||
|
|
||||||
ynh_app_setting_set --app="$app" --key=advanced_cookies_samesite --value="$advanced_cookies_samesite"
|
ynh_app_setting_set --app="$app" --key=advanced_cookies_samesite --value="$advanced_cookies_samesite"
|
||||||
ynh_app_setting_set --app="$app" --key=advanced_rate_limit_requests --value="$advanced_rate_limit_requests"
|
ynh_app_setting_set --app="$app" --key=advanced_rate_limit_requests --value="$advanced_rate_limit_requests"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# FIND AND OPEN A PORT
|
|
||||||
#=================================================
|
|
||||||
#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1
|
|
||||||
|
|
||||||
# Find an available port
|
|
||||||
#REMOVEME? port=$(ynh_find_port --port=8095)
|
|
||||||
#REMOVEME? ynh_app_setting_set --app="$app" --key=port --value="$port"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=5
|
|
||||||
|
|
||||||
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
#REMOVEME? ynh_system_user_create --username="$app" --home_dir="$install_dir"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE A POSTGRESQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
#REMOVEME? ynh_script_progression --message="Creating a PostgreSQL database..." --weight=5
|
|
||||||
|
|
||||||
#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name="$app")
|
|
||||||
#REMOVEME? db_user="$db_name"
|
|
||||||
#REMOVEME? db_pwd=$(ynh_string_random --length=30)
|
|
||||||
#REMOVEME? ynh_app_setting_set --app="$app" --key=db_name --value="$db_name"
|
|
||||||
#REMOVEME? ynh_app_setting_set --app="$app" --key=db_user --value="$db_user"
|
|
||||||
#REMOVEME? ynh_app_setting_set --app="$app" --key=db_pwd --value="$db_pwd"
|
|
||||||
#REMOVEME? ynh_psql_test_if_first_run
|
|
||||||
#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
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -240,26 +183,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||||
# Create a dedicated NGINX config for the main domain
|
# Create a dedicated NGINX config for the main domain
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DATA DIRECTORY
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
|
||||||
|
|
||||||
#REMOVEME? data_dir=/home/yunohost.app/$app
|
|
||||||
#REMOVEME? ynh_app_setting_set --app="$app" --key=data_dir --value="$data_dir"
|
|
||||||
|
|
||||||
mkdir -p "$data_dir"
|
|
||||||
|
|
||||||
# FIXME: this should be managed by the core in the future
|
|
||||||
# Here, as a packager, you may have to tweak the ownerhsip/permissions
|
|
||||||
# such that the appropriate users (e.g. maybe www-data) can access
|
|
||||||
# files in some cases.
|
|
||||||
# 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.
|
|
||||||
chmod 750 "$data_dir"
|
|
||||||
chmod -R o-rwx "$data_dir"
|
|
||||||
chown -R "$app:www-data" "$data_dir"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -326,21 +249,6 @@ 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
|
|
||||||
#=================================================
|
|
||||||
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
|
|
||||||
|
|
||||||
# Everyone can access the app.
|
|
||||||
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue