1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/leed_ynh.git synced 2024-09-03 19:26:32 +02:00

Fix upgrade et restore

This commit is contained in:
Maniack Crudelis 2017-03-10 22:11:21 +01:00
parent 9e9bc2309a
commit eef93d04f0
4 changed files with 29 additions and 6 deletions

View file

@ -64,6 +64,22 @@ SETUP_SOURCE () { # Télécharge la source, décompresse et copie dans $final_pa
fi
}
SETUP_SOURCE_ZIP () { # Télécharge la source, décompresse et copie dans $final_path
src_url=$(cat ../conf/app.src | grep SOURCE_URL | cut -d= -f2)
src_checksum=$(cat ../conf/app.src | grep SOURCE_SUM | cut -d= -f2)
# Download sources from the upstream
wget -nv -O source.zip $src_url
# Vérifie la somme de contrôle de la source téléchargée.
echo "$src_checksum source.zip" | md5sum -c --status || ynh_die "Corrupt source"
# Extract source into the app dir
sudo mkdir -p $final_path
sudo unzip -quo source.zip -d $final_path
# Copie les fichiers additionnels ou modifiés.
if test -e "../sources/ajouts"; then
sudo cp -a ../sources/ajouts/. "$final_path"
fi
}
ADD_SYS_USER () { # Créer un utilisateur système dédié à l'app
if ! ynh_system_user_exists "$app" # Test l'existence de l'utilisateur
then
@ -349,7 +365,7 @@ Section: misc
Priority: optional
Package: ${dep_app}-ynh-deps
Version: ${version}
Depends: ${dependencies}
Depends: ${dependencies// /, }
Architecture: all
Description: Fake package for ${app} (YunoHost app) dependencies
This meta-package is only responsible of installing its dependencies.
@ -364,7 +380,7 @@ EOF
#
# usage: ynh_remove_app_dependencies
ynh_remove_app_dependencies () {
dep_app=${app/_/-} # Replace all '_' by '-'
dep_app=${app//_/-} # Replace all '_' by '-'
ynh_package_autoremove ${dep_app}-ynh-deps # Remove the fake package and its dependencies if they not still used.
}
@ -380,7 +396,7 @@ ynh_remove_app_dependencies () {
#
# It's possible to use this helper several times, each config will added to same logrotate config file.
ynh_use_logrotate () {
if [ -n "$1" ]; then
if [ "$#" -gt 0 ]; then
if [ "$(echo ${1##*.})" == "log" ]; then # Keep only the extension to check if it's a logfile
logfile=$1 # In this case, focus logrotate on the logfile
else

View file

@ -108,7 +108,7 @@ YNH_CURL "install_changeLngLeed=$language&root=$domain$path_url&mysqlHost=localh
#=================================================
# ACTIVATE LEED MARKET
#=================================================
ynh_app_setting_get $app market "$market"
ynh_app_setting_set $app market "$market"
if [ $market -eq 1 ]
then
sudo rm -R $final_path/plugins
@ -154,7 +154,7 @@ then
# Retire l'autorisation d'accès de la page d'install.
ynh_app_setting_delete $app unprotected_uris
# Rend la page d'actualisation accessible pour le script cron.
ynh_app_setting_get $app skipped_uris "/action.php"
ynh_app_setting_set $app skipped_uris "/action.php"
fi
#=================================================

View file

@ -82,8 +82,15 @@ sudo cp -a ./php-fpm.ini /etc/php5/fpm/conf.d/20-$app.ini
#=================================================
# RESTORE OF THE CRON FILE
#=================================================
sudo cp -a "cron" "/etc/cron.d/$app"
#=================================================
# RESTORE USER RIGHTS
#=================================================
sudo chown -R $app $final_path/cache $final_path/plugins $final_path/updates
#=================================================
# GENERIC FINALISATION
#=================================================

View file

@ -90,7 +90,7 @@ SETUP_SOURCE # Télécharge la source, décompresse et copie dans $final_path
# Copie le fichier de config nginx
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Modifie les variables dans le fichier de configuration nginx
sudo sed -i "s@__PATH__@$path_url@g" /etc/nginx/conf.d/$domain.d/$app.conf
sudo sed -i "s@__PATHTOCHANGE__@$path_url@g" /etc/nginx/conf.d/$domain.d/$app.conf
sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/nginx/conf.d/$domain.d/$app.conf
sudo sed -i "s@__NAMETOCHANGE__@$app@g" /etc/nginx/conf.d/$domain.d/$app.conf