1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/osticket_ynh.git synced 2024-09-03 19:56:17 +02:00

Apply example_ynh

This commit is contained in:
yalh76 2021-04-10 20:01:32 +02:00
parent 2956c29989
commit f66f0a9288
3 changed files with 26 additions and 60 deletions

View file

@ -125,16 +125,14 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC SETUP
#=================================================
# PREPARE INSTALL
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Preparing install..."
ynh_script_progression --message="Adding a config file..."
config_file=$final_path/include/ost-config.php
cp -f ../conf/ost-sampleconfig.php "$config_file"
ynh_add_config --template="../conf/ost-sampleconfig.php" --destination="$final_path/include/ost-config.php"
admin_fname=$(ynh_user_get_info $admin 'firstname')
admin_lname=$(ynh_user_get_info $admin 'lastname')
admin_mail=$(ynh_user_get_info $admin 'mail')
chmod 400 "$final_path/include/ost-config.php"
chown $app:$app "$final_path/include/ost-config.php"
#=================================================
# BUILD PLUGINS
@ -179,18 +177,14 @@ rsync -a "../conf/i18n" "$final_path/include/."
#=================================================
ynh_script_progression --message="Setuping application with CURL..."
# Set right permissions for curl install
chown -R $app: $final_path
# Set the app as temporarily public for curl call
ynh_script_progression --message="Configuring SSOwat..."
# Making the app public for curl
ynh_permission_update --permission="main" --add="visitors"
# Reload SSOwat config
yunohost app ssowatconf
# Reload Nginx
ynh_systemd_action --service_name=nginx --action=reload
admin_fname=$(ynh_user_get_info $admin 'firstname')
admin_lname=$(ynh_user_get_info $admin 'lastname')
admin_mail=$(ynh_user_get_info $admin 'mail')
# Installation with curl
ynh_script_progression --message="Finalizing installation..."
@ -199,17 +193,8 @@ ynh_local_curl "/setup/install.php" "s=install" "name=$app" "email=$app@$domain"
# Remove the public access
ynh_permission_update --permission="main" --remove="visitors"
#=================================================
# FINALIZE INSTALL
#=================================================
ynh_script_progression --message="Finalizing install..."
# Removing setup folder
ynh_secure_remove --file="$final_path/setup"
# Securing config file
chmod 0644 $config_file
#=================================================
# SET THE CRON FILE
#=================================================
@ -217,24 +202,8 @@ ynh_script_progression --message="Setting the cron file..."
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
ynh_script_progression --message="Storing the config file checksum..."
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config_file"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R $app: $final_path
#=================================================
# SETUP SSOWAT
#=================================================

View file

@ -85,6 +85,13 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC RESTORATION
#=================================================
# RESTORE THE CRON FILE
#=================================================
ynh_script_progression --message="Restoring the cron file..."
ynh_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
@ -102,13 +109,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RESTORE THE CRON FILE
#=================================================
ynh_script_progression --message="Restoring the cron file..."
ynh_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -133,6 +133,16 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC UPGRADE
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a config file..."
ynh_add_config --template="../conf/ost-sampleconfig.php" --destination="$final_path/include/ost-config.php"
chmod 400 "$final_path/include/ost-config.php"
chown $app:$app "$final_path/include/ost-config.php"
#=================================================
# BUILD PLUGINS
#=================================================
@ -164,6 +174,7 @@ then
#cp -f *.phar $final_path/include/plugins/.
popd
ynh_secure_remove --file="$final_path/include/plugins/build"
ynh_secure_remove --file="$final_path/setup"
fi
#=================================================
@ -173,20 +184,6 @@ ynh_script_progression --message="UPGRADING language..."
rsync -a "../conf/i18n" "$final_path/include/."
#=================================================
# FINALIZE UPGRADE
#=================================================
ynh_script_progression --message="Finalizing install..."
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
# Removing setup folder
ynh_secure_remove --file="$final_path/setup"
# Securing config file
chmod 0644 $config_file
fi
#=================================================
# SET THE CRON FILE
#=================================================