mirror of
https://github.com/YunoHost-Apps/paheko_ynh.git
synced 2024-09-03 19:56:22 +02:00
Merge pull request #33 from YunoHost-Apps/rodinux-patch-1
Fix data upgrade
This commit is contained in:
commit
22854b53e3
8 changed files with 42 additions and 20 deletions
|
@ -21,7 +21,7 @@ Paheko (we chose the name Paheko, a word from the Māori language meaning "to co
|
|||
It is the tool of choice for managing an association, a sports club, an NGO, etc. It is designed to meet the needs of a small to medium-sized structure: management of members, accounting, website, note-taking in meetings, archiving and sharing of the association's operating documents, discussion between members, etc. etc..
|
||||
|
||||
|
||||
**Shipped version:** 1.2.11~ynh4
|
||||
**Shipped version:** 1.2.11~ynh5
|
||||
|
||||
**Demo:** https://paheko.cloud/essai/
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ Paheko (Nous avons choisi le nom Paheko, un mot de la langue Māori qui signifie
|
|||

|
||||
|
||||
|
||||
**Version incluse :** 1.2.11~ynh4
|
||||
**Version incluse :** 1.2.11~ynh5
|
||||
|
||||
**Démo :** https://paheko.cloud/essai/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
* NE PAS MODIFIER CE FICHIER. Il est regénéré automatiquement à chaque mise à jour de Yunohost
|
||||
*
|
||||
* Pour ajouter vos configurations personnalisées, rendez-vous dans le fichier config.local.user.php
|
||||
* Pour ajouter vos configurations personnalisées, rendez-vous dans le fichier data/config.local.user.php
|
||||
*/
|
||||
require '__INSTALL_DIR__/config.local.yunohost.php';
|
||||
require '__INSTALL_DIR__/config.local.user.php';
|
||||
require '__INSTALL_DIR__/data/config.local.user.php';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* Ce fichier sera mis à jour à chaque nouvelle version de Yunohost
|
||||
*
|
||||
* Pour ajouter vos configurations personnalisées, rendez-vous dans le fichier config.local.user.php
|
||||
* Pour ajouter vos configurations personnalisées, rendez-vous dans le fichier data/config.local.user.php
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ name = "Paheko"
|
|||
description.en = "Software to manage association"
|
||||
description.fr = "Logiciel libre de gestion d'association"
|
||||
|
||||
version = "1.2.11~ynh4"
|
||||
version = "1.2.11~ynh5"
|
||||
|
||||
maintainers = ["rodinux"]
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
|
|||
# Install configuration files
|
||||
ynh_add_config --template="config.local.php" --destination="$install_dir/config.local.php"
|
||||
ynh_add_config --template="config.local.yunohost.php" --destination="$install_dir/config.local.yunohost.php"
|
||||
ynh_add_config --template="config.local.user.php" --destination="$install_dir/config.local.user.php"
|
||||
ynh_add_config --template="config.local.user.php" --destination="$install_dir/data/config.local.user.php"
|
||||
|
||||
# Permissions on files and directories
|
||||
chmod -R o-rwx "$install_dir"
|
||||
|
@ -61,7 +61,7 @@ find "$install_dir/data" -type d -exec chmod 770 {} +
|
|||
find "$install_dir/data" -type f -exec chmod 660 {} +
|
||||
chmod 440 "$install_dir/config.local.php"
|
||||
chmod 440 "$install_dir/config.local.yunohost.php"
|
||||
chmod 660 "$install_dir/config.local.user.php"
|
||||
chmod 660 "$install_dir/data/config.local.user.php"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -26,7 +26,10 @@ find "$install_dir/data" -type d -exec chmod 770 {} +
|
|||
find "$install_dir/data" -type f -exec chmod 660 {} +
|
||||
chmod 440 "$install_dir/config.local.php"
|
||||
chmod 440 "$install_dir/config.local.yunohost.php"
|
||||
|
||||
if [ -f "$install_dir/config.local.user.php" ]; then
|
||||
chmod 660 "$install_dir/config.local.user.php"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
|
|
|
@ -30,12 +30,17 @@ if [[ -z "${secret_key:-}" ]]; then
|
|||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP SQLITE DATABASE
|
||||
# BACKUP DATABASE, DATAS AND CONFIG LOCAL USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backup of the DB in temporary file...." --weight=5
|
||||
|
||||
if [ -f "$install_dir/data/association.sqlite" ];then
|
||||
cp -a $install_dir/data/association.sqlite /tmp/
|
||||
|
||||
# copy data directory backup
|
||||
tmp_data_backup=$(mktemp -d)
|
||||
rsync -a $install_dir/data/ $tmp_data_backup/
|
||||
|
||||
if [ -f "$install_dir/config.local.user.php" ]; then
|
||||
cp -a $install_dir/config.local.user.php $tmp_data_backup/
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -47,7 +52,7 @@ then
|
|||
ynh_script_progression --message="Upgrading source files..." --weight=5
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir" --keep="association.sqlite data config.local.user.php" --full_replace=1
|
||||
ynh_setup_source --dest_dir="$install_dir" --full_replace=1
|
||||
fi
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
|
@ -78,17 +83,25 @@ ynh_script_progression --message="Updating a configuration file..." --weight=5
|
|||
|
||||
if ynh_compare_current_package_version --comparison lt --version 1.1.15~ynh1; then
|
||||
chmod 750 "$install_dir/config.local.user.php"
|
||||
ynh_add_config --template="config.local.user.php" --destination="$install_dir/config.local.user.php"
|
||||
ynh_add_config --template="config.local.user.php" --destination="$install_dir/data/config.local.user.php"
|
||||
fi
|
||||
|
||||
# NOTE: Don't overwrite config.local.user.php
|
||||
ynh_add_config --template="config.local.php" --destination="$install_dir/config.local.php"
|
||||
ynh_add_config --template="config.local.yunohost.php" --destination="$install_dir/config.local.yunohost.php"
|
||||
|
||||
# Restore the sqlite DB
|
||||
if [ -f "/tmp/association.sqlite" ];then
|
||||
mv /tmp/association.sqlite $install_dir/data
|
||||
fi
|
||||
#=================================================
|
||||
# RESTORE BACKUP SQLITE DATABASE AND DATAS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restore datas..." --weight=5
|
||||
|
||||
# Sync data directory backup
|
||||
rsync -a $tmp_data_backup/ $install_dir/data/
|
||||
|
||||
#=================================================
|
||||
# FIX PERMISSIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Fix permissions..." --weight=2
|
||||
|
||||
# Permissions on files and directories
|
||||
chmod -R o-rwx "$install_dir"
|
||||
|
@ -99,7 +112,7 @@ find "$install_dir/data" -type d -exec chmod 770 {} +
|
|||
find "$install_dir/data" -type f -exec chmod 660 {} +
|
||||
chmod 440 "$install_dir/config.local.php"
|
||||
chmod 440 "$install_dir/config.local.yunohost.php"
|
||||
chmod 660 "$install_dir/config.local.user.php"
|
||||
chmod 660 "$install_dir/data/config.local.user.php"
|
||||
|
||||
#=================================================
|
||||
# FINALISE UPGRADE
|
||||
|
@ -111,10 +124,16 @@ sleep 5
|
|||
ynh_local_curl "/index.php"
|
||||
sleep 5
|
||||
|
||||
# remove data directory backup
|
||||
ynh_secure_remove --file="$tmp_data_backup"
|
||||
|
||||
# clean duplicate folder if exist
|
||||
if [ -d "$install_dir/data/data" ]
|
||||
ynh_secure_remove --file="$install_dir/data/data"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
# remove directory duplicated
|
||||
ynh_secure_remove --file="$install_dir/data/data"
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
|
|
Loading…
Add table
Reference in a new issue