mirror of
https://github.com/YunoHost-Apps/lufi_ynh.git
synced 2024-09-03 19:36:28 +02:00
[fix] upgrade
This commit is contained in:
parent
2f33598ba0
commit
a99318d1c7
2 changed files with 34 additions and 2 deletions
|
@ -203,6 +203,38 @@ BACKUP_BEFORE_UPGRADE () { # Backup the current version of the app, restore it i
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Manage a fail of the script
|
||||||
|
#
|
||||||
|
# Print a warning to inform that the script was failed
|
||||||
|
# Execute the ynh_clean_setup function if used in the app script
|
||||||
|
#
|
||||||
|
# usage of ynh_clean_setup function
|
||||||
|
# This function provide a way to clean some residual of installation that not managed by remove script.
|
||||||
|
# To use it, simply add in your script:
|
||||||
|
# ynh_clean_setup () {
|
||||||
|
# instructions...
|
||||||
|
# }
|
||||||
|
# This function is optionnal.
|
||||||
|
#
|
||||||
|
# Usage: ynh_exit_properly is used only by the helper ynh_check_error.
|
||||||
|
# You must not use it directly.
|
||||||
|
ynh_exit_properly () {
|
||||||
|
exit_code=$?
|
||||||
|
if [ "$exit_code" -eq 0 ]; then
|
||||||
|
exit 0 # Exit without error if the script ended correctly
|
||||||
|
fi
|
||||||
|
|
||||||
|
trap '' EXIT # Ignore new exit signals
|
||||||
|
set +eu # Do not exit anymore if a command fail or if a variable is empty
|
||||||
|
|
||||||
|
echo -e "!!\n $app's script has encountered an error. Its execution was cancelled.\n!!" >&2
|
||||||
|
|
||||||
|
if type -t ynh_clean_setup > /dev/null; then # Check if the function exist in the app script.
|
||||||
|
ynh_clean_setup # Call the function to do specific cleaning for the app.
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_die # Exit with error status
|
||||||
|
}
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script.
|
# Exit if an error occurs during the execution of the script.
|
||||||
#
|
#
|
||||||
|
|
|
@ -83,7 +83,7 @@ fi
|
||||||
CHECK_MD5_CONFIG "lufi.conf" "$final_path/lufi.conf" # Créé un backup du fichier de config si il a été modifié.
|
CHECK_MD5_CONFIG "lufi.conf" "$final_path/lufi.conf" # Créé un backup du fichier de config si il a été modifié.
|
||||||
sudo cp ../conf/lufi.conf.template "$final_path/lufi.conf"
|
sudo cp ../conf/lufi.conf.template "$final_path/lufi.conf"
|
||||||
sudo sed -i "s@__DOMAIN__@$domain@g" "$final_path/lufi.conf"
|
sudo sed -i "s@__DOMAIN__@$domain@g" "$final_path/lufi.conf"
|
||||||
sudo sed -i "s@__PATH__@$path_url@g" "$final_path/lufi.conf"
|
sudo sed -i "s@__PATH__@$path@g" "$final_path/lufi.conf"
|
||||||
sudo sed -i "s@__PORT__@$port@g" "$final_path/lufi.conf"
|
sudo sed -i "s@__PORT__@$port@g" "$final_path/lufi.conf"
|
||||||
sudo sed -i "s@__SECRET__@$secret@g" "${final_path}/lufi.conf"
|
sudo sed -i "s@__SECRET__@$secret@g" "${final_path}/lufi.conf"
|
||||||
STORE_MD5_CONFIG "lufi.conf" "$final_path/lufi.conf" # Réenregistre la somme de contrôle du fichier de config
|
STORE_MD5_CONFIG "lufi.conf" "$final_path/lufi.conf" # Réenregistre la somme de contrôle du fichier de config
|
||||||
|
@ -113,7 +113,7 @@ sudo sed -i "s@__FINALPATH__@$final_path/@g" /etc/cron.d/$app
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
pushd $final_path # cd avec une stack pour revenir en arrière
|
pushd $final_path # cd avec une stack pour revenir en arrière
|
||||||
sudo carton install 2>&1 | sudo tee -a "/var/log/$app/setup_carton.log"
|
echo yes | sudo carton install 2>&1 | sudo tee -a "/var/log/$app/setup_carton.log"
|
||||||
popd # Revient au dossier courant avant pushd
|
popd # Revient au dossier courant avant pushd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue