[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot
2024-08-30 23:37:07 +02:00
committed by Alexandre Aubin
parent e188966560
commit 2a9f75b936
13 changed files with 104 additions and 211 deletions
+27 -35
View File
@@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
@@ -23,73 +17,71 @@ email="$(ynh_user_get_info --username=$admin --key=mail)"
#=================================================
# STORE KEYS TO APP SETTINGS
#=================================================
ynh_script_progression --message="Storing secrets to app settings..."
ynh_script_progression "Storing secrets to app settings..."
ynh_app_setting_set --app=$app --key=api_secret --value=$api_secret
ynh_app_setting_set --app=$app --key=app_key --value=$app_key
ynh_app_setting_set --app=$app --key=phantomjs_key --value=$phantomjs_key
ynh_app_setting_set --key=api_secret --value=$api_secret
ynh_app_setting_set --key=app_key --value=$app_key
ynh_app_setting_set --key=phantomjs_key --value=$phantomjs_key
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
ynh_script_progression "Setting up source files..."
ynh_setup_source --dest_dir="$install_dir"
chown -R $app:www-data "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
ynh_config_add_phpfpm
# Create a dedicated nginx config
ynh_add_nginx_config
ynh_config_add_nginx
#=================================================
# SPECIFIC SETUP
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..." --weight=1
ynh_script_progression "Updating configuration..."
ynh_add_config --template="default.env" --destination="$install_dir/.env"
ynh_config_add --template="default.env" --destination="$install_dir/.env"
chmod 600 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 600 "$install_dir/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/.env"
#=================================================
# BUILD THE APPLICATION
#=================================================
ynh_script_progression --message="Building the application..." --weight=1
ynh_script_progression "Building the application..."
pushd "$install_dir"
# Run the database migrations and initially fill the db
php$phpversion artisan migrate:fresh --seed --no-interaction --verbose --force
php$phpversion artisan ninja:create-account --email $email --password "$password" --no-interaction --verbose
php$phpversion artisan optimize --no-interaction --verbose
php$phpversion artisan view:clear
php$phpversion artisan cache:clear
php$php_version artisan migrate:fresh --seed --no-interaction --verbose --force
php$php_version artisan ninja:create-account --email $email --password "$password" --no-interaction --verbose
php$php_version artisan optimize --no-interaction --verbose
php$php_version artisan view:clear
php$php_version artisan cache:clear
popd
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=================================================
# ADD A CRON JOB
#=================================================
ynh_script_progression --message="Adding a cron job..." --weight=1
ynh_script_progression "Adding a cron job..."
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
ynh_config_add --template="cron" --destination="/etc/cron.d/$app"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root: "/etc/cron.d/$app"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 "/etc/cron.d/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed"
ynh_script_progression "Installation of $app completed"