#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # INITIALIZE AND STORE SETTINGS #================================================= fpm_footprint="low" fpm_free_footprint=0 fpm_usage="low" ynh_app_setting_set --app="$app" --key=fpm_footprint --value=$fpm_footprint ynh_app_setting_set --app="$app" --key=fpm_free_footprint --value=$fpm_free_footprint ynh_app_setting_set --app="$app" --key=fpm_usage --value=$fpm_usage #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" # Set permissions to app files chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= # SPECIFIC SETUP #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." random=$(ynh_string_random --length=20) ynh_add_config --template="config_inc.php" --destination="$install_dir/config/config_inc.php" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint # Create a dedicated NGINX config ynh_add_nginx_config #================================================= # SETUP APPLICATION WITH CURL #================================================= ynh_script_progression --message="Setting up application with CURL..." --weight=10 # Installation with cURL ynh_local_curl "/admin/install.php?submit" \ "install=2" "hostname=localhost" "timezone=UTC" \ "admin_username=" "admin_password=" \ "db_type=mysqli" "db_username=$db_user" "db_password=$db_pwd" "database_name=$db_name" \ "db_table_prefix=$db_name" "db_table_plugin_prefix=plugin" "db_table_suffix=_table" # Remove the `admin/` directory from within the MantisBT installation path. # The scripts within this directory should not be accessible on a live MantisBT site # or on any installation that is accessible via the Internet. ynh_secure_remove --file="$install_dir/admin" # Set the user chosen at installation as administrator ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" <<< "UPDATE ${db_name}_user_table SET username = '$admin' WHERE id = 1;" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed" --last