mirror of
https://github.com/YunoHost-Apps/snserver_ynh.git
synced 2024-09-03 20:26:22 +02:00
Fix: fix scripts and cleanup
This commit is contained in:
parent
2695bdf67e
commit
2ce3dce027
4 changed files with 23 additions and 18 deletions
|
@ -1,6 +1,6 @@
|
||||||
__YNH_NODE_LOAD_PATH__
|
__YNH_NODE_LOAD_PATH__
|
||||||
|
|
||||||
LOG_LEVEL="debug"
|
LOG_LEVEL="info"
|
||||||
NODE_ENV="production"
|
NODE_ENV="production"
|
||||||
VERSION="production"
|
VERSION="production"
|
||||||
|
|
||||||
|
@ -34,4 +34,4 @@ SQS_QUEUE_URL=
|
||||||
SQS_AWS_REGION=
|
SQS_AWS_REGION=
|
||||||
|
|
||||||
# (Optional) File upload path (relative to root directory)
|
# (Optional) File upload path (relative to root directory)
|
||||||
FILE_UPLOAD_PATH=/home/yunohost.app/__APP__/uploads/
|
FILE_UPLOAD_PATH=__DATADIR__/uploads/
|
||||||
|
|
|
@ -304,7 +304,7 @@ ynh_systemd_action \
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setup a cron..."
|
ynh_script_progression --message="Setup a cron..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/cron.env" --destination="__finalpath__/$app.env"
|
ynh_add_config --template="../conf/cron.env" --destination="$final_path/cron.env"
|
||||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||||
|
|
||||||
chown root: "/etc/cron.d/$app"
|
chown root: "/etc/cron.d/$app"
|
||||||
|
|
|
@ -121,8 +121,8 @@ ynh_secure_remove --file="$final_path"
|
||||||
# Remove the data directory if --purge option is used
|
# Remove the data directory if --purge option is used
|
||||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing app data directory..." --weight=1
|
ynh_script_progression --message="Removing app data directory..." --weight=1
|
||||||
ynh_secure_remove --file="$datadir"
|
ynh_secure_remove --file="$datadir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -44,10 +44,6 @@ pseudo_key_params_key=$(ynh_app_setting_get --app=$app --key=pseudo_key_params_k
|
||||||
encryption_server_key=$(ynh_app_setting_get --app=$app --key=encryption_server_key)
|
encryption_server_key=$(ynh_app_setting_get --app=$app --key=encryption_server_key)
|
||||||
valet_token_secret=$(ynh_app_setting_get --app=$app --key=valet_token_secret)
|
valet_token_secret=$(ynh_app_setting_get --app=$app --key=valet_token_secret)
|
||||||
|
|
||||||
syncing_server_version_installed=$(ynh_app_setting_get --app=$app --key=syncing_server_version)
|
|
||||||
auth_version_installed=$(ynh_app_setting_get --app=$app --key=auth_version)
|
|
||||||
api_gateway_version_installed=$(ynh_app_setting_get --app=$app --key=api_gateway_version)
|
|
||||||
|
|
||||||
disable_user_registration=$(ynh_app_setting_get --app=$app --key=DISABLE_USER_REGISTRATION)
|
disable_user_registration=$(ynh_app_setting_get --app=$app --key=DISABLE_USER_REGISTRATION)
|
||||||
files_size=$(ynh_app_setting_get --app=$app --key=FILES_SIZE)
|
files_size=$(ynh_app_setting_get --app=$app --key=FILES_SIZE)
|
||||||
|
|
||||||
|
@ -158,7 +154,7 @@ if [ -z "$port_files" ]; then
|
||||||
fi
|
fi
|
||||||
# If port_syncing_server doesn't exist, create it
|
# If port_syncing_server doesn't exist, create it
|
||||||
if [ -z "$port_syncing_server" ]; then
|
if [ -z "$port_syncing_server" ]; then
|
||||||
port_syncing_server=$(ynh_find_port --port=$((port_files+1)))
|
port_syncing_server=$(ynh_find_port --port=$((port_files+1)))
|
||||||
ynh_app_setting_set --app=$app --key=port_syncing_server --value=$port_syncing_server
|
ynh_app_setting_set --app=$app --key=port_syncing_server --value=$port_syncing_server
|
||||||
fi
|
fi
|
||||||
# If port_syncing_server_worker doesn't exist, create it
|
# If port_syncing_server_worker doesn't exist, create it
|
||||||
|
@ -167,7 +163,6 @@ if [ -z "$port_syncing_server_worker" ]; then
|
||||||
ynh_app_setting_set --app=$app --key=port_syncing_server_worker --value=$port_syncing_server_worker
|
ynh_app_setting_set --app=$app --key=port_syncing_server_worker --value=$port_syncing_server_worker
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# If jwt_secret doesn't exist, create it
|
# If jwt_secret doesn't exist, create it
|
||||||
if [ -z "$jwt_secret" ]; then
|
if [ -z "$jwt_secret" ]; then
|
||||||
jwt_secret=$(ynh_string_random --length=48 | base64)
|
jwt_secret=$(ynh_string_random --length=48 | base64)
|
||||||
|
@ -199,7 +194,7 @@ if [ -z "$valet_token_secret" ]; then
|
||||||
ynh_app_setting_set --app=$app --key=valet_token_secret --value=$valet_token_secret
|
ynh_app_setting_set --app=$app --key=valet_token_secret --value=$valet_token_secret
|
||||||
fi
|
fi
|
||||||
# If disable_user_registration doesn't exist, create it
|
# If disable_user_registration doesn't exist, create it
|
||||||
if [ -z "$diable_user_registration" ]; then
|
if [ -z "$disable_user_registration" ]; then
|
||||||
disable_user_registration=false
|
disable_user_registration=false
|
||||||
ynh_app_setting_set --app=$app --key=DISABLE_USER_REGISTRATION --value=$disable_user_registration
|
ynh_app_setting_set --app=$app --key=DISABLE_USER_REGISTRATION --value=$disable_user_registration
|
||||||
fi
|
fi
|
||||||
|
@ -209,15 +204,26 @@ if [ -z "$files_size" ]; then
|
||||||
ynh_app_setting_set --app=$app --key=FILES_SIZE --value=$files_size
|
ynh_app_setting_set --app=$app --key=FILES_SIZE --value=$files_size
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Remove old Settings, Services, Files, Dependencies
|
# Remove old Settings, Services, Files, Dependencies
|
||||||
# If final_path_www exist, delete it
|
# If final_path_www exist, delete it
|
||||||
|
api_gateway_version_installed=$(ynh_app_setting_get --app=$app --key=api_gateway_version)
|
||||||
|
auth_version_installed=$(ynh_app_setting_get --app=$app --key=auth_version)
|
||||||
|
syncing_server_version_installed=$(ynh_app_setting_get --app=$app --key=syncing_server_version)
|
||||||
final_path_www=$(ynh_app_setting_get --app=$app --key=final_path_www)
|
final_path_www=$(ynh_app_setting_get --app=$app --key=final_path_www)
|
||||||
|
final_path_extensions=$(ynh_app_setting_get --app=$app --key=final_path_extensions)
|
||||||
|
if [ -n ${api_gateway_version_installed+x} ]; then
|
||||||
|
ynh_app_setting_delete --app=$app --key=api_gateway_version_installed
|
||||||
|
fi
|
||||||
|
if [ -n ${auth_version_installed+x} ]; then
|
||||||
|
ynh_app_setting_delete --app=$app --key=auth_version_installe
|
||||||
|
fi
|
||||||
|
if [ -n ${syncing_server_version_installed+x} ]; then
|
||||||
|
ynh_app_setting_delete --app=$app --key=syncing_server_version_installed
|
||||||
|
fi
|
||||||
if [ -n ${final_path_www+x} ]; then
|
if [ -n ${final_path_www+x} ]; then
|
||||||
ynh_app_setting_delete --app=$app --key=final_path_www
|
ynh_app_setting_delete --app=$app --key=final_path_www
|
||||||
fi
|
fi
|
||||||
# If final_path_extensions exist, delete it
|
# If final_path_extensions exist, delete it
|
||||||
final_path_extensions=$(ynh_app_setting_get --app=$app --key=final_path_extensions)
|
|
||||||
if [ -n ${final_path_extensions+x} ]; then
|
if [ -n ${final_path_extensions+x} ]; then
|
||||||
ynh_app_setting_delete --app=$app --key=final_path_extensions
|
ynh_app_setting_delete --app=$app --key=final_path_extensions
|
||||||
fi
|
fi
|
||||||
|
@ -225,7 +231,7 @@ fi
|
||||||
# If permission help exists, delete it
|
# If permission help exists, delete it
|
||||||
if ynh_permission_exists --permission="help"
|
if ynh_permission_exists --permission="help"
|
||||||
then
|
then
|
||||||
ynh_permission_delete --permission="help"
|
ynh_permission_delete --permission="help"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If old service exsits; remove it
|
# If old service exsits; remove it
|
||||||
|
@ -240,7 +246,6 @@ then
|
||||||
yunohost service remove "$app-syncing-server-js-worker"
|
yunohost service remove "$app-syncing-server-js-worker"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Remove unneeded data
|
# Remove unneeded data
|
||||||
if [ -e "/var/www/$app" ]; then
|
if [ -e "/var/www/$app" ]; then
|
||||||
ynh_secure_remove --file="/var/www/$app"
|
ynh_secure_remove --file="/var/www/$app"
|
||||||
|
@ -301,7 +306,7 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||||
# Remove old nodejs version
|
# Remove old nodejs version
|
||||||
if [[ "$nodejs_version_installed" < "$NODEJS_VERSION" && -n "$nodejs_version_installed" ]]
|
if [[ "$nodejs_version_installed" < "$NODEJS_VERSION" && -n "$nodejs_version_installed" ]]
|
||||||
then
|
then
|
||||||
ynh_remove_nodejs
|
ynh_remove_nodejs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
@ -445,7 +450,7 @@ ynh_systemd_action \
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setup a cron..."
|
ynh_script_progression --message="Setup a cron..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/cron.env" --destination="__finalpath__/$app.env"
|
ynh_add_config --template="../conf/cron.env" --destination="$final_path/cron.env"
|
||||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||||
|
|
||||||
chown root: "/etc/cron.d/$app"
|
chown root: "/etc/cron.d/$app"
|
||||||
|
|
Loading…
Reference in a new issue