77 lines
2.6 KiB
Bash
Executable file
77 lines
2.6 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression "Setting up source files..."
|
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
|
chown -R "$app:www-data" "$install_dir"
|
|
|
|
#=================================================
|
|
# APP INITIAL CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression "Adding $app's configuration files..."
|
|
|
|
ynh_config_add --template=.env --destination="$install_dir/.env"
|
|
|
|
chmod 640 "$install_dir/.env"
|
|
chown "$app:www-data" "$install_dir/.env"
|
|
|
|
#=================================================
|
|
# SYSTEM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression "Adding system configurations related to $app..."
|
|
|
|
ynh_config_add_nginx
|
|
|
|
#=================================================
|
|
# INSTALL APP WITH COMPOSER
|
|
#=================================================
|
|
ynh_script_progression "Installing app with Composer..."
|
|
|
|
ynh_composer_install
|
|
ynh_composer_exec install --no-dev
|
|
|
|
#=================================================
|
|
# BUILDING
|
|
#=================================================
|
|
ynh_script_progression "configuring $app..."
|
|
|
|
pushd "$install_dir"
|
|
"php$php_version" artisan key:generate -n --force --env
|
|
"php$php_version" artisan make:database $app
|
|
"php$php_version" artisan migrate:fresh --seed -n --force
|
|
"php$php_version" artisan config:clear -n
|
|
"php$php_version" artisan config:cache -n
|
|
popd
|
|
|
|
|
|
# file was touched by artisan, create a new key (copy/paste from Lychee)
|
|
ynh_store_file_checksum "$install_dir/.env"
|
|
app_key=$(cat $install_dir/.env | grep -e ^APP_KEY | cut -c 9-)
|
|
ynh_app_setting_set --key=app_key --value=$app_key
|
|
|
|
# group only, make it www-data vs user/group $app:www-data
|
|
chgrp "www-data" -R "$install_dir/storage" "$install_dir/public"
|
|
chmod -R 2775 "$install_dir/storage" "$install_dir/app" "$install_dir/public" "$install_dir/bootstrap/"
|
|
|
|
#=================================================
|
|
# SETUP APPLICATION WITH CURL
|
|
#=================================================
|
|
ynh_script_progression "Finalizing installation..."
|
|
|
|
# Installation with curl: set up the first/single user
|
|
ynh_local_curl "/index.php/register" "name=$user" "email=$email" "password=$password" "password_confirmation=$password"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
ynh_script_progression "Installation of $app completed"
|