mirror of
https://github.com/YunoHost-Apps/limesurvey_ynh.git
synced 2024-09-03 19:36:32 +02:00
62 lines
1.8 KiB
Bash
Executable file
62 lines
1.8 KiB
Bash
Executable file
#!/bin/bash
|
|
source /usr/share/yunohost/helpers
|
|
source _common.sh
|
|
|
|
ynh_trap_on
|
|
|
|
export app=$YNH_APP_INSTANCE_NAME
|
|
user=$app
|
|
|
|
# Retrieve arguments
|
|
ynh_export domain path admin is_public language
|
|
export local_path=/var/www/$app
|
|
export prefix=lime_
|
|
|
|
#=================================================
|
|
# 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"
|
|
|
|
#=================================================
|
|
# SETUP THE APP BY MODIFYING THE SYSTEM
|
|
#=================================================
|
|
|
|
ynh_save_args domain path admin is_public language local_path prefix
|
|
|
|
ynh_app_dependencies php5-imap
|
|
|
|
ynh_mysql_generate_db "$user" "$app"
|
|
|
|
ynh_system_user_create "$user" "$local_path"
|
|
|
|
ynh_setup_source "$local_path" "$user"
|
|
|
|
ynh_configure config.php "$local_path/application/config/config.php"
|
|
|
|
# Fill LimeSurvey database
|
|
sed "s/\`prefix_/\`$prefix/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
|
|
|
|
# Randomize Password user
|
|
ls_cli=$local_path/application/commands/console.php
|
|
set +x
|
|
ynh_exec_as "$user" php $ls_cli resetpassword "$admin" "$(ynh_string_random 24)"
|
|
set -x
|
|
|
|
# Set permissions
|
|
ynh_set_default_perm $local_path
|
|
sudo chmod -R u+w $local_path/tmp
|
|
sudo chmod -R u+w $local_path/upload
|
|
sudo chmod -R u+w $local_path/application/config/
|
|
|
|
sudo yunohost app addaccess $app -u $admin
|
|
ynh_sso_access "/index.php?r=admin,/index.php?r=plugins,/scripts"
|
|
|
|
ynh_configure_php_fpm
|
|
ynh_configure_nginx
|