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

73 lines
2.6 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# 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")
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"
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"
chmod 600 "$install_dir/.env"
chown "$app:$app" "$install_dir/.env"
#=================================================
# 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"
#=================================================
# FINAL FREESCOUT INSTALL
#=================================================
ynh_script_progression --message="Finalizing $app installation..." --weight=1
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
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
popd
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last