Aligner le paquet sur le modèle YunoHost
This commit is contained in:
parent
1a45355ed3
commit
7ae2307abf
16 changed files with 302 additions and 35 deletions
|
|
@ -1,31 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||
#=================================================
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
php_upload_max_filesize="250M"
|
||||
|
||||
install_yunohost_logo() {
|
||||
install -D -m 0644 "$YNH_APP_BASEDIR/logo.png" "/usr/share/yunohost/applogos/$app.png"
|
||||
if ! yunohost app config set "$app" _core.permission_main.permission_main_logo \
|
||||
--value="$YNH_APP_BASEDIR/logo.png" \
|
||||
--core; then
|
||||
ynh_print_warn --message="Le logo du portail YunoHost n'a pas pu être enregistré. L'installation de Globinours continue."
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_persistent_paths() {
|
||||
mkdir -p "$data_dir/association" "$data_dir/grants" "$data_dir/medical-documents" \
|
||||
"$data_dir/private-media" "$data_dir/media" "$data_dir/storage/logs" \
|
||||
"$data_dir/storage/backups" "$data_dir/storage/releases"
|
||||
ynh_safe_rm "$install_dir/data"
|
||||
ynh_safe_rm "$install_dir/storage"
|
||||
ynh_safe_rm "$install_dir/public/media"
|
||||
for path_to_replace in "$install_dir/data" "$install_dir/storage" "$install_dir/public/media"; do
|
||||
if [[ -e "$path_to_replace" || -L "$path_to_replace" ]]; then
|
||||
ynh_safe_rm "$path_to_replace"
|
||||
fi
|
||||
done
|
||||
|
||||
ln -s "$data_dir" "$install_dir/data"
|
||||
ln -s "$data_dir/storage" "$install_dir/storage"
|
||||
ln -s "$data_dir/media" "$install_dir/public/media"
|
||||
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
chown -R "$app:$app" "$data_dir"
|
||||
chmod -R u=rwX,g=rX,o= "$install_dir"
|
||||
chmod -R u=rwX,g=,o= "$data_dir"
|
||||
|
||||
chown "$app:www-data" "$data_dir"
|
||||
chmod 0710 "$data_dir"
|
||||
chown -R "$app:www-data" "$data_dir/media"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA TO BACK UP
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Declaring files to be backed up..."
|
||||
|
||||
ynh_backup "$install_dir"
|
||||
ynh_backup "$data_dir"
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||
|
||||
ynh_print_info "Backup script completed for $app"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
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
|
||||
ynh_systemctl --service=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Change of URL completed for $app"
|
||||
|
|
|
|||
|
|
@ -1,10 +1,47 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
ynh_script_progression --message="Installation de Globinours..."
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Setting up source files..."
|
||||
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# APP INITIAL CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
prepare_persistent_paths
|
||||
install_yunohost_logo
|
||||
|
||||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Adding system configurations related to $app..."
|
||||
|
||||
ynh_config_add_phpfpm
|
||||
ynh_config_add_nginx
|
||||
|
||||
#=================================================
|
||||
# INITIALIZE THE APPLICATION
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Initializing the database..."
|
||||
|
||||
ynh_exec_as_app php "$install_dir/scripts/migrate.php"
|
||||
|
||||
ynh_systemctl --service="php$php_version-fpm" --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Installation of $app completed"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
ynh_safe_rm "/usr/share/yunohost/applogos/$app.png"
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# REMOVE SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Removing system configurations related to $app..."
|
||||
|
||||
ynh_config_remove_nginx
|
||||
ynh_config_remove_phpfpm
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Removal of $app completed"
|
||||
|
|
|
|||
|
|
@ -1,11 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# RESTORE FILES AND DATA
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Restoring application files..."
|
||||
|
||||
ynh_restore "$install_dir"
|
||||
ynh_restore "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Restoring system configurations related to $app..."
|
||||
|
||||
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||
|
||||
prepare_persistent_paths
|
||||
install_yunohost_logo
|
||||
ynh_exec_as_app php "$install_dir/scripts/migrate.php"
|
||||
|
||||
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"
|
||||
|
|
|
|||
|
|
@ -1,19 +1,54 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# CREATE AN APPLICATION BACKUP
|
||||
#=================================================
|
||||
|
||||
if [[ -f "$install_dir/scripts/backup.php" && -f "$data_dir/refuge.sqlite" ]] && \
|
||||
php -l "$install_dir/app/Services/BackupService.php" >/dev/null 2>&1; then
|
||||
ynh_exec_as_app php "$install_dir/scripts/backup.php" pre-upgrade-yunohost
|
||||
elif [[ -f "$data_dir/refuge.sqlite" ]]; then
|
||||
ynh_print_warn --message="La sauvegarde applicative préalable est ignorée car l'ancienne version n'est pas compatible avec PHP $php_version. La sauvegarde de sécurité YunoHost reste active."
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# ENABLE MAINTENANCE MODE
|
||||
#=================================================
|
||||
|
||||
touch "$data_dir/storage/maintenance.flag"
|
||||
trap 'rm -f "$data_dir/storage/maintenance.flag"' EXIT
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Upgrading source files..."
|
||||
|
||||
ynh_setup_source --dest_dir="$install_dir" --full_replace --keep="data storage public/media"
|
||||
|
||||
#=================================================
|
||||
# UPDATE APPLICATION AND SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
prepare_persistent_paths
|
||||
install_yunohost_logo
|
||||
ynh_config_add_phpfpm
|
||||
ynh_config_add_nginx
|
||||
ynh_exec_as_app php "$install_dir/scripts/migrate.php"
|
||||
|
||||
rm -f "$data_dir/storage/maintenance.flag"
|
||||
trap - EXIT
|
||||
|
||||
ynh_systemctl --service="php$php_version-fpm" --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression "Upgrade of $app completed"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue