2022-05-22 20:54:12 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2024-08-31 03:06:04 +02:00
|
|
|
ynh_app_setting_set --key=php_upload_max_filesize --value=256M
|
|
|
|
|
2022-05-22 20:54:12 +02:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2024-08-31 03:06:04 +02:00
|
|
|
ynh_script_progression "Setting up source files..."
|
2022-05-22 20:54:12 +02:00
|
|
|
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-05-12 20:38:15 +02:00
|
|
|
source_id_to_use="main"
|
2023-05-12 21:04:57 +02:00
|
|
|
if [[ "$release_cycle" == "longterm" ]]
|
2023-05-12 20:38:15 +02:00
|
|
|
then
|
|
|
|
source_id_to_use="lts"
|
|
|
|
fi
|
|
|
|
|
|
|
|
ynh_setup_source --dest_dir="$install_dir" --source_id="$source_id_to_use"
|
2022-05-22 20:54:12 +02:00
|
|
|
|
|
|
|
#=================================================
|
2024-08-31 15:36:19 +02:00
|
|
|
# SYSTEM CONFIGURATION
|
2022-05-22 20:54:12 +02:00
|
|
|
#=================================================
|
2024-08-31 15:36:19 +02:00
|
|
|
ynh_script_progression "Adding system configurations related to $app..."
|
2022-05-22 20:54:12 +02:00
|
|
|
|
2024-08-31 03:06:04 +02:00
|
|
|
ynh_config_add_nginx
|
2022-05-22 20:54:12 +02:00
|
|
|
|
2024-08-31 03:06:04 +02:00
|
|
|
ynh_config_add_phpfpm
|
2022-05-22 20:54:12 +02:00
|
|
|
|
|
|
|
#=================================================
|
2023-02-21 21:51:30 +01:00
|
|
|
# ADD INITIAL CONFIGURATION
|
2022-05-22 20:54:12 +02:00
|
|
|
#=================================================
|
2024-08-31 03:06:04 +02:00
|
|
|
ynh_script_progression "Configuring $app..."
|
2022-05-22 20:54:12 +02:00
|
|
|
|
2023-02-21 21:51:30 +01:00
|
|
|
# Define a function to execute commands with proper permissions
|
|
|
|
exec_as_app() {
|
2024-08-31 03:06:04 +02:00
|
|
|
(cd "$install_dir" && ynh_exec_as_app \
|
|
|
|
php${php_version} --define apc.enable_cli=1 "$@")
|
2023-02-21 21:51:30 +01:00
|
|
|
}
|
|
|
|
|
2023-03-01 15:18:04 +01:00
|
|
|
# Create database configuration file
|
2024-08-31 03:06:04 +02:00
|
|
|
ynh_hide_warnings exec_as_app console.php database:configure "$app" "$db_pwd" "$app"
|
2023-02-21 21:51:30 +01:00
|
|
|
|
2023-03-01 15:15:43 +01:00
|
|
|
# Create database contents
|
2024-08-31 03:06:04 +02:00
|
|
|
ynh_hide_warnings exec_as_app console.php database:install
|
2023-02-21 21:51:30 +01:00
|
|
|
|
2023-06-06 20:53:53 +02:00
|
|
|
# Set default database directory
|
2023-06-06 21:31:30 +02:00
|
|
|
cd "$install_dir"
|
2023-06-09 22:34:03 +02:00
|
|
|
sed -i -e "s#storage/fgal#$data_dir#" lib/prefs/fgal.php
|
2023-03-01 15:15:43 +01:00
|
|
|
# Lock installer
|
2024-08-31 03:06:04 +02:00
|
|
|
ynh_hide_warnings exec_as_app console.php installer:lock
|
2022-05-22 20:54:12 +02:00
|
|
|
|
2023-03-01 15:15:43 +01:00
|
|
|
# Create data index
|
2024-08-31 03:06:04 +02:00
|
|
|
ynh_hide_warnings exec_as_app console.php index:rebuild
|
2022-05-22 20:54:12 +02:00
|
|
|
|
2023-03-01 15:15:43 +01:00
|
|
|
# Set on Long Term Support versions
|
2023-06-06 20:53:53 +02:00
|
|
|
if [[ "$release_cycle" == "longterm" ]]
|
|
|
|
then
|
2024-08-31 03:06:04 +02:00
|
|
|
ynh_hide_warnings exec_as_app console.php preferences:set tiki_release_cycle longterm
|
2023-06-06 20:53:53 +02:00
|
|
|
fi
|
2022-05-22 20:54:12 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2024-08-31 03:06:04 +02:00
|
|
|
ynh_script_progression "Installation of $app completed"
|