2023-11-20 23:01:30 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2024-06-19 21:30:51 +02:00
|
|
|
#=================================================
|
|
|
|
# INITIALIZE AND STORE SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
email=$(ynh_user_get_info --username="$admin" --key="mail")
|
|
|
|
firstname=$(ynh_user_get_info --username="$admin" --key="firstname")
|
|
|
|
lastname=$(ynh_user_get_info --username="$admin" --key="lastname")
|
2023-11-20 23:01:30 +01:00
|
|
|
timezone=$(cat /etc/timezone)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
|
|
|
|
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
|
|
|
|
2024-06-19 21:30:51 +02:00
|
|
|
chmod ug=rwX,o-rwx "$install_dir"
|
|
|
|
chown -R "$app:www-data" "$install_dir"
|
|
|
|
|
|
|
|
usermod -g www-data "$app"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# APP INITIAL CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Adding $app's configuration files..." --weight=1
|
|
|
|
|
|
|
|
ynh_add_config --template=".env.example" --destination="$install_dir/.env"
|
2023-11-21 19:22:54 +01:00
|
|
|
|
2024-06-19 21:30:51 +02:00
|
|
|
chmod 600 "$install_dir/.env"
|
|
|
|
chown "$app:$app" "$install_dir/.env"
|
2023-11-20 23:01:30 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SYSTEM CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
|
|
|
|
|
|
ynh_add_fpm_config
|
|
|
|
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
|
|
|
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
|
|
|
|
chown root: "/etc/cron.d/$app"
|
|
|
|
chmod 644 "/etc/cron.d/$app"
|
|
|
|
|
|
|
|
#=================================================
|
2024-06-19 21:30:51 +02:00
|
|
|
# FINAL FREESCOUT INSTALL
|
2023-11-20 23:01:30 +01:00
|
|
|
#=================================================
|
2024-06-19 21:30:51 +02:00
|
|
|
ynh_script_progression --message="Finalizing $app installation..." --weight=1
|
2023-11-20 23:01:30 +01:00
|
|
|
|
2024-06-19 21:30:51 +02:00
|
|
|
pushd "$install_dir"
|
|
|
|
"php$phpversion" artisan key:generate --no-interaction --force
|
|
|
|
"php$phpversion" artisan freescout:clear-cache
|
|
|
|
"php$phpversion" artisan storage:link
|
|
|
|
"php$phpversion" artisan migrate --no-interaction --force
|
|
|
|
"php$phpversion" artisan freescout:create-user --role="admin" --firstName="$firstname" --lastName="$lastname" --email="$email" --password="$password" --no-interaction
|
2023-11-20 23:01:30 +01:00
|
|
|
|
2024-06-19 21:30:51 +02:00
|
|
|
chgrp -R www-data storage bootstrap/cache public/css/builds public/js/builds
|
|
|
|
chmod -R ug+rwx storage bootstrap/cache public/css/builds public/js/builds
|
2023-11-20 23:01:30 +01:00
|
|
|
popd
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|