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

99 lines
3.3 KiB
Text
Raw Normal View History

#!/bin/bash
2018-03-13 21:49:11 +01:00
#=================================================
2022-01-14 01:29:27 +01:00
# GENERIC START
2018-03-13 21:49:11 +01:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-02-02 03:37:01 +01:00
source _common.sh
2021-07-12 13:54:37 +02:00
source /usr/share/yunohost/helpers
2018-03-13 21:49:11 +01:00
#=================================================
2024-01-23 16:40:33 +01:00
# INITIALIZE AND STORE SETTINGS
2018-03-13 21:49:11 +01:00
#=================================================
2024-01-23 16:40:33 +01:00
# Database prefix
2022-06-16 00:33:32 +02:00
prefix=lime_
2024-01-23 18:30:28 +01:00
ynh_app_setting_set --app="$app" --key=prefix --value="$prefix"
2021-07-12 12:11:43 +02:00
2018-03-13 21:49:11 +01:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2021-07-12 12:11:43 +02:00
ynh_script_progression --message="Setting up source files..." --weight=1
2018-03-13 21:49:11 +01:00
# Download, check integrity, uncompress and patch the source from app.src
2024-01-23 16:40:33 +01:00
ynh_setup_source --dest_dir="$install_dir"
2021-07-12 12:28:53 +02:00
2024-01-23 18:30:28 +01:00
# Move upload directory to data_dir, with a symlink
2024-01-23 18:49:28 +01:00
if [ -d "$data_dir/upload" ]; then
2024-01-23 19:35:26 +01:00
ynh_print_warn "An upload directory already exist, reusing it."
2024-01-23 18:49:28 +01:00
else
mv "$install_dir/upload" "$data_dir"
fi
2024-01-23 16:40:33 +01:00
ln -s "$data_dir/upload" "$install_dir/upload"
2018-03-13 21:49:11 +01:00
2024-01-23 16:40:33 +01:00
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
2022-01-14 01:29:27 +01:00
2022-01-14 02:31:12 +01:00
#=================================================
2022-06-15 23:45:27 +02:00
# ADD A CONFIGURATION
2022-01-14 02:31:12 +01:00
#=================================================
2022-06-15 23:45:27 +02:00
ynh_script_progression --message="Adding a configuration file..." --weight=1
2022-01-14 02:31:12 +01:00
2024-01-23 16:40:33 +01:00
ynh_add_config --template="../conf/config.php" --destination="$install_dir/application/config/config.php"
2022-01-14 02:31:12 +01:00
2024-01-23 16:40:33 +01:00
chmod 400 "$install_dir/application/config/config.php"
chown "$app:$app" "$install_dir/application/config/config.php"
2022-06-15 23:45:27 +02:00
2018-03-13 21:49:11 +01:00
#=================================================
2022-06-15 23:45:27 +02:00
# INSTALL APP
2018-03-13 21:49:11 +01:00
#=================================================
2022-06-15 23:45:27 +02:00
ynh_script_progression --message="Installing app..."
2021-07-12 12:11:43 +02:00
2024-01-23 16:40:33 +01:00
ls_cli="$install_dir/application/commands/console.php"
2021-07-12 14:45:08 +02:00
2022-06-15 23:45:27 +02:00
fullname=$(ynh_user_get_info --username="$admin" --key="fullname")
mail=$(ynh_user_get_info --username="$admin" --key="mail")
# Permission should be correctly set before to do this
2024-01-23 16:40:33 +01:00
ynh_exec_as "$app" "php$phpversion" "$ls_cli" install "$admin" "$password" "$fullname" "$mail"
2018-03-13 21:49:11 +01:00
#=================================================
# LOAD SQL SPECIFIC CONFIG
2018-03-13 21:49:11 +01:00
#=================================================
2022-06-15 23:45:27 +02:00
ynh_script_progression --message="Loading SQL specific config..."
2022-01-14 01:29:27 +01:00
ynh_add_config --template="../conf/data.sql" --destination="./data.sql"
2021-07-12 12:11:43 +02:00
2022-01-14 01:29:27 +01:00
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./data.sql
2021-08-29 18:28:18 +02:00
2022-01-14 01:29:27 +01:00
ynh_secure_remove --file=./data.sql
2021-07-12 12:35:11 +02:00
2018-03-13 21:49:11 +01:00
#=================================================
2022-06-15 23:45:27 +02:00
# ADD NICE THEMES
#=================================================
2022-06-15 23:45:27 +02:00
#ynh_script_progression --message="Adding nice themes..."
2021-07-12 13:35:31 +02:00
2024-01-23 16:40:33 +01:00
#ynh_setup_source "$data_dir/upload/templates/libreform" libreform
#ynh_setup_source "$install_dir/upload/templates/librepoll" librepoll
2018-03-13 21:49:11 +01:00
#=================================================
2024-01-23 16:40:33 +01:00
# SYSTEM CONFIGURATION
2018-03-13 21:49:11 +01:00
#=================================================
2024-01-23 16:40:33 +01:00
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
2021-07-12 14:06:32 +02:00
2024-01-23 16:40:33 +01:00
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
2021-07-12 14:06:32 +02:00
2024-01-23 16:40:33 +01:00
# Create a dedicated NGINX config
ynh_add_nginx_config
2021-07-12 12:28:53 +02:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last