1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/joomla_ynh.git synced 2024-09-03 19:26:34 +02:00
joomla_ynh/scripts/install

97 lines
3.5 KiB
Text
Raw Normal View History

2017-07-12 01:45:37 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
2023-10-30 09:43:36 +01:00
email=$(ynh_user_get_info --username="$admin" --key="mail")
Testing (#11) * php 8.0 * dbprefix not empty * php fix * Update install * Update _common.sh * Update manifest.json * database prefix must not be empty dbprefix = ''; // Any random string ending with _ * Update install * Update install sill getting The MySQLi extension is not available * Update install * Phpversion + php dependencies * Update php-fpm.conf upload_max_filesize post_max_size Temp folder * Update _common.sh Php8 + deps * Update manifest.json Remove php choice * Update install YNH_PHP_VERSION * Update install * Update configuration.php * Update install Setting dbprefix to ynh_ Should be random string * Update configuration.php Setting dbprefix to ynh * Adding an upgrade test * Upgrade version * not needed * Cleanup * Updating php dependencies * Cleanup * add /var/log * Update dependencies * adding db_prefix * missing db_prefix during upgrade * Adding secret * better way to create the first account * adding steps to fix dbprefix update * Dbprefix * Delete fix1.jpg * Delete fix2.jpg * Delete fix3.jpg * Delete fix4.jpg * Delete fix5.jpg * Delete dbprefix * Create dbpresfix * Add files via upload * Add files via upload * Update DISCLAIMER.md dbprefix update howto fix * Adding screenshot * Update _common.sh xml * Update DISCLAIMER.md !testme * Auto-update README * Fix docdbprefix screenshots * Auto-update README * more fixing * Auto-update README * typo * Auto-update README Co-authored-by: jarod5001 <68397534+jarod5001@users.noreply.github.com> Co-authored-by: yunohost-bot <yunohost@yunohost.org>
2022-03-23 08:21:02 +01:00
secret=$(ynh_string_random --length="16")
2024-02-01 09:11:08 +01:00
db_prefix="$(ynh_string_random --length="5" | tr '[:upper:]' '[:lower:]' | tr -d '0123456789')_"
Testing (#11) * php 8.0 * dbprefix not empty * php fix * Update install * Update _common.sh * Update manifest.json * database prefix must not be empty dbprefix = ''; // Any random string ending with _ * Update install * Update install sill getting The MySQLi extension is not available * Update install * Phpversion + php dependencies * Update php-fpm.conf upload_max_filesize post_max_size Temp folder * Update _common.sh Php8 + deps * Update manifest.json Remove php choice * Update install YNH_PHP_VERSION * Update install * Update configuration.php * Update install Setting dbprefix to ynh_ Should be random string * Update configuration.php Setting dbprefix to ynh * Adding an upgrade test * Upgrade version * not needed * Cleanup * Updating php dependencies * Cleanup * add /var/log * Update dependencies * adding db_prefix * missing db_prefix during upgrade * Adding secret * better way to create the first account * adding steps to fix dbprefix update * Dbprefix * Delete fix1.jpg * Delete fix2.jpg * Delete fix3.jpg * Delete fix4.jpg * Delete fix5.jpg * Delete dbprefix * Create dbpresfix * Add files via upload * Add files via upload * Update DISCLAIMER.md dbprefix update howto fix * Adding screenshot * Update _common.sh xml * Update DISCLAIMER.md !testme * Auto-update README * Fix docdbprefix screenshots * Auto-update README * more fixing * Auto-update README * typo * Auto-update README Co-authored-by: jarod5001 <68397534+jarod5001@users.noreply.github.com> Co-authored-by: yunohost-bot <yunohost@yunohost.org>
2022-03-23 08:21:02 +01:00
2017-07-12 01:45:37 +02:00
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
2023-10-30 09:43:36 +01:00
ynh_script_progression --message="Storing installation settings..."
2017-07-12 01:45:37 +02:00
Testing (#11) * php 8.0 * dbprefix not empty * php fix * Update install * Update _common.sh * Update manifest.json * database prefix must not be empty dbprefix = ''; // Any random string ending with _ * Update install * Update install sill getting The MySQLi extension is not available * Update install * Phpversion + php dependencies * Update php-fpm.conf upload_max_filesize post_max_size Temp folder * Update _common.sh Php8 + deps * Update manifest.json Remove php choice * Update install YNH_PHP_VERSION * Update install * Update configuration.php * Update install Setting dbprefix to ynh_ Should be random string * Update configuration.php Setting dbprefix to ynh * Adding an upgrade test * Upgrade version * not needed * Cleanup * Updating php dependencies * Cleanup * add /var/log * Update dependencies * adding db_prefix * missing db_prefix during upgrade * Adding secret * better way to create the first account * adding steps to fix dbprefix update * Dbprefix * Delete fix1.jpg * Delete fix2.jpg * Delete fix3.jpg * Delete fix4.jpg * Delete fix5.jpg * Delete dbprefix * Create dbpresfix * Add files via upload * Add files via upload * Update DISCLAIMER.md dbprefix update howto fix * Adding screenshot * Update _common.sh xml * Update DISCLAIMER.md !testme * Auto-update README * Fix docdbprefix screenshots * Auto-update README * more fixing * Auto-update README * typo * Auto-update README Co-authored-by: jarod5001 <68397534+jarod5001@users.noreply.github.com> Co-authored-by: yunohost-bot <yunohost@yunohost.org>
2022-03-23 08:21:02 +01:00
ynh_app_setting_set --app=$app --key=secret --value=$secret
2024-02-01 08:46:25 +01:00
ynh_app_setting_set --app=$app --key=db_prefix --value=$db_prefix
2017-07-12 01:45:37 +02:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2022-01-22 20:55:44 +01:00
ynh_script_progression --message="Setting up source files..."
2017-07-12 01:45:37 +02:00
2023-10-30 09:29:45 +01:00
ynh_setup_source --dest_dir="$install_dir"
2017-07-12 01:45:37 +02:00
2023-10-30 09:29:45 +01:00
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2017-07-12 01:45:37 +02:00
#=================================================
2022-01-22 20:55:44 +01:00
# PHP-FPM CONFIGURATION
2017-07-12 01:45:37 +02:00
#=================================================
2022-01-22 20:55:44 +01:00
ynh_script_progression --message="Configuring PHP-FPM..."
2017-07-12 01:45:37 +02:00
2022-01-22 20:55:44 +01:00
ynh_add_fpm_config
2022-08-27 21:52:03 +02:00
ynh_add_nginx_config
2017-07-12 01:45:37 +02:00
#=================================================
2022-01-22 20:55:44 +01:00
# SPECIFIC SETUP
2017-07-12 01:45:37 +02:00
#=================================================
2022-01-22 20:55:44 +01:00
# ADD A CONFIGURATION
2017-07-12 01:45:37 +02:00
#=================================================
2022-01-22 20:55:44 +01:00
ynh_script_progression --message="Adding a configuration file..."
2017-07-12 01:45:37 +02:00
2023-10-30 09:43:36 +01:00
ynh_add_config --template="configuration.php" --destination="$install_dir/configuration.php"
2022-01-22 20:55:44 +01:00
2023-10-30 09:29:45 +01:00
chmod 400 "$install_dir/configuration.php"
chown $app:$app "$install_dir/configuration.php"
2017-07-12 01:45:37 +02:00
#=================================================
2022-01-22 20:55:44 +01:00
# SETUP DATABASE
2017-07-12 01:45:37 +02:00
#=================================================
2022-01-22 20:55:44 +01:00
ynh_script_progression --message="Setuping database..."
2024-02-01 08:46:25 +01:00
# ynh_mysql_execute_as_root --sql="GRANT ALL PRIVILEGES ON *.* TO '$db_user'@'localhost' IDENTIFIED BY '$db_pwd' WITH GRANT OPTION; FLUSH PRIVILEGES;" --database=$db_name
2024-02-01 00:31:40 +01:00
2024-02-01 08:46:25 +01:00
# ynh_mysql_execute_file_as_root --file="$install_dir/installation/sql/mysql/base.sql" --database=$db_name
# ynh_mysql_execute_file_as_root --file="$install_dir/installation/sql/mysql/extensions.sql" --database=$db_name
# ynh_mysql_execute_file_as_root --file="$install_dir/installation/sql/mysql/supports.sql" --database=$db_name
2023-10-30 10:25:20 +01:00
pushd "$install_dir"
2024-02-01 08:46:25 +01:00
php$phpversion cli/joomla.php user:add --username="$admin" --name="$admin" --password="$password" --email="$email" --usergroup="Super Users" --db-type=mysql --db-host=localhost --db-user=$db_user --db-pass=$db_pwd --db-name=$db_name --db-prefix=$db_prefix -n
popd
Testing (#11) * php 8.0 * dbprefix not empty * php fix * Update install * Update _common.sh * Update manifest.json * database prefix must not be empty dbprefix = ''; // Any random string ending with _ * Update install * Update install sill getting The MySQLi extension is not available * Update install * Phpversion + php dependencies * Update php-fpm.conf upload_max_filesize post_max_size Temp folder * Update _common.sh Php8 + deps * Update manifest.json Remove php choice * Update install YNH_PHP_VERSION * Update install * Update configuration.php * Update install Setting dbprefix to ynh_ Should be random string * Update configuration.php Setting dbprefix to ynh * Adding an upgrade test * Upgrade version * not needed * Cleanup * Updating php dependencies * Cleanup * add /var/log * Update dependencies * adding db_prefix * missing db_prefix during upgrade * Adding secret * better way to create the first account * adding steps to fix dbprefix update * Dbprefix * Delete fix1.jpg * Delete fix2.jpg * Delete fix3.jpg * Delete fix4.jpg * Delete fix5.jpg * Delete dbprefix * Create dbpresfix * Add files via upload * Add files via upload * Update DISCLAIMER.md dbprefix update howto fix * Adding screenshot * Update _common.sh xml * Update DISCLAIMER.md !testme * Auto-update README * Fix docdbprefix screenshots * Auto-update README * more fixing * Auto-update README * typo * Auto-update README Co-authored-by: jarod5001 <68397534+jarod5001@users.noreply.github.com> Co-authored-by: yunohost-bot <yunohost@yunohost.org>
2022-03-23 08:21:02 +01:00
2024-02-01 08:46:25 +01:00
ynh_secure_remove --file="$install_dir/installation"
2022-01-22 20:55:44 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..."
Testing (#11) * php 8.0 * dbprefix not empty * php fix * Update install * Update _common.sh * Update manifest.json * database prefix must not be empty dbprefix = ''; // Any random string ending with _ * Update install * Update install sill getting The MySQLi extension is not available * Update install * Phpversion + php dependencies * Update php-fpm.conf upload_max_filesize post_max_size Temp folder * Update _common.sh Php8 + deps * Update manifest.json Remove php choice * Update install YNH_PHP_VERSION * Update install * Update configuration.php * Update install Setting dbprefix to ynh_ Should be random string * Update configuration.php Setting dbprefix to ynh * Adding an upgrade test * Upgrade version * not needed * Cleanup * Updating php dependencies * Cleanup * add /var/log * Update dependencies * adding db_prefix * missing db_prefix during upgrade * Adding secret * better way to create the first account * adding steps to fix dbprefix update * Dbprefix * Delete fix1.jpg * Delete fix2.jpg * Delete fix3.jpg * Delete fix4.jpg * Delete fix5.jpg * Delete dbprefix * Create dbpresfix * Add files via upload * Add files via upload * Update DISCLAIMER.md dbprefix update howto fix * Adding screenshot * Update _common.sh xml * Update DISCLAIMER.md !testme * Auto-update README * Fix docdbprefix screenshots * Auto-update README * more fixing * Auto-update README * typo * Auto-update README Co-authored-by: jarod5001 <68397534+jarod5001@users.noreply.github.com> Co-authored-by: yunohost-bot <yunohost@yunohost.org>
2022-03-23 08:21:02 +01:00
mkdir -p "/var/log/$app"
chmod 750 "/var/log/$app"
chmod -R o-rwx "/var/log/$app"
chown -R $app:www-data "/var/log/$app"
2022-01-22 20:55:44 +01:00
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
2017-07-12 01:45:37 +02:00
2022-01-22 20:55:44 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2017-07-12 01:45:37 +02:00
2022-01-22 20:55:44 +01:00
ynh_script_progression --message="Installation of $app completed"