1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/plainpad_ynh.git synced 2024-09-03 20:05:53 +02:00
plainpad_ynh/scripts/install

68 lines
2 KiB
Text
Raw Normal View History

2021-08-14 12:46:57 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
key=$(ynh_string_random --length=32)
2021-08-14 13:53:49 +02:00
ynh_app_setting_set --app=$app --key=key --value=$key
2021-08-14 12:46:57 +02:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
2023-03-27 18:56:29 +02:00
ynh_setup_source --dest_dir="$install_dir"
2021-08-14 12:46:57 +02:00
2023-03-27 18:56:29 +02:00
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2021-08-14 12:46:57 +02:00
#=================================================
2023-08-17 22:13:02 +02:00
# SYSTEM CONFIGURATION
2021-08-14 12:46:57 +02:00
#=================================================
2023-08-17 22:13:02 +02:00
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
2021-08-14 12:46:57 +02:00
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated PHP-FPM config
2024-06-19 21:27:03 +02:00
ynh_add_fpm_config
2021-08-14 12:46:57 +02:00
2023-08-17 22:13:02 +02:00
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
2021-08-14 12:46:57 +02:00
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
2024-06-19 21:27:03 +02:00
ynh_add_config --template=".env.example" --destination="$install_dir/.env"
2021-08-14 12:46:57 +02:00
2023-03-27 18:56:29 +02:00
chmod 400 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
2021-08-14 12:46:57 +02:00
#=================================================
# SPECIFIC SETUP
#=================================================
ynh_script_progression --message="Migrating database..." --weight=1
2023-03-27 18:56:29 +02:00
pushd "$install_dir"
2022-04-05 12:35:42 +02:00
php$phpversion artisan migrate:fresh -n --seed
2021-08-14 12:46:57 +02:00
popd
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last