Apply example_ynh
This commit is contained in:
@@ -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:"
|
||||
|
||||
#=================================================
|
||||
|
||||
Reference in New Issue
Block a user