2015-05-31 13:46:25 +02:00
|
|
|
#!/bin/bash
|
2017-02-02 03:37:01 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
source _common.sh
|
2015-05-31 13:46:25 +02:00
|
|
|
|
2017-02-02 03:37:01 +01:00
|
|
|
ynh_trap_on
|
2015-05-31 13:46:25 +02:00
|
|
|
|
2017-02-02 03:37:01 +01:00
|
|
|
export app=$YNH_APP_INSTANCE_NAME
|
|
|
|
user=$app
|
2015-05-31 13:46:25 +02:00
|
|
|
|
2017-02-02 03:37:01 +01:00
|
|
|
# Retrieve arguments
|
|
|
|
ynh_export domain path admin is_public language
|
|
|
|
export local_path=/var/www/$app
|
2015-05-31 13:46:25 +02:00
|
|
|
|
2017-02-02 03:37:01 +01:00
|
|
|
#=================================================
|
|
|
|
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
|
|
|
#=================================================
|
|
|
|
ynh_check_var "$app" "app name not set"
|
|
|
|
ynh_user_exists "$admin" || ynh_die "User does not exist: $admin"
|
|
|
|
ynh_normalize_url_path "$path"
|
|
|
|
ynh_path_validity "$domain$path"
|
|
|
|
ynh_local_path_available "$local_path"
|
|
|
|
ynh_local_path_available "$data_path"
|
2015-06-01 00:00:38 +02:00
|
|
|
|
2017-02-02 03:37:01 +01:00
|
|
|
#=================================================
|
|
|
|
# SETUP THE APP BY MODIFYING THE SYSTEM
|
|
|
|
#=================================================
|
2015-05-31 13:46:25 +02:00
|
|
|
|
2017-02-02 03:37:01 +01:00
|
|
|
ynh_save_args domain path admin is_public language local_path
|
2015-05-31 13:46:25 +02:00
|
|
|
|
2017-02-05 23:38:38 +01:00
|
|
|
ynh_app_dependencies php5-imap
|
2015-05-31 13:46:25 +02:00
|
|
|
|
2017-02-02 03:37:01 +01:00
|
|
|
ynh_mysql_generate_db "$user" "$app"
|
2015-05-31 13:46:25 +02:00
|
|
|
|
2017-02-02 03:37:01 +01:00
|
|
|
ynh_system_user_create "$user" "$local_path"
|
2015-06-01 00:00:38 +02:00
|
|
|
|
2017-02-02 03:37:01 +01:00
|
|
|
ynh_setup_source "$local_path" "$user"
|
2015-06-01 00:00:38 +02:00
|
|
|
|
2017-02-02 03:37:01 +01:00
|
|
|
ynh_configure config.php "$local_path/application/config/config.php"
|
2015-05-31 13:46:25 +02:00
|
|
|
|
2017-02-02 03:37:01 +01:00
|
|
|
# Fill LimeSurvey database
|
|
|
|
sed 's/`prefix_/`lime_/g' $local_path/installer/sql/create-mysql.sql > ./structure.sql
|
|
|
|
mysql -u $db_user -p$db_pwd $db_user < ./structure.sql
|
|
|
|
ynh_configure data.sql ./data.sql
|
|
|
|
mysql -u $db_user -p$db_pwd $db_user < ./data.sql
|
2015-05-31 22:36:35 +02:00
|
|
|
|
2015-05-31 13:46:25 +02:00
|
|
|
# Set permissions
|
2017-02-02 03:37:01 +01:00
|
|
|
ynh_set_default_perm $local_path
|
|
|
|
sudo chmod u+w $local_path/tmp
|
2017-02-06 00:40:26 +01:00
|
|
|
sudo chmod u+w $local_path/upload
|
2017-02-02 03:37:01 +01:00
|
|
|
sudo chmod u+w $local_path/application/config/
|
2015-05-31 13:46:25 +02:00
|
|
|
|
|
|
|
sudo yunohost app addaccess $app -u $admin
|
2017-02-06 00:29:42 +01:00
|
|
|
ynh_sso_access "/index.php?r=admin,/index.php?r=plugins,/scripts"
|
2015-05-31 22:36:35 +02:00
|
|
|
|
2017-02-02 03:37:01 +01:00
|
|
|
ynh_configure_php_fpm
|
|
|
|
ynh_configure_nginx
|