1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/codimd_ynh.git synced 2024-09-03 18:16:32 +02:00

cleaning up

This commit is contained in:
ericgaspar 2020-05-29 22:31:43 +02:00
parent 04c53702d9
commit db39e80742
No known key found for this signature in database
GPG key ID: 574F281483054D44
8 changed files with 43 additions and 43 deletions

View file

@ -6,7 +6,7 @@
"en": "Collaborative editor to work on notes written in Markdown",
"fr": "Éditeur collaboratif pour travailler sur des notes en Markdown"
},
"version": "1.6.0~ynh3",
"version": "1.6.0~ynh2",
"url": "https://github.com/codimd/server",
"license": "AGPL-3.0-only",
"maintainer": {

View file

@ -7,4 +7,4 @@
# dependencies used by the app
pkg_dependencies="postgresql apt-transport-https"
nodejs_version="10"
nodejs_version=10

View file

@ -35,7 +35,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
ynh_backup --src_path=$final_path
#=================================================
# BACKUP THE NGINX CONFIGURATION
@ -48,7 +48,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
ynh_print_info --message="Backing up the database..."
ynh_psql_dump_db --database="$db_name" > db.sql
ynh_psql_dump_db --database=$db_name > db.sql
#=================================================
# SPECIFIC BACKUP

View file

@ -74,7 +74,7 @@ fi
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
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"
#=================================================
# MODIFY URL IN NGINX CONF
@ -112,7 +112,7 @@ fi
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="HTTP Server listening"
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server listening"
#=================================================
# RELOAD NGINX

View file

@ -48,17 +48,17 @@ ynh_script_progression --message="Configuring firewall..." --weight=2
# Find an available port
port=$(ynh_find_port --port=3000)
ynh_app_setting_set --app="$app" --key="port" --value="$port"
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app="$app" --key="domain" --value="$domain"
ynh_app_setting_set --app="$app" --key="path" --value="$path_url"
ynh_app_setting_set --app="$app" --key="is_public" --value="$is_public"
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=path --value=$path_url
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#==============================================
# INSTALL DEPENDENCIES
@ -68,7 +68,7 @@ ynh_script_progression --message="Installing dependencies..." --weight=20
ynh_install_app_dependencies $pkg_dependencies
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
@ -82,12 +82,12 @@ db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
db_pwd=$(ynh_string_random --length=30)
ynh_app_setting_set --app="$app" --key="db_pwd" --value="$db_pwd"
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_pwd --value=$db_pwd
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_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
@ -95,7 +95,7 @@ ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd"
ynh_script_progression --message="Setting up source files..." --weight=2
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --dest_dir=$final_path
#=================================================
# NGINX CONFIGURATION
@ -148,7 +148,7 @@ popd || ynh_die
ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user
ynh_system_user_create "$app"
ynh_system_user_create --username=$app --home_dir=$final_path
chown -R "$app":"$app" "$final_path"
@ -172,14 +172,14 @@ ynh_replace_string --match_string="__NODE__" --replace_string="$nodejs_path
ynh_add_systemd_config
yunohost service add "$app" --description "Collaborative Markdown notes" --log="/var/log/$app/$app.log"
yunohost service add $app --description "Collaborative Markdown notes" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting $app..." --weight=2
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="HTTP Server listening"
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server listening"
#=================================================
# SETUP SSOWAT

View file

@ -49,7 +49,7 @@ ynh_remove_systemd_config
ynh_script_progression --message="Removing the database..." --weight=2
# 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
@ -67,7 +67,7 @@ ynh_remove_nodejs
ynh_script_progression --message="Removing $app main directory..." --weight=6
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
ynh_secure_remove --file=$final_path
#=================================================
# REMOVE NGINX CONFIGURATION
@ -93,7 +93,7 @@ ynh_remove_logrotate
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username="$app"
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT

View file

@ -57,7 +57,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=60
ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path=$final_path
#=================================================
# RECREATE THE DEDICATED USER
@ -65,7 +65,7 @@ ynh_restore_file --origin_path="$final_path"
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username="$app"
ynh_system_user_create --username=$app
#=================================================
# RESTORE USER RIGHTS
@ -87,7 +87,7 @@ ynh_install_app_dependencies $pkg_dependencies
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# RESTORE THE DATABASE
@ -95,8 +95,8 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
ynh_script_progression --message="Restoring the database..." --weight=6
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd"
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#=================================================
# RESTORE SYSTEMD
@ -117,7 +117,7 @@ yunohost service add $app --description "collaborative Markdown editor" --log "/
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="HTTP Server listening"
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server listening"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION

View file

@ -53,7 +53,7 @@ ynh_abort_if_errors
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd"
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -70,10 +70,10 @@ then
cp -a "$final_path/.sequelizerc" "$tmpdir/.sequelizerc"
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
ynh_secure_remove --file=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --dest_dir=$final_path
#Copy the admin saved settings from tmp directory to final path
cp -a "$tmpdir/config.json" "$final_path/config.json"
@ -94,13 +94,13 @@ ynh_script_progression --message="Modifying a config file..." --weight=2
ynh_backup_if_checksum_is_different --file="$final_path/config.json"
# Main config File
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="../conf/config.json.example"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/config.json.example"
cp ../conf/config.json.example "$final_path/config.json"
@ -123,7 +123,7 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=18
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_install_app_dependencies $pkg_dependencies
@ -147,7 +147,7 @@ fi
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username="$app"
ynh_system_user_create --username=$app
#=================================================
# SPECIFIC UPGRADE
@ -171,7 +171,7 @@ ynh_replace_string --match_string="__NODE__" --replace_string="$nodejs_path
ynh_add_systemd_config
yunohost service add "$app" --description "Collaborative Markdown notes" --log="/var/log/$app/$app.log"
yunohost service add $app --description "Collaborative Markdown notes" --log="/var/log/$app/$app.log"
#=================================================
# SECURE FILES AND DIRECTORIES
@ -185,7 +185,7 @@ chown -R "$app":"$app" "$final_path"
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="HTTP Server listening"
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server listening"
#=================================================
# RELOAD NGINX