add files
This commit is contained in:
5
scripts/_common.sh
Normal file
5
scripts/_common.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||
#=================================================
|
35
scripts/backup
Normal file
35
scripts/backup
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_print_info "Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||
|
||||
ynh_backup "/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the MySQL database..."
|
||||
|
||||
ynh_mysql_dump_db > db.sql
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
28
scripts/change_url
Normal file
28
scripts/change_url
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression "Updating NGINX web server configuration..."
|
||||
|
||||
ynh_config_change_url_nginx
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
ynh_script_progression "Configuring $app..."
|
||||
|
||||
domain="$new_domain"
|
||||
path="$new_path"
|
||||
domain_path="https://$domain$path"
|
||||
|
||||
ynh_config_add --template="config.dist.php" --destination="$install_dir/config.php"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Change of URL completed for $app"
|
56
scripts/install
Normal file
56
scripts/install
Normal file
@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_app_setting_set --key=php_upload_max_filesize --value=256M
|
||||
|
||||
mail="$(ynh_user_get_info --username=$admin --key=mail)"
|
||||
fullname="$(ynh_user_get_info --username=$admin --key=fullname)"
|
||||
echo "Admin=$admin" > /tmp/debug.txt
|
||||
echo "Mail=$mail" >> /tmp/debug.txt
|
||||
echo "Full Name=$fullname" >> /tmp/debug.txt
|
||||
echo "domaine=$domain" >> /tmp/debug.txt
|
||||
ls ../conf/* >> /tmp/debug.txt
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression "Setting up source files..."
|
||||
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression "Adding $app's configuration..."
|
||||
|
||||
ynh_config_add --template="config.dist.php" --destination="$install_dir/config.php"
|
||||
|
||||
#=================================================
|
||||
# DATABASE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression "Adding database configuration..."
|
||||
|
||||
sed -i "s/__YNH_ADMIN__/$admin/g" "../conf/SCHEMA.sql"
|
||||
sed -i "s/__YNH_REAL_NAME__/$fullname/g" "../conf/SCHEMA.sql"
|
||||
sed -i "s/__YNH_EMAIL__/$mail/g" "../conf/SCHEMA.sql"
|
||||
sed -i "s/__YNH_dom__/$domain/g" "../conf/SCHEMA.sql"
|
||||
|
||||
ynh_mysql_db_shell < ../conf/SCHEMA.sql
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression "Configuring NGINX web server..."
|
||||
|
||||
ynh_config_add_nginx
|
||||
|
||||
ynh_config_add_phpfpm
|
||||
|
||||
ynh_config_add_logrotate
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Installation of $app completed"
|
21
scripts/remove
Normal file
21
scripts/remove
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression "Removing NGINX web server configuration..."
|
||||
|
||||
ynh_config_remove_nginx
|
||||
|
||||
ynh_config_remove_phpfpm
|
||||
|
||||
ynh_config_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Removal of $app completed"
|
43
scripts/restore
Normal file
43
scripts/restore
Normal file
@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression "Restoring the app main directory..."
|
||||
|
||||
ynh_restore "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression "Restoring the MySQL database..."
|
||||
|
||||
ynh_mysql_db_shell < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression "Restoring the PHP-FPM configuration..."
|
||||
|
||||
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||
|
||||
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
ynh_restore "/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression "Reloading NGINX web server and PHP-FPM..."
|
||||
|
||||
ynh_systemctl --service=php$php_version-fpm --action=reload
|
||||
ynh_systemctl --service=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Restoration completed for $app"
|
37
scripts/upgrade
Normal file
37
scripts/upgrade
Normal file
@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_app_setting_set_default --key=php_upload_max_filesize --value=256M
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression "Upgrading source files..."
|
||||
|
||||
ynh_setup_source --dest_dir="$install_dir" --full_replace
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression "Upgrading NGINX web server configuration..."
|
||||
|
||||
ynh_config_add_nginx
|
||||
|
||||
ynh_config_add_phpfpm
|
||||
|
||||
ynh_config_add_logrotate
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression "Updating configuration..."
|
||||
|
||||
ynh_config_add --template="config.dist.php" --destination="$install_dir/config.php"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Upgrade of $app completed"
|
Reference in New Issue
Block a user