Merge pull request #95 from YunoHost-Apps/testing

Apply example_ynh
This commit is contained in:
yalh76 2020-02-23 20:20:04 +01:00 committed by GitHub
commit f9dd286ff1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 4 deletions

View File

@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
ynh_clean_check_starting

View File

@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
ynh_clean_check_starting
@ -23,6 +24,7 @@ ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
ynh_print_info --message="Retrieving arguments from the manifest..."
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
@ -63,7 +65,7 @@ ynh_app_setting_set --app=$app --key=ldap_password --value=$ldap_password
#=================================================
ynh_print_info --message="Configuring firewall..."
# Find a free port
# Find an available port
port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port
@ -135,6 +137,7 @@ ynh_add_systemd_config
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_print_info --message="Modifying a config file..."
config_file="$final_path/config.yml"
cp -f ../conf/config.sample.yml $config_file
@ -146,6 +149,7 @@ ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --ta
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
ynh_print_info --message="Storing the config file checksum..."
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config_file"
@ -155,6 +159,7 @@ ynh_store_file_checksum --file="$config_file"
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_print_info --message="Securing files and directories..."
# Set permissions to app files
chown -R "$app":"$app" "$final_path"
@ -162,14 +167,16 @@ chown -R "$app":"$app" "$final_path"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_print_info --message="Integrating service in YunoHost..."
# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added
yunohost service add $app --description "$app daemon for Wiki.js" --log_type systemd
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_print_info --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:"
#=================================================

View File

@ -29,6 +29,7 @@ ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user)
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
ynh_print_info --message="Removing service integration in YunoHost..."
# 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
@ -81,6 +82,7 @@ ynh_remove_nginx_config
#=================================================
# CLOSE A PORT
#=================================================
ynh_print_info --message="Closing a port..."
if yunohost firewall list | grep -q "\- $port$"
then

View File

@ -12,7 +12,8 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#===ynh_print_info --message="Managing script failure..."
==============================================
ynh_clean_setup () {
ynh_clean_check_starting
@ -51,6 +52,7 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Restoring the nginx configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -72,6 +74,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE USER RIGHTS
#=================================================
ynh_print_info --message="Restoring user rights..."
# Restore permissions on app files
chown -R "$app":"$app" "$final_path"
@ -84,7 +87,6 @@ chown -R "$app":"$app" "$final_path"
ynh_print_info --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_nodejs --nodejs_version="10"
ynh_install_app_dependencies $pkg_dependencies
@ -109,6 +111,7 @@ systemctl enable $app.service
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_print_info --message="Integrating service in YunoHost..."
yunohost service add $app --description "$app daemon for Wiki.js" --log_type systemd

View File

@ -32,6 +32,7 @@ ldap_password=$(ynh_app_setting_get --app=$app --key=ldap_password)
#=================================================
# CHECK VERSION
#=================================================
ynh_print_info --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)