diff --git a/scripts/.fonctions b/scripts/.fonctions index ce0ca0b..97167e1 100755 --- a/scripts/.fonctions +++ b/scripts/.fonctions @@ -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 diff --git a/scripts/install b/scripts/install index 032c555..eb91e4e 100644 --- a/scripts/install +++ b/scripts/install @@ -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 #================================================= diff --git a/scripts/restore b/scripts/restore index 0f448cf..7b89a8e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e0eb97b..1a619d1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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