From 207c8e246830c1c543d9b8244ed9c6051ce99a05 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 28 Mar 2019 23:12:37 +0100 Subject: [PATCH 01/18] upgrade to 0.8.4 --- README.md | 2 +- conf/app.src | 6 +++--- manifest.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index dc82ea99..4dd1c54b 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to ## Overview The federated image shareing service Pixelfed, for YunoHost -**Shipped version:** NONE, THIS PACKAGE DOESN'T WORK YET! +**Shipped version:** 0.8.4 I'm waiting for an official release (alpha/beta or stable) to invest more time on this package. Don't hesitate to give a hand if you wish, I assume only the nginx file needs improvments. diff --git a/conf/app.src b/conf/app.src index 5a0df8c2..597d9510 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/dansup/pixelfed/archive/d8bbe987286d1071da333487867cfd5a72fdef61.tar.gz -SOURCE_SUM=9850c409aa34aa03dc83d2055edf15752fdc6bf072510f9b38da526a85e47671 -SOURCE_SUM_PRG=sha256sum +SOURCE_URL=https://github.com/pixelfed/pixelfed/archive/12857575550a0c86a11ce1445835dcede4d37150.tar.gz +SOURCE_SUM=9228d2d0154c998f584e168ffff4a76205c3212e6c282203add136c371d931bd +OURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true \ No newline at end of file diff --git a/manifest.json b/manifest.json index ff653073..9d4282f7 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "ActivityPub Federated Image Sharing", "fr": "Partage d'image fédéré avec ActivityPub." }, - "version": "0.0.0~ynh2", + "version": "0.8.4~ynh1", "url": "https://pixelfed.org/", "license": "AGPL-3.0-or-later", "maintainer": { From 0d91a723b4357c052fa9c58ef67cb01218c1dad9 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 28 Mar 2019 23:12:52 +0100 Subject: [PATCH 02/18] moving dependencies --- scripts/_common.sh | 2 +- scripts/install | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index ecdc29c8..0036dc16 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="deb1 deb2" +pkg_dependencies="php7.1 php7.1-fpm php7.1-mbstring postgresql redis-server" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index 1bc16018..4c223e9d 100644 --- a/scripts/install +++ b/scripts/install @@ -55,7 +55,7 @@ ynh_print_info "Installing dependencies..." ynh_install_php7 -ynh_install_app_dependencies php7.1 php7.1-fpm php7.1-mbstring postgresql redis-server +ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE A POSTGRESQL DATABASE From df8658af5a54bbe1dcd0cc486e2f8f6e9f7bf23d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 28 Mar 2019 23:18:30 +0100 Subject: [PATCH 03/18] switch from ynh_install_php7 to ynh_install_php --- scripts/_common.sh | 16 +---- scripts/install | 3 +- scripts/remove | 2 + scripts/ynh_install_php | 139 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 144 insertions(+), 16 deletions(-) create mode 100644 scripts/ynh_install_php diff --git a/scripts/_common.sh b/scripts/_common.sh index 0036dc16..40125601 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="php7.1 php7.1-fpm php7.1-mbstring postgresql redis-server" +pkg_dependencies="php7.1-mbstring postgresql redis-server" #================================================= # PERSONAL HELPERS @@ -19,20 +19,6 @@ pkg_dependencies="php7.1 php7.1-fpm php7.1-mbstring postgresql redis-server" # FUTURE OFFICIAL HELPERS #================================================= -ynh_install_php7 () { - wget -q -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg - echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php7.list - - ynh_package_update -} - -ynh_remove_php7 () { - rm -f /etc/apt/sources.list.d/php7.list - apt-key del 4096R/89DF5277 - apt-key del 2048R/11A06851 -} - - # Execute a command as another user # usage: exec_as USER COMMAND [ARG ...] exec_as() { diff --git a/scripts/install b/scripts/install index 4c223e9d..1c633049 100644 --- a/scripts/install +++ b/scripts/install @@ -8,6 +8,7 @@ source _common.sh source _pgsql.sh +source ynh_install_php source /usr/share/yunohost/helpers #================================================= @@ -53,7 +54,7 @@ ynh_app_setting_set $app is_public $is_public #================================================= ynh_print_info "Installing dependencies..." -ynh_install_php7 +ynh_install_php --phpversion=7.1 ynh_install_app_dependencies $pkg_dependencies diff --git a/scripts/remove b/scripts/remove index a9d638f5..443c3f5d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -8,6 +8,7 @@ source _common.sh source _pgsql.sh +source ynh_install_php source /usr/share/yunohost/helpers #================================================= @@ -39,6 +40,7 @@ ynh_print_info "Removing dependencies" # Remove metapackage and its dependencies ynh_remove_app_dependencies +ynh_remove_php #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/ynh_install_php b/scripts/ynh_install_php new file mode 100644 index 00000000..c7d50567 --- /dev/null +++ b/scripts/ynh_install_php @@ -0,0 +1,139 @@ +#!/bin/bash + +# Install another version of php. +# +# usage: ynh_install_php --phpversion=phpversion +# | arg: -v, --phpversion - Version of php to install. Can be one of 7.1, 7.2 or 7.3 +ynh_install_php () { + # Declare an array to define the options of this helper. + local legacy_args=v + declare -Ar args_array=( [v]=phpversion= ) + local phpversion + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + + # Store php_version into the config of this app + ynh_app_setting_set $app php_version $phpversion + + # Install an extra repo to get multiple php versions + ynh_install_extra_repo --repo="https://packages.sury.org/php/ $(lsb_release -sc) main" --key="https://packages.sury.org/php/apt.gpg" --name=php + + if [ "$phpversion" == "7.0" ]; then + ynh_die "Do not use ynh_install_php to install php7.0" + + # Php 7.1 + elif [ "$phpversion" == "7.1" ]; then + # Get the current version available for libpcre3 on packages.sury.org + local libpcre3_version=$(apt-cache madison "libpcre3" | grep "packages.sury.org" | tail -n1 | awk '{print $3}') + + # equivs doesn't handle correctly this dependence. + # Force the upgrade of libpcre3 for php7.1 + ynh_package_install "libpcre3=$libpcre3_version" + + local php_dependencies="php7.1, php7.1-fpm" + + # Php 7.2 + elif [ "$phpversion" == "7.2" ]; then + # Get the current version available for libpcre3 on packages.sury.org + local libpcre3_version=$(apt-cache madison "libpcre3" | grep "packages.sury.org" | tail -n1 | awk '{print $3}') + + # equivs doesn't handle correctly this dependence. + # Force the upgrade of libpcre3 for php7.2 + ynh_package_install "libpcre3=$libpcre3_version" + + local php_dependencies="php7.2, php7.2-fpm" + + # Php 7.3 + elif [ "$phpversion" == "7.3" ]; then + # Get the current version available for libpcre2-8-0 on packages.sury.org + local libpcre2_version=$(apt-cache madison "libpcre2-8-0" | grep "packages.sury.org" | tail -n1 | awk '{print $3}') + + # equivs doesn't handle correctly this dependence. + # Force the upgrade of libpcre2-8-0 for php7.3 + ynh_package_install "libpcre2-8-0=$libpcre2_version" + + local php_dependencies="php7.3, php7.3-fpm" + + else + ynh_die "The version $phpversion of php isn't handle by this helper." + fi + + # Store the ID of this app and the version of php requested for it + echo "$YNH_APP_ID:$phpversion" | tee --append "/etc/php/ynh_app_version" + + # Build a control file for equivs-build + echo "Section: misc +Priority: optional +Package: php${phpversion}-ynh-deps +Version: 1.0 +Depends: $php_dependencies +Architecture: all +Description: Fake package for php_$phpversion dependencies + This meta-package is only responsible of installing its dependencies." \ + > /tmp/php_${phpversion}-ynh-deps.control + + # Install the fake package for php + ynh_package_install_from_equivs /tmp/php_${phpversion}-ynh-deps.control \ + || ynh_die --message="Unable to install dependencies" + ynh_secure_remove /tmp/php_${phpversion}-ynh-deps.control + + # Advertise service in admin panel + yunohost service add php${phpversion}-fpm --log "/var/log/php${phpversion}-fpm.log" +} + +ynh_remove_php () { + # Get the version of php used by this app + local phpversion=$(ynh_app_setting_get $app php_version) + + if [ "$phpversion" == "7.0" ] || [ -z "$phpversion" ] + then + if [ "$phpversion" == "7.0" ] + then + ynh_print_err "Do not use ynh_remove_php to install php7.0" + fi + return 0 + fi + + # Remove the line for this app + sed --in-place "/$YNH_APP_ID:$phpversion/d" "/etc/php/ynh_app_version" + + # If no other app uses this version of php, remove it. + if ! grep --quiet "$phpversion" "/etc/php/ynh_app_version" + then + # Remove the metapackage for php + ynh_package_autopurge php${phpversion}-ynh-deps + # Then remove php-fpm php-cli for this version. + # The previous command won't remove them, but we have to remove those package to clean php + ynh_package_autopurge php${phpversion}-fpm php${phpversion}-cli + + if [ "$phpversion" == "7.1" ] || [ "$phpversion" == "7.2" ] + then + # Do not restore libpcre3 if php7.1 or 7.2 is still used. + if ! grep --quiet --extended-regexp "7.1|7.2" "/etc/php/ynh_app_version" + then + # Get the current version available for libpcre3 on the standard repo + local libpcre3_version=$(apt-cache madison "libpcre3" | grep "debian.org" | tail -n1 | awk '{print $3}') + + # Force to reinstall the standard version of libpcre3 + ynh_package_install --allow-downgrades libpcre3=$libpcre3_version >&2 + fi + elif [ "$phpversion" == "7.3" ] + then + # Get the current version available for libpcre2-8-0 on the standard repo + local libpcre2_version=$(apt-cache madison "libpcre2-8-0" | grep "debian.org" | tail -n1 | awk '{print $3}') + + # Force to reinstall the standard version of libpcre2-8-0 + ynh_package_install --allow-downgrades libpcre2-8-0=$libpcre2_version + fi + + # Remove the service from the admin panel + yunohost service remove php${phpversion}-fpm + fi + + # If no other app uses alternate php versions, remove the extra repo for php + if [ ! -s "/etc/php/ynh_app_version" ] + then + ynh_remove_extra_repo --name=php + ynh_secure_remove /etc/php/ynh_app_version + fi +} From 4ed0b529508a071a45ede3734ec168dea01638fa Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 28 Mar 2019 23:21:44 +0100 Subject: [PATCH 04/18] Adding missing ynh_add_secure_repos__2 --- scripts/install | 1 + scripts/remove | 1 + scripts/ynh_add_secure_repos__2 | 173 ++++++++++++++++++++++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 scripts/ynh_add_secure_repos__2 diff --git a/scripts/install b/scripts/install index 1c633049..10af87d3 100644 --- a/scripts/install +++ b/scripts/install @@ -9,6 +9,7 @@ source _common.sh source _pgsql.sh source ynh_install_php +source ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/remove b/scripts/remove index 443c3f5d..58f4771e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,6 +9,7 @@ source _common.sh source _pgsql.sh source ynh_install_php +source ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/ynh_add_secure_repos__2 b/scripts/ynh_add_secure_repos__2 new file mode 100644 index 00000000..22185f48 --- /dev/null +++ b/scripts/ynh_add_secure_repos__2 @@ -0,0 +1,173 @@ +#!/bin/bash + +# Pin a repository. +# +# usage: ynh_pin_repo --package=packages --pin=pin_filter --priority=priority_value [--name=name] [--append] +# | arg: -p, --package - Packages concerned by the pin. Or all, *. +# | arg: -i, --pin - Filter for the pin. +# | arg: -p, --priority - Priority for the pin +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +# +# See https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html for information about pinning. +# +ynh_pin_repo () { + # Declare an array to define the options of this helper. + local legacy_args=pirna + declare -Ar args_array=( [p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append ) + local package + local pin + local priority + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + package="${package:-*}" + priority=${priority:-50} + name="${name:-$app}" + append=${append:-0} + + if [ $append -eq 1 ] + then + append="tee -a" + else + append="tee" + fi + + mkdir -p "/etc/apt/preferences.d" + echo "Package: $package +Pin: $pin +Pin-Priority: $priority" \ + | $append "/etc/apt/preferences.d/$name" +} + +# Add a repository. +# +# usage: ynh_add_repo --uri=uri --suite=suite --component=component [--name=name] [--append] +# | arg: -u, --uri - Uri of the repository. +# | arg: -s, --suite - Suite of the repository. +# | arg: -c, --component - Component of the repository. +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +# +# Example for a repo like deb http://forge.yunohost.org/debian/ stretch stable +# uri suite component +# ynh_add_repo --uri=http://forge.yunohost.org/debian/ --suite=stretch --component=stable +# +ynh_add_repo () { + # Declare an array to define the options of this helper. + local legacy_args=uscna + declare -Ar args_array=( [u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append ) + local uri + local suite + local component + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + append=${append:-0} + + if [ $append -eq 1 ] + then + append="tee -a" + else + append="tee" + fi + + mkdir -p "/etc/apt/sources.list.d" + # Add the new repo in sources.list.d + echo "deb $uri $suite $component" \ + | $append "/etc/apt/sources.list.d/$name.list" +} + +# Add an extra repository correctly, pin it and get the key. +# +# usage: ynh_install_extra_repo --repo="repo" [--key=key_url] [--name=name] [--append] +# | arg: -r, --repo - Complete url of the extra repository. +# | arg: -k, --key - url to get the public key. +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +ynh_install_extra_repo () { + # Declare an array to define the options of this helper. + local legacy_args=rkna + declare -Ar args_array=( [r]=repo= [k]=key= [n]=name= [a]=append ) + local repo + local key + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + append=${append:-0} + key=${key:-0} + + if [ $append -eq 1 ] + then + append="--append" + wget_append="tee -a" + else + append="" + wget_append="tee" + fi + + # Split the repository into uri, suite and components. + # Remove "deb " at the beginning of the repo. + repo="${repo#deb }" + + # Get the uri + local uri="$(echo "$repo" | awk '{ print $1 }')" + + # Get the suite + local suite="$(echo "$repo" | awk '{ print $2 }')" + + # Get the components + local component="${repo##$uri $suite }" + + # Add the repository into sources.list.d + ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append + + # Pin the new repo with the default priority, so it won't be used for upgrades. + # Build $pin from the uri without http and any sub path + local pin="${uri#*://}" + pin="${pin%%/*}" + ynh_pin_repo --package="*" --pin="origin \"$pin\"" --name="$name" $append + + # Get the public key for the repo + if [ -n "$key" ] + then + mkdir -p "/etc/apt/trusted.gpg.d" + if [[ "$(basename "$key")" =~ ".asc" ]] + then + local key_ext=asc + else + local key_ext=gpg + fi + wget -q "$key" -O - | $wget_append /etc/apt/trusted.gpg.d/$name.$key_ext + fi + + # Update the list of package with the new repo + ynh_package_update +} + +# Remove an extra repository and the assiociated configuration. +# +# usage: ynh_remove_extra_repo [--name=name] +# | arg: -n, --name - Name for the files for this repo, $app as default value. +ynh_remove_extra_repo () { + # Declare an array to define the options of this helper. + local legacy_args=n + declare -Ar args_array=( [n]=name= ) + local name + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + + ynh_secure_remove "/etc/apt/sources.list.d/$name.list" + ynh_secure_remove "/etc/apt/preferences.d/$name" + ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.gpg" + ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.asc" + + # Update the list of package to exclude the old repo + ynh_package_update +} From 7ce242144a455c18f8a2badfc8cb9e40c9f97259 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 28 Mar 2019 23:49:33 +0100 Subject: [PATCH 05/18] Remove ynh_add_php71-fpm_config --- scripts/_common.sh | 36 ------------------------------------ scripts/install | 2 +- scripts/remove | 2 +- 3 files changed, 2 insertions(+), 38 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 40125601..2075af05 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -62,39 +62,3 @@ init_composer() { exec_composer "$AS_USER" "$WORKDIR" install --no-dev \ || ynh_die "Unable to update core dependencies with Composer" } - - -# Create a dedicated php-fpm config for php7.1 -# -# usage: ynh_add_fpm_config -ynh_add_php71-fpm_config () { - finalphpconf="/etc/php/7.1/fpm/pool.d/$app.conf" - ynh_backup_if_checksum_is_different "$finalphpconf" - cp ../conf/php-fpm.conf "$finalphpconf" - ynh_replace_string "__NAMETOCHANGE__" "$app" "$finalphpconf" - ynh_replace_string "__FINALPATH__" "$final_path" "$finalphpconf" - ynh_replace_string "__USER__" "$app" "$finalphpconf" - chown root: "$finalphpconf" - ynh_store_file_checksum "$finalphpconf" - - if [ -e "../conf/php-fpm.ini" ] - then - finalphpini="/etc/php/7.1/fpm/conf.d/20-$app.ini" - ynh_backup_if_checksum_is_different "$finalphpini" - cp ../conf/php-fpm.ini "$finalphpini" - chown root: "$finalphpini" - ynh_store_file_checksum "$finalphpini" - fi - - systemctl reload php7.1-fpm -} - - -# Remove the dedicated php-fpm config for php7.1 -# -# usage: ynh_remove_fpm_config -ynh_remove_php71-fpm_config () { - ynh_secure_remove "/etc/php/7.1/fpm/pool.d/$app.conf" - ynh_secure_remove "/etc/php/7.1/fpm/conf.d/20-$app.ini" 2>&1 - systemctl reload php7.1-fpm -} diff --git a/scripts/install b/scripts/install index 10af87d3..39944be3 100644 --- a/scripts/install +++ b/scripts/install @@ -105,7 +105,7 @@ ynh_system_user_create $app #================================================= # Create a dedicated php-fpm config -ynh_add_php71-fpm_config +ynh_add_fpm_config --phpversion=7.1 #================================================= # INSTALL PHP DEPENDENCIES diff --git a/scripts/remove b/scripts/remove index 58f4771e..2a7a9287 100644 --- a/scripts/remove +++ b/scripts/remove @@ -65,7 +65,7 @@ ynh_remove_nginx_config ynh_print_info "Removing php-fpm configuration" # Remove the dedicated php-fpm config -ynh_remove_php71-fpm_config +ynh_remove_fpm_config #================================================= # GENERIC FINALIZATION From cf6dc34a4f80c97299a79c973286fca0a6afb4ca Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 28 Mar 2019 23:54:21 +0100 Subject: [PATCH 06/18] Upgrade to PHP7.2 --- conf/nginx.conf | 2 +- conf/php-fpm.conf | 2 +- scripts/_common.sh | 6 +++--- scripts/install | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index a8a969d9..a7d741cf 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -15,7 +15,7 @@ location __PATH__ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php7-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; # If you don't use a dedicated fpm config for your app, # use a general fpm pool. diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 38af5827..4a93f0cf 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -33,7 +33,7 @@ group = __USER__ ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php7-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) diff --git a/scripts/_common.sh b/scripts/_common.sh index 2075af05..3e7f6a7f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="php7.1-mbstring postgresql redis-server" +pkg_dependencies="php7.2-mbstring postgresql redis-server" #================================================= # PERSONAL HELPERS @@ -41,7 +41,7 @@ exec_composer() { shift 2 exec_as "$AS_USER" COMPOSER_HOME="${WORKDIR}/.composer" \ - php7.1 "${WORKDIR}/composer.phar" $@ \ + php7.2 "${WORKDIR}/composer.phar" $@ \ -d "${WORKDIR}" --quiet --no-interaction } @@ -54,7 +54,7 @@ init_composer() { # install composer curl -sS https://getcomposer.org/installer \ | COMPOSER_HOME="${WORKDIR}/.composer" \ - php7.1 -- --quiet --install-dir="$WORKDIR" \ + php7.2 -- --quiet --install-dir="$WORKDIR" \ || ynh_die "Unable to install Composer" diff --git a/scripts/install b/scripts/install index 39944be3..f53c2fd7 100644 --- a/scripts/install +++ b/scripts/install @@ -55,7 +55,7 @@ ynh_app_setting_set $app is_public $is_public #================================================= ynh_print_info "Installing dependencies..." -ynh_install_php --phpversion=7.1 +ynh_install_php --phpversion=7.2 ynh_install_app_dependencies $pkg_dependencies @@ -105,7 +105,7 @@ ynh_system_user_create $app #================================================= # Create a dedicated php-fpm config -ynh_add_fpm_config --phpversion=7.1 +ynh_add_fpm_config --phpversion=7.2 #================================================= # INSTALL PHP DEPENDENCIES @@ -145,8 +145,8 @@ ynh_store_file_checksum "$config" # generate key and clear cache ( cd "$final_path" - php7.1 artisan -n key:generate --force - php7.1 artisan config:clear + php7.2 artisan -n key:generate --force + php7.2 artisan config:clear ) #================================================= From bf2aebb9e43632e65b723055f7210f2f0250bbfb Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 29 Mar 2019 00:19:38 +0100 Subject: [PATCH 07/18] switch to ynh_install_composer --- scripts/install | 3 ++- scripts/ynh_composer | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 scripts/ynh_composer diff --git a/scripts/install b/scripts/install index f53c2fd7..f622f8a2 100644 --- a/scripts/install +++ b/scripts/install @@ -10,6 +10,7 @@ source _common.sh source _pgsql.sh source ynh_install_php source ynh_add_secure_repos__2 +source ynh_composer source /usr/share/yunohost/helpers #================================================= @@ -113,7 +114,7 @@ ynh_add_fpm_config --phpversion=7.2 chown -R "$app": "$final_path" -init_composer "$app" "$final_path" +ynh_install_composer --workdir=$final_path #================================================= # SPECIFIC SETUP diff --git a/scripts/ynh_composer b/scripts/ynh_composer new file mode 100644 index 00000000..3e9cecac --- /dev/null +++ b/scripts/ynh_composer @@ -0,0 +1,44 @@ +#!/bin/bash + +# Execute a command with Composer +# +# usage: ynh_composer_exec [--workdir=$final_path] --commands="commands" +# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path. +# | arg: -c, --commands - Commands to execute. +ynh_composer_exec () { + # Declare an array to define the options of this helper. + local legacy_args=wc + declare -Ar args_array=( [w]=workdir= [c]=commands= ) + local workdir + local commands + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + workdir="${workdir:-$final_path}" + + COMPOSER_HOME="$workdir/.composer" \ + php "$workdir/composer.phar" $commands \ + -d "$workdir" --quiet --no-interaction +} + +# Install and initialize Composer in the given directory +# +# usage: ynh_install_composer [--workdir=$final_path] +# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path. +ynh_install_composer () { + # Declare an array to define the options of this helper. + local legacy_args=w + declare -Ar args_array=( [w]=workdir= ) + local workdir + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + workdir="${workdir:-$final_path}" + + curl -sS https://getcomposer.org/installer \ + | COMPOSER_HOME="$workdir/.composer" \ + php -- --quiet --install-dir="$workdir" \ + || ynh_die "Unable to install Composer." + + # update dependencies to create composer.lock + ynh_composer_exec --workdir="$workdir" --commands="install --no-dev" \ + || ynh_die "Unable to update core dependencies with Composer." +} From a6af8811c6e3964b7036759429eb4055c69bcfe1 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 29 Mar 2019 00:19:54 +0100 Subject: [PATCH 08/18] remove old composer --- scripts/_common.sh | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 3e7f6a7f..a044f494 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -18,47 +18,3 @@ pkg_dependencies="php7.2-mbstring postgresql redis-server" #================================================= # FUTURE OFFICIAL HELPERS #================================================= - -# Execute a command as another user -# usage: exec_as USER COMMAND [ARG ...] -exec_as() { - local USER=$1 - shift 1 - - if [[ $USER = $(whoami) ]] - then - eval $@ - else - sudo -u "$USER" $@ - fi -} - -# Execute a composer command from a given directory -# usage: composer_exec AS_USER WORKDIR COMMAND [ARG ...] -exec_composer() { - local AS_USER=$1 - local WORKDIR=$2 - shift 2 - - exec_as "$AS_USER" COMPOSER_HOME="${WORKDIR}/.composer" \ - php7.2 "${WORKDIR}/composer.phar" $@ \ - -d "${WORKDIR}" --quiet --no-interaction -} - -# Install and initialize Composer in the given directory -# usage: init_composer destdir -init_composer() { - local AS_USER=$1 - local WORKDIR=$2 - - # install composer - curl -sS https://getcomposer.org/installer \ - | COMPOSER_HOME="${WORKDIR}/.composer" \ - php7.2 -- --quiet --install-dir="$WORKDIR" \ - || ynh_die "Unable to install Composer" - - - # update dependencies to create composer.lock - exec_composer "$AS_USER" "$WORKDIR" install --no-dev \ - || ynh_die "Unable to update core dependencies with Composer" -} From 4e7ec2952fb83e3dfbf5a97f4d17225626295bca Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 29 Mar 2019 05:56:59 +0100 Subject: [PATCH 09/18] Fix install and removal --- README.md | 12 ++++ check_process | 3 +- conf/.env | 53 ++++++++++----- conf/app.src | 4 +- conf/nginx.conf | 45 ++++++------- conf/php-fpm.conf | 2 +- manifest.json | 10 --- scripts/_common.sh | 6 +- scripts/_pgsql.sh | 160 --------------------------------------------- scripts/install | 32 +++++---- scripts/remove | 28 ++++---- 11 files changed, 117 insertions(+), 238 deletions(-) delete mode 100644 scripts/_pgsql.sh diff --git a/README.md b/README.md index 4dd1c54b..a94130a9 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,18 @@ Don't hesitate to give a hand if you wish, I assume only the nginx file needs im ![](https://camo.githubusercontent.com/c1c2e74057dcff57e103fcbb3239840802fcf752/68747470733a2f2f706978656c6665642e6e7963332e63646e2e6469676974616c6f6365616e7370616365732e636f6d2f6d656469612f53637265656e25323053686f74253230323031392d30322d30352532306174253230362e33342e3539253230504d2e706e67) +## Configuration + +### Administrator + +After being first registered, you need to execute the folloing command to promote first registered as admin + +**Run:** + + $ (cd /var/www/pixelfed && php artisan user:admin 1) + +and respond yes to the question ` Add admin privileges to this user?` + ## Documentation * Official documentation: https://docs.pixelfed.org/master/ diff --git a/check_process b/check_process index 2402e30b..901667fe 100644 --- a/check_process +++ b/check_process @@ -1,11 +1,10 @@ ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) - path="/path" (PATH) is_public=1 (PUBLIC|public=1|private=0) ; Checks pkg_linter=1 - setup_sub_dir=1 + setup_sub_dir=0 setup_root=1 setup_nourl=0 setup_private=0 diff --git a/conf/.env b/conf/.env index 7a01e595..ccd91fe0 100644 --- a/conf/.env +++ b/conf/.env @@ -1,10 +1,13 @@ APP_NAME=__APP__ -APP_ENV=local +APP_ENV=production APP_KEY= APP_DEBUG=true -APP_URL=http://__DOMAIN____PATH__ +APP_URL=https://__DOMAIN__ -LOG_CHANNEL=stackouille +ADMIN_DOMAIN="__DOMAIN__" +APP_DOMAIN="__DOMAIN__" + +LOG_CHANNEL=stack DB_CONNECTION=pgsql DB_HOST=127.0.0.1 @@ -14,36 +17,56 @@ DB_USERNAME=__DB_USER__ DB_PASSWORD=__DB_PWD__ BROADCAST_DRIVER=log -CACHE_DRIVER=file -SESSION_DRIVER=file +CACHE_DRIVER=redis +SESSION_DRIVER=redis SESSION_LIFETIME=120 -QUEUE_DRIVER=sync +QUEUE_DRIVER=redis REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp -MAIL_HOST=smtp.mailtrap.io -MAIL_PORT=2525 +MAIL_HOST=localhost +MAIL_PORT=25 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null +MAIL_FROM_ADDRESS="pixelfed@__DOMAIN__" +MAIL_FROM_NAME="Pixelfed" + +SESSION_DOMAIN="${APP_DOMAIN}" +SESSION_SECURE_COOKIE=true +API_BASE="/api/1/" +API_SEARCH="/api/search" + +OPEN_REGISTRATION=true +RECAPTCHA_ENABLED=false +ENFORCE_EMAIL_VERIFICATION=true PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 -SESSION_DOMAIN=".pixelfed.dev" -SESSION_SECURE_COOKIE=true -API_BASE="/api/1/" -API_SEARCH="/api/search" - -OPEN_REGISTRATION=true +MAX_PHOTO_SIZE=15000 +MAX_CAPTION_LENGTH=150 +MAX_ALBUM_LENGTH=4 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" MIX_APP_URL="${APP_URL}" MIX_API_BASE="${API_BASE}" -MIX_API_SEARCH="${API_SEARCH}" \ No newline at end of file +MIX_API_SEARCH="${API_SEARCH}" + +ACTIVITYPUB_INBOX=false +ACTIVITYPUB_SHAREDINBOX=false +HORIZON_DARKMODE=true + +# Set these both "true" to enable federation. +# You might need to also run: +# php artisan cache:clear +# php artisan optimize:clear +# php artisan optimize +ACTIVITY_PUB=false +REMOTE_FOLLOW=false diff --git a/conf/app.src b/conf/app.src index 597d9510..30825423 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/pixelfed/pixelfed/archive/12857575550a0c86a11ce1445835dcede4d37150.tar.gz -SOURCE_SUM=9228d2d0154c998f584e168ffff4a76205c3212e6c282203add136c371d931bd +SOURCE_URL=https://github.com/pixelfed/pixelfed/archive/ac53aea28884f0c49c110ac6d87a7b40e92171c9.tar.gz +SOURCE_SUM=ca6156026eb1bb8d8995d247a895b88078e93f1127b75af07058d74f57830846 OURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index a7d741cf..67b55d0a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,36 +1,33 @@ location __PATH__ { - # Path to source - alias __FINALPATH__/public/ ; + # Path to source + alias __FINALPATH__/public/ ; + try_files $uri $uri/ @pixelfed; - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } + # Force usage of https + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } index index.php; - # Common parameter to increase upload size limit in conjuction with dedicated php-fpm file - #client_max_body_size 50M; + # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file + #client_max_body_size 50M; - try_files $uri $uri/ index.php; - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_pass unix:/var/run/php/php7.2-fpm-__NAME__.sock; - # If you don't use a dedicated fpm config for your app, - # use a general fpm pool. - # This is to be used INSTEAD of line above - # Don't forget to adjust scripts install/upgrade/remove/backup accordingly - # - #fastcgi_pass unix:/var/run/php5-fpm.sock; - - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param SCRIPT_FILENAME $request_filename; - } + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param REMOTE_USER $remote_user; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $request_filename; + } # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } +location @pixelfed { + rewrite /(.*)$ /index.php?/$1 last; +} diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 4a93f0cf..6d45f960 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -33,7 +33,7 @@ group = __USER__ ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php7.2-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) diff --git a/manifest.json b/manifest.json index 9d4282f7..c681704a 100644 --- a/manifest.json +++ b/manifest.json @@ -31,16 +31,6 @@ }, "example": "domain.org" }, - { - "name": "path", - "type": "path", - "ask": { - "en": "Choose a path for Pixelfed", - "fr": "Choisissez un chemin pour Pixelfed" - }, - "example": "/pixelfed", - "default": "/pixelfed" - }, { "name": "is_public", "type": "boolean", diff --git a/scripts/_common.sh b/scripts/_common.sh index a044f494..84ec0517 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,11 @@ #================================================= # dependencies used by the app -pkg_dependencies="php7.2-mbstring postgresql redis-server" +pkg_dependencies="php7.2-pgsql php7.2-mbstring php7.2-bcmath php7.2-simplexml php7.2-curl postgresql redis-server \ +php7.2-intl php7.2-exif \ +libfreetype6 libjpeg62-turbo libpng16-16 libxpm4 libvpx4 libwebp6 libmagickwand-6.q16-3 \ +php7.2-imagick imagick \ +pngquant jpegoptim gifsicle" #================================================= # PERSONAL HELPERS diff --git a/scripts/_pgsql.sh b/scripts/_pgsql.sh deleted file mode 100644 index 10314a2b..00000000 --- a/scripts/_pgsql.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/bash - -#================================================= -# -# POSTGRES HELPERS -# -# Point of contact : Jean-Baptiste Holcroft -#================================================= - -# Create a master password and set up global settings -# Please always call this script in install and restore scripts -# -# usage: ynh_psql_test_if_first_run - -ynh_psql_test_if_first_run() { - if [ -f /etc/yunohost/psql ]; - then - echo "PostgreSQL is already installed, no need to create master password" - else - pgsql=$(ynh_string_random) - pg_hba="" - echo "$pgsql" >> /etc/yunohost/psql - - if [ -e /etc/postgresql/9.4/ ] - then - pg_hba=/etc/postgresql/9.4/main/pg_hba.conf - elif [ -e /etc/postgresql/9.6/ ] - then - pg_hba=/etc/postgresql/9.6/main/pg_hba.conf - else - ynh_die "postgresql shoud be 9.4 or 9.6" - fi - - systemctl start postgresql - sudo --login --user=postgres psql -c"ALTER user postgres WITH PASSWORD '$pgsql'" postgres - - # force all user to connect to local database using passwords - # https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html#EXAMPLE-PG-HBA.CONF - # Note: we can't use peer since YunoHost create users with nologin - # See: https://github.com/YunoHost/yunohost/blob/unstable/data/helpers.d/user - sed -i '/local\s*all\s*all\s*peer/i \ - local all all password' "$pg_hba" - systemctl enable postgresql - systemctl reload postgresql - fi -} - -# Open a connection as a user -# -# example: ynh_psql_connect_as 'user' 'pass' <<< "UPDATE ...;" -# example: ynh_psql_connect_as 'user' 'pass' < /path/to/file.sql -# -# usage: ynh_psql_connect_as user pwd [db] -# | arg: user - the user name to connect as -# | arg: pwd - the user password -# | arg: db - the database to connect to -ynh_psql_connect_as() { - local user="$1" - local pwd="$2" - local db="$3" - sudo --login --user=postgres PGUSER="$user" PGPASSWORD="$pwd" psql "$db" -} - -# # Execute a command as root user -# -# usage: ynh_psql_execute_as_root sql [db] -# | arg: sql - the SQL command to execute -# | arg: db - the database to connect to -ynh_psql_execute_as_root () { - local sql="$1" - sudo --login --user=postgres psql <<< "$sql" -} - -# Execute a command from a file as root user -# -# usage: ynh_psql_execute_file_as_root file [db] -# | arg: file - the file containing SQL commands -# | arg: db - the database to connect to -ynh_psql_execute_file_as_root() { - local file="$1" - local db="$2" - sudo --login --user=postgres psql "$db" < "$file" -} - -# Create a database, an user and its password. Then store the password in the app's config -# -# After executing this helper, the password of the created database will be available in $db_pwd -# It will also be stored as "psqlpwd" into the app settings. -# -# usage: ynh_psql_setup_db user name [pwd] -# | arg: user - Owner of the database -# | arg: name - Name of the database -# | arg: pwd - Password of the database. If not given, a password will be generated -ynh_psql_setup_db () { - local db_user="$1" - local db_name="$2" - local new_db_pwd=$(ynh_string_random) # Generate a random password - # If $3 is not given, use new_db_pwd instead for db_pwd. - local db_pwd="${3:-$new_db_pwd}" - ynh_psql_create_db "$db_name" "$db_user" "$db_pwd" # Create the database - ynh_app_setting_set "$app" psqlpwd "$db_pwd" # Store the password in the app's config -} - -# Create a database and grant privilegies to a user -# -# usage: ynh_psql_create_db db [user [pwd]] -# | arg: db - the database name to create -# | arg: user - the user to grant privilegies -# | arg: pwd - the user password -ynh_psql_create_db() { - local db="$1" - local user="$2" - local pwd="$3" - ynh_psql_create_user "$user" "$pwd" - sudo --login --user=postgres createdb --owner="$user" "$db" -} - -# Drop a database -# -# usage: ynh_psql_drop_db db -# | arg: db - the database name to drop -# | arg: user - the user to drop -ynh_psql_remove_db() { - local db="$1" - local user="$2" - sudo --login --user=postgres dropdb "$db" - ynh_psql_drop_user "$user" -} - -# Dump a database -# -# example: ynh_psql_dump_db 'roundcube' > ./dump.sql -# -# usage: ynh_psql_dump_db db -# | arg: db - the database name to dump -# | ret: the psqldump output -ynh_psql_dump_db() { - local db="$1" - sudo --login --user=postgres pg_dump "$db" -} - - -# Create a user -# -# usage: ynh_psql_create_user user pwd [host] -# | arg: user - the user name to create -ynh_psql_create_user() { - local user="$1" - local pwd="$2" - sudo --login --user=postgres psql -c"CREATE USER $user WITH PASSWORD '$pwd'" postgres -} - -# Drop a user -# -# usage: ynh_psql_drop_user user -# | arg: user - the user name to drop -ynh_psql_drop_user() { - local user="$1" - sudo --login --user=postgres dropuser "$user" -} \ No newline at end of file diff --git a/scripts/install b/scripts/install index f622f8a2..e302dd76 100644 --- a/scripts/install +++ b/scripts/install @@ -7,7 +7,6 @@ #================================================= source _common.sh -source _pgsql.sh source ynh_install_php source ynh_add_secure_repos__2 source ynh_composer @@ -25,7 +24,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH +path_url="/" is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME @@ -56,7 +55,7 @@ ynh_app_setting_set $app is_public $is_public #================================================= ynh_print_info "Installing dependencies..." -ynh_install_php --phpversion=7.2 +ynh_install_php --phpversion="7.2" ynh_install_app_dependencies $pkg_dependencies @@ -67,13 +66,13 @@ ynh_print_info "Creating a PostgreSQL database..." ynh_psql_test_if_first_run -db_name=$(ynh_sanitize_dbid "$app") +db_name=$(ynh_sanitize_dbid $app) db_user=$db_name db_pwd=$(ynh_string_random) -ynh_app_setting_set "$app" db_name "$db_name" +ynh_app_setting_set $app db_name $db_name # Initialize database and store postgres password for upgrade -ynh_psql_setup_db "$db_name" "$db_user" +ynh_psql_setup_db $db_user $db_name $db_pwd systemctl reload postgresql @@ -104,9 +103,14 @@ ynh_system_user_create $app #================================================= # PHP-FPM CONFIGURATION #================================================= +ynh_print_info "Configuring php-fpm..." # Create a dedicated php-fpm config -ynh_add_fpm_config --phpversion=7.2 +ynh_add_fpm_config --phpversion="7.2" + +#Ugly move waiting 'ynh_add_fpm_config --phpversion='' released +mv /etc/php/7.0/fpm/pool.d/$app.conf /etc/php/7.2/fpm/pool.d/$app.conf +systemctl reload php7.2-fpm #================================================= # INSTALL PHP DEPENDENCIES @@ -140,15 +144,19 @@ ynh_replace_string "__DB_PWD__" "$db_pwd" "$config" ynh_store_file_checksum "$config" #================================================= -# GENERATE KEY AND CLEAR CACHE +# DEPLOYMENT #================================================= -# generate key and clear cache -( - cd "$final_path" +pushd $final_path php7.2 artisan -n key:generate --force php7.2 artisan config:clear -) + php7.2 artisan config:cache + php7.2 artisan route:cache + php7.2 artisan storage:link + php7.2 artisan migrate --force + php7.2 artisan update + php7.2 artisan horizon:purge +popd #================================================= # GENERIC FINALIZATION diff --git a/scripts/remove b/scripts/remove index 2a7a9287..5a119775 100644 --- a/scripts/remove +++ b/scripts/remove @@ -7,7 +7,6 @@ #================================================= source _common.sh -source _pgsql.sh source ynh_install_php source ynh_add_secure_repos__2 source /usr/share/yunohost/helpers @@ -31,8 +30,23 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= ynh_print_info "Removing the PostgreSQL database" +ynh_psql_execute_as_root "\connect $db_name +SELECT pg_terminate_backend (pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$db_name';" + # Remove a database if it exists, along with the associated user -ynh_psql_remove_db "$db_name" "$app" +ynh_psql_remove_db $db_user $db_name + +#================================================= +# REMOVE PHP-FPM CONFIGURATION +#================================================= +ynh_print_info "Removing php-fpm configuration" + +#Ugly move waiting 'ynh_add_fpm_config --phpversion='' released +mv /etc/php/7.2/fpm/pool.d/$app.conf /etc/php/7.0/fpm/pool.d/$app.conf +systemctl reload php7.2-fpm + +# Remove the dedicated php-fpm config +ynh_remove_fpm_config #================================================= # REMOVE DEPENDENCIES @@ -40,8 +54,8 @@ ynh_psql_remove_db "$db_name" "$app" ynh_print_info "Removing dependencies" # Remove metapackage and its dependencies -ynh_remove_app_dependencies ynh_remove_php +ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR @@ -59,14 +73,6 @@ ynh_print_info "Removing nginx web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_print_info "Removing php-fpm configuration" - -# Remove the dedicated php-fpm config -ynh_remove_fpm_config - #================================================= # GENERIC FINALIZATION #================================================= From 9d1e7d81c767156cdb395f31f5e1b13dca051a69 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 29 Mar 2019 13:48:39 +0100 Subject: [PATCH 10/18] Fix spelling --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a94130a9..80804a02 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* ## Overview -The federated image shareing service Pixelfed, for YunoHost +The federated image sharing service Pixelfed, for YunoHost **Shipped version:** 0.8.4 From 3db6e4856a6a55c702b5dec068b31862f257ef19 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Sun, 31 Mar 2019 15:21:38 +0200 Subject: [PATCH 11/18] move functions in _common.sh --- scripts/_common.sh | 355 ++++++++++++++++++++++++++++++++ scripts/install | 3 - scripts/remove | 4 +- scripts/ynh_add_secure_repos__2 | 173 ---------------- scripts/ynh_composer | 44 ---- scripts/ynh_install_php | 137 ------------ 6 files changed, 356 insertions(+), 360 deletions(-) delete mode 100644 scripts/ynh_add_secure_repos__2 delete mode 100644 scripts/ynh_composer diff --git a/scripts/_common.sh b/scripts/_common.sh index 84ec0517..cf0fed16 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -19,6 +19,361 @@ pngquant jpegoptim gifsicle" # EXPERIMENTAL HELPERS #================================================= +# Execute a command with Composer +# +# usage: ynh_composer_exec [--workdir=$final_path] --commands="commands" +# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path. +# | arg: -c, --commands - Commands to execute. +ynh_composer_exec () { + # Declare an array to define the options of this helper. + local legacy_args=wc + declare -Ar args_array=( [w]=workdir= [c]=commands= ) + local workdir + local commands + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + workdir="${workdir:-$final_path}" + + COMPOSER_HOME="$workdir/.composer" \ + php "$workdir/composer.phar" $commands \ + -d "$workdir" --quiet --no-interaction +} + +# Install and initialize Composer in the given directory +# +# usage: ynh_install_composer [--workdir=$final_path] +# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path. +ynh_install_composer () { + # Declare an array to define the options of this helper. + local legacy_args=w + declare -Ar args_array=( [w]=workdir= ) + local workdir + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + workdir="${workdir:-$final_path}" + + curl -sS https://getcomposer.org/installer \ + | COMPOSER_HOME="$workdir/.composer" \ + php -- --quiet --install-dir="$workdir" \ + || ynh_die "Unable to install Composer." + + # update dependencies to create composer.lock + ynh_composer_exec --workdir="$workdir" --commands="install --no-dev" \ + || ynh_die "Unable to update core dependencies with Composer." +} + + +# Install another version of php. +# +# usage: ynh_install_php --phpversion=phpversion +# | arg: -v, --phpversion - Version of php to install. Can be one of 7.1, 7.2 or 7.3 +ynh_install_php () { + # Declare an array to define the options of this helper. + local legacy_args=v + declare -Ar args_array=( [v]=phpversion= ) + local phpversion + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + + # Store php_version into the config of this app + ynh_app_setting_set $app php_version $phpversion + + # Install an extra repo to get multiple php versions + ynh_install_extra_repo --repo="https://packages.sury.org/php/ $(lsb_release -sc) main" --key="https://packages.sury.org/php/apt.gpg" --name=php + + if [ "$phpversion" == "7.0" ]; then + ynh_die "Do not use ynh_install_php to install php7.0" + + # Php 7.1 + elif [ "$phpversion" == "7.1" ]; then + # Get the current version available for libpcre3 on packages.sury.org + local libpcre3_version=$(apt-cache madison "libpcre3" | grep "packages.sury.org" | tail -n1 | awk '{print $3}') + + # equivs doesn't handle correctly this dependence. + # Force the upgrade of libpcre3 for php7.1 + ynh_package_install "libpcre3=$libpcre3_version" + + local php_dependencies="php7.1, php7.1-fpm" + + # Php 7.2 + elif [ "$phpversion" == "7.2" ]; then + # Get the current version available for libpcre3 on packages.sury.org + local libpcre3_version=$(apt-cache madison "libpcre3" | grep "packages.sury.org" | tail -n1 | awk '{print $3}') + + # equivs doesn't handle correctly this dependence. + # Force the upgrade of libpcre3 for php7.2 + ynh_package_install "libpcre3=$libpcre3_version" + + local php_dependencies="php7.2, php7.2-fpm" + + # Php 7.3 + elif [ "$phpversion" == "7.3" ]; then + # Get the current version available for libpcre2-8-0 on packages.sury.org + local libpcre2_version=$(apt-cache madison "libpcre2-8-0" | grep "packages.sury.org" | tail -n1 | awk '{print $3}') + + # equivs doesn't handle correctly this dependence. + # Force the upgrade of libpcre2-8-0 for php7.3 + ynh_package_install "libpcre2-8-0=$libpcre2_version" + + local php_dependencies="php7.3, php7.3-fpm" + + else + ynh_die "The version $phpversion of php isn't handle by this helper." + fi + + # Store the ID of this app and the version of php requested for it + echo "$YNH_APP_ID:$phpversion" | tee --append "/etc/php/ynh_app_version" + + # Build a control file for equivs-build + echo "Section: misc +Priority: optional +Package: php${phpversion}-ynh-deps +Version: 1.0 +Depends: $php_dependencies +Architecture: all +Description: Fake package for php_$phpversion dependencies + This meta-package is only responsible of installing its dependencies." \ + > /tmp/php_${phpversion}-ynh-deps.control + + # Install the fake package for php + ynh_package_install_from_equivs /tmp/php_${phpversion}-ynh-deps.control \ + || ynh_die --message="Unable to install dependencies" + ynh_secure_remove /tmp/php_${phpversion}-ynh-deps.control + + # Advertise service in admin panel + yunohost service add php${phpversion}-fpm --log "/var/log/php${phpversion}-fpm.log" +} + +ynh_remove_php () { + # Get the version of php used by this app + local phpversion=$(ynh_app_setting_get $app php_version) + + if [ "$phpversion" == "7.0" ] || [ -z "$phpversion" ] + then + if [ "$phpversion" == "7.0" ] + then + ynh_print_err "Do not use ynh_remove_php to install php7.0" + fi + return 0 + fi + + # Remove the line for this app + sed --in-place "/$YNH_APP_ID:$phpversion/d" "/etc/php/ynh_app_version" + + # If no other app uses this version of php, remove it. + if ! grep --quiet "$phpversion" "/etc/php/ynh_app_version" + then + # Remove the metapackage for php + ynh_package_autopurge php${phpversion}-ynh-deps + # Then remove php-fpm php-cli for this version. + # The previous command won't remove them, but we have to remove those package to clean php + ynh_package_autopurge php${phpversion}-fpm php${phpversion}-cli + + if [ "$phpversion" == "7.1" ] || [ "$phpversion" == "7.2" ] + then + # Do not restore libpcre3 if php7.1 or 7.2 is still used. + if ! grep --quiet --extended-regexp "7.1|7.2" "/etc/php/ynh_app_version" + then + # Get the current version available for libpcre3 on the standard repo + local libpcre3_version=$(apt-cache madison "libpcre3" | grep "debian.org" | tail -n1 | awk '{print $3}') + + # Force to reinstall the standard version of libpcre3 + ynh_package_install --allow-downgrades libpcre3=$libpcre3_version >&2 + fi + elif [ "$phpversion" == "7.3" ] + then + # Get the current version available for libpcre2-8-0 on the standard repo + local libpcre2_version=$(apt-cache madison "libpcre2-8-0" | grep "debian.org" | tail -n1 | awk '{print $3}') + + # Force to reinstall the standard version of libpcre2-8-0 + ynh_package_install --allow-downgrades libpcre2-8-0=$libpcre2_version + fi + + # Remove the service from the admin panel + yunohost service remove php${phpversion}-fpm + fi + + # If no other app uses alternate php versions, remove the extra repo for php + if [ ! -s "/etc/php/ynh_app_version" ] + then + ynh_remove_extra_repo --name=php + ynh_secure_remove /etc/php/ynh_app_version + fi +} + + + #================================================= # FUTURE OFFICIAL HELPERS #================================================= +# Pin a repository. +# +# usage: ynh_pin_repo --package=packages --pin=pin_filter --priority=priority_value [--name=name] [--append] +# | arg: -p, --package - Packages concerned by the pin. Or all, *. +# | arg: -i, --pin - Filter for the pin. +# | arg: -p, --priority - Priority for the pin +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +# +# See https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html for information about pinning. +# +ynh_pin_repo () { + # Declare an array to define the options of this helper. + local legacy_args=pirna + declare -Ar args_array=( [p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append ) + local package + local pin + local priority + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + package="${package:-*}" + priority=${priority:-50} + name="${name:-$app}" + append=${append:-0} + + if [ $append -eq 1 ] + then + append="tee -a" + else + append="tee" + fi + + mkdir -p "/etc/apt/preferences.d" + echo "Package: $package +Pin: $pin +Pin-Priority: $priority" \ + | $append "/etc/apt/preferences.d/$name" +} + +# Add a repository. +# +# usage: ynh_add_repo --uri=uri --suite=suite --component=component [--name=name] [--append] +# | arg: -u, --uri - Uri of the repository. +# | arg: -s, --suite - Suite of the repository. +# | arg: -c, --component - Component of the repository. +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +# +# Example for a repo like deb http://forge.yunohost.org/debian/ stretch stable +# uri suite component +# ynh_add_repo --uri=http://forge.yunohost.org/debian/ --suite=stretch --component=stable +# +ynh_add_repo () { + # Declare an array to define the options of this helper. + local legacy_args=uscna + declare -Ar args_array=( [u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append ) + local uri + local suite + local component + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + append=${append:-0} + + if [ $append -eq 1 ] + then + append="tee -a" + else + append="tee" + fi + + mkdir -p "/etc/apt/sources.list.d" + # Add the new repo in sources.list.d + echo "deb $uri $suite $component" \ + | $append "/etc/apt/sources.list.d/$name.list" +} + +# Add an extra repository correctly, pin it and get the key. +# +# usage: ynh_install_extra_repo --repo="repo" [--key=key_url] [--name=name] [--append] +# | arg: -r, --repo - Complete url of the extra repository. +# | arg: -k, --key - url to get the public key. +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +ynh_install_extra_repo () { + # Declare an array to define the options of this helper. + local legacy_args=rkna + declare -Ar args_array=( [r]=repo= [k]=key= [n]=name= [a]=append ) + local repo + local key + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + append=${append:-0} + key=${key:-0} + + if [ $append -eq 1 ] + then + append="--append" + wget_append="tee -a" + else + append="" + wget_append="tee" + fi + + # Split the repository into uri, suite and components. + # Remove "deb " at the beginning of the repo. + repo="${repo#deb }" + + # Get the uri + local uri="$(echo "$repo" | awk '{ print $1 }')" + + # Get the suite + local suite="$(echo "$repo" | awk '{ print $2 }')" + + # Get the components + local component="${repo##$uri $suite }" + + # Add the repository into sources.list.d + ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append + + # Pin the new repo with the default priority, so it won't be used for upgrades. + # Build $pin from the uri without http and any sub path + local pin="${uri#*://}" + pin="${pin%%/*}" + ynh_pin_repo --package="*" --pin="origin \"$pin\"" --name="$name" $append + + # Get the public key for the repo + if [ -n "$key" ] + then + mkdir -p "/etc/apt/trusted.gpg.d" + if [[ "$(basename "$key")" =~ ".asc" ]] + then + local key_ext=asc + else + local key_ext=gpg + fi + wget -q "$key" -O - | $wget_append /etc/apt/trusted.gpg.d/$name.$key_ext + fi + + # Update the list of package with the new repo + ynh_package_update +} + +# Remove an extra repository and the assiociated configuration. +# +# usage: ynh_remove_extra_repo [--name=name] +# | arg: -n, --name - Name for the files for this repo, $app as default value. +ynh_remove_extra_repo () { + # Declare an array to define the options of this helper. + local legacy_args=n + declare -Ar args_array=( [n]=name= ) + local name + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + + ynh_secure_remove "/etc/apt/sources.list.d/$name.list" + ynh_secure_remove "/etc/apt/preferences.d/$name" + ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.gpg" + ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.asc" + + # Update the list of package to exclude the old repo + ynh_package_update +} diff --git a/scripts/install b/scripts/install index 1a1da608..c918054c 100644 --- a/scripts/install +++ b/scripts/install @@ -7,9 +7,6 @@ #================================================= source _common.sh -source ynh_install_php -source ynh_add_secure_repos__2 -source ynh_composer source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/remove b/scripts/remove index 409db586..c3373304 100644 --- a/scripts/remove +++ b/scripts/remove @@ -7,8 +7,6 @@ #================================================= source _common.sh -source ynh_install_php -source ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= @@ -87,4 +85,4 @@ ynh_system_user_delete "$app" # END OF SCRIPT #================================================= -ynh_print_info "Removal of $app completed" +ynh_print_info "Removal of $app completed" \ No newline at end of file diff --git a/scripts/ynh_add_secure_repos__2 b/scripts/ynh_add_secure_repos__2 deleted file mode 100644 index 22185f48..00000000 --- a/scripts/ynh_add_secure_repos__2 +++ /dev/null @@ -1,173 +0,0 @@ -#!/bin/bash - -# Pin a repository. -# -# usage: ynh_pin_repo --package=packages --pin=pin_filter --priority=priority_value [--name=name] [--append] -# | arg: -p, --package - Packages concerned by the pin. Or all, *. -# | arg: -i, --pin - Filter for the pin. -# | arg: -p, --priority - Priority for the pin -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -# -# See https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html for information about pinning. -# -ynh_pin_repo () { - # Declare an array to define the options of this helper. - local legacy_args=pirna - declare -Ar args_array=( [p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append ) - local package - local pin - local priority - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - package="${package:-*}" - priority=${priority:-50} - name="${name:-$app}" - append=${append:-0} - - if [ $append -eq 1 ] - then - append="tee -a" - else - append="tee" - fi - - mkdir -p "/etc/apt/preferences.d" - echo "Package: $package -Pin: $pin -Pin-Priority: $priority" \ - | $append "/etc/apt/preferences.d/$name" -} - -# Add a repository. -# -# usage: ynh_add_repo --uri=uri --suite=suite --component=component [--name=name] [--append] -# | arg: -u, --uri - Uri of the repository. -# | arg: -s, --suite - Suite of the repository. -# | arg: -c, --component - Component of the repository. -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -# -# Example for a repo like deb http://forge.yunohost.org/debian/ stretch stable -# uri suite component -# ynh_add_repo --uri=http://forge.yunohost.org/debian/ --suite=stretch --component=stable -# -ynh_add_repo () { - # Declare an array to define the options of this helper. - local legacy_args=uscna - declare -Ar args_array=( [u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append ) - local uri - local suite - local component - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - append=${append:-0} - - if [ $append -eq 1 ] - then - append="tee -a" - else - append="tee" - fi - - mkdir -p "/etc/apt/sources.list.d" - # Add the new repo in sources.list.d - echo "deb $uri $suite $component" \ - | $append "/etc/apt/sources.list.d/$name.list" -} - -# Add an extra repository correctly, pin it and get the key. -# -# usage: ynh_install_extra_repo --repo="repo" [--key=key_url] [--name=name] [--append] -# | arg: -r, --repo - Complete url of the extra repository. -# | arg: -k, --key - url to get the public key. -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -ynh_install_extra_repo () { - # Declare an array to define the options of this helper. - local legacy_args=rkna - declare -Ar args_array=( [r]=repo= [k]=key= [n]=name= [a]=append ) - local repo - local key - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - append=${append:-0} - key=${key:-0} - - if [ $append -eq 1 ] - then - append="--append" - wget_append="tee -a" - else - append="" - wget_append="tee" - fi - - # Split the repository into uri, suite and components. - # Remove "deb " at the beginning of the repo. - repo="${repo#deb }" - - # Get the uri - local uri="$(echo "$repo" | awk '{ print $1 }')" - - # Get the suite - local suite="$(echo "$repo" | awk '{ print $2 }')" - - # Get the components - local component="${repo##$uri $suite }" - - # Add the repository into sources.list.d - ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append - - # Pin the new repo with the default priority, so it won't be used for upgrades. - # Build $pin from the uri without http and any sub path - local pin="${uri#*://}" - pin="${pin%%/*}" - ynh_pin_repo --package="*" --pin="origin \"$pin\"" --name="$name" $append - - # Get the public key for the repo - if [ -n "$key" ] - then - mkdir -p "/etc/apt/trusted.gpg.d" - if [[ "$(basename "$key")" =~ ".asc" ]] - then - local key_ext=asc - else - local key_ext=gpg - fi - wget -q "$key" -O - | $wget_append /etc/apt/trusted.gpg.d/$name.$key_ext - fi - - # Update the list of package with the new repo - ynh_package_update -} - -# Remove an extra repository and the assiociated configuration. -# -# usage: ynh_remove_extra_repo [--name=name] -# | arg: -n, --name - Name for the files for this repo, $app as default value. -ynh_remove_extra_repo () { - # Declare an array to define the options of this helper. - local legacy_args=n - declare -Ar args_array=( [n]=name= ) - local name - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - - ynh_secure_remove "/etc/apt/sources.list.d/$name.list" - ynh_secure_remove "/etc/apt/preferences.d/$name" - ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.gpg" - ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.asc" - - # Update the list of package to exclude the old repo - ynh_package_update -} diff --git a/scripts/ynh_composer b/scripts/ynh_composer deleted file mode 100644 index 3e9cecac..00000000 --- a/scripts/ynh_composer +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -# Execute a command with Composer -# -# usage: ynh_composer_exec [--workdir=$final_path] --commands="commands" -# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path. -# | arg: -c, --commands - Commands to execute. -ynh_composer_exec () { - # Declare an array to define the options of this helper. - local legacy_args=wc - declare -Ar args_array=( [w]=workdir= [c]=commands= ) - local workdir - local commands - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - workdir="${workdir:-$final_path}" - - COMPOSER_HOME="$workdir/.composer" \ - php "$workdir/composer.phar" $commands \ - -d "$workdir" --quiet --no-interaction -} - -# Install and initialize Composer in the given directory -# -# usage: ynh_install_composer [--workdir=$final_path] -# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path. -ynh_install_composer () { - # Declare an array to define the options of this helper. - local legacy_args=w - declare -Ar args_array=( [w]=workdir= ) - local workdir - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - workdir="${workdir:-$final_path}" - - curl -sS https://getcomposer.org/installer \ - | COMPOSER_HOME="$workdir/.composer" \ - php -- --quiet --install-dir="$workdir" \ - || ynh_die "Unable to install Composer." - - # update dependencies to create composer.lock - ynh_composer_exec --workdir="$workdir" --commands="install --no-dev" \ - || ynh_die "Unable to update core dependencies with Composer." -} diff --git a/scripts/ynh_install_php b/scripts/ynh_install_php index c7d50567..05a7907c 100644 --- a/scripts/ynh_install_php +++ b/scripts/ynh_install_php @@ -1,139 +1,2 @@ #!/bin/bash -# Install another version of php. -# -# usage: ynh_install_php --phpversion=phpversion -# | arg: -v, --phpversion - Version of php to install. Can be one of 7.1, 7.2 or 7.3 -ynh_install_php () { - # Declare an array to define the options of this helper. - local legacy_args=v - declare -Ar args_array=( [v]=phpversion= ) - local phpversion - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - # Store php_version into the config of this app - ynh_app_setting_set $app php_version $phpversion - - # Install an extra repo to get multiple php versions - ynh_install_extra_repo --repo="https://packages.sury.org/php/ $(lsb_release -sc) main" --key="https://packages.sury.org/php/apt.gpg" --name=php - - if [ "$phpversion" == "7.0" ]; then - ynh_die "Do not use ynh_install_php to install php7.0" - - # Php 7.1 - elif [ "$phpversion" == "7.1" ]; then - # Get the current version available for libpcre3 on packages.sury.org - local libpcre3_version=$(apt-cache madison "libpcre3" | grep "packages.sury.org" | tail -n1 | awk '{print $3}') - - # equivs doesn't handle correctly this dependence. - # Force the upgrade of libpcre3 for php7.1 - ynh_package_install "libpcre3=$libpcre3_version" - - local php_dependencies="php7.1, php7.1-fpm" - - # Php 7.2 - elif [ "$phpversion" == "7.2" ]; then - # Get the current version available for libpcre3 on packages.sury.org - local libpcre3_version=$(apt-cache madison "libpcre3" | grep "packages.sury.org" | tail -n1 | awk '{print $3}') - - # equivs doesn't handle correctly this dependence. - # Force the upgrade of libpcre3 for php7.2 - ynh_package_install "libpcre3=$libpcre3_version" - - local php_dependencies="php7.2, php7.2-fpm" - - # Php 7.3 - elif [ "$phpversion" == "7.3" ]; then - # Get the current version available for libpcre2-8-0 on packages.sury.org - local libpcre2_version=$(apt-cache madison "libpcre2-8-0" | grep "packages.sury.org" | tail -n1 | awk '{print $3}') - - # equivs doesn't handle correctly this dependence. - # Force the upgrade of libpcre2-8-0 for php7.3 - ynh_package_install "libpcre2-8-0=$libpcre2_version" - - local php_dependencies="php7.3, php7.3-fpm" - - else - ynh_die "The version $phpversion of php isn't handle by this helper." - fi - - # Store the ID of this app and the version of php requested for it - echo "$YNH_APP_ID:$phpversion" | tee --append "/etc/php/ynh_app_version" - - # Build a control file for equivs-build - echo "Section: misc -Priority: optional -Package: php${phpversion}-ynh-deps -Version: 1.0 -Depends: $php_dependencies -Architecture: all -Description: Fake package for php_$phpversion dependencies - This meta-package is only responsible of installing its dependencies." \ - > /tmp/php_${phpversion}-ynh-deps.control - - # Install the fake package for php - ynh_package_install_from_equivs /tmp/php_${phpversion}-ynh-deps.control \ - || ynh_die --message="Unable to install dependencies" - ynh_secure_remove /tmp/php_${phpversion}-ynh-deps.control - - # Advertise service in admin panel - yunohost service add php${phpversion}-fpm --log "/var/log/php${phpversion}-fpm.log" -} - -ynh_remove_php () { - # Get the version of php used by this app - local phpversion=$(ynh_app_setting_get $app php_version) - - if [ "$phpversion" == "7.0" ] || [ -z "$phpversion" ] - then - if [ "$phpversion" == "7.0" ] - then - ynh_print_err "Do not use ynh_remove_php to install php7.0" - fi - return 0 - fi - - # Remove the line for this app - sed --in-place "/$YNH_APP_ID:$phpversion/d" "/etc/php/ynh_app_version" - - # If no other app uses this version of php, remove it. - if ! grep --quiet "$phpversion" "/etc/php/ynh_app_version" - then - # Remove the metapackage for php - ynh_package_autopurge php${phpversion}-ynh-deps - # Then remove php-fpm php-cli for this version. - # The previous command won't remove them, but we have to remove those package to clean php - ynh_package_autopurge php${phpversion}-fpm php${phpversion}-cli - - if [ "$phpversion" == "7.1" ] || [ "$phpversion" == "7.2" ] - then - # Do not restore libpcre3 if php7.1 or 7.2 is still used. - if ! grep --quiet --extended-regexp "7.1|7.2" "/etc/php/ynh_app_version" - then - # Get the current version available for libpcre3 on the standard repo - local libpcre3_version=$(apt-cache madison "libpcre3" | grep "debian.org" | tail -n1 | awk '{print $3}') - - # Force to reinstall the standard version of libpcre3 - ynh_package_install --allow-downgrades libpcre3=$libpcre3_version >&2 - fi - elif [ "$phpversion" == "7.3" ] - then - # Get the current version available for libpcre2-8-0 on the standard repo - local libpcre2_version=$(apt-cache madison "libpcre2-8-0" | grep "debian.org" | tail -n1 | awk '{print $3}') - - # Force to reinstall the standard version of libpcre2-8-0 - ynh_package_install --allow-downgrades libpcre2-8-0=$libpcre2_version - fi - - # Remove the service from the admin panel - yunohost service remove php${phpversion}-fpm - fi - - # If no other app uses alternate php versions, remove the extra repo for php - if [ ! -s "/etc/php/ynh_app_version" ] - then - ynh_remove_extra_repo --name=php - ynh_secure_remove /etc/php/ynh_app_version - fi -} From 042695899264c335797d3b7fb63aeb76a634d719 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Sun, 31 Mar 2019 15:22:41 +0200 Subject: [PATCH 12/18] remove ynh_install_php --- scripts/ynh_install_php | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 scripts/ynh_install_php diff --git a/scripts/ynh_install_php b/scripts/ynh_install_php deleted file mode 100644 index 05a7907c..00000000 --- a/scripts/ynh_install_php +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash - From 41577b9bc7a7ddd57e301c754852a816192ae88a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Sun, 31 Mar 2019 15:25:25 +0200 Subject: [PATCH 13/18] use the right folder for app.conf backup and restore --- scripts/backup | 2 +- scripts/restore | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/backup b/scripts/backup index cee0a2b4..4220f643 100644 --- a/scripts/backup +++ b/scripts/backup @@ -53,7 +53,7 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_print_info "Backing up php-fpm configuration..." -ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/7.2/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/restore b/scripts/restore index fb5dd4b2..aa21579d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -77,7 +77,7 @@ chown -R root: $final_path # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_restore_file "/etc/php/7.2/fpm/pool.d/$app.conf" #================================================= # SPECIFIC RESTORATION @@ -131,7 +131,7 @@ ynh_restore_file "/etc/logrotate.d/$app" #================================================= ynh_print_info "Reloading nginx web server and php-fpm..." -systemctl reload php7.0-fpm +systemctl reload php7.2-fpm systemctl reload nginx #================================================= From 0e139f5e42a632ee695b3ce95758bbf7c1c7c3ee Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Sun, 31 Mar 2019 15:29:21 +0200 Subject: [PATCH 14/18] use postgresql for backup and restore --- scripts/backup | 6 +++--- scripts/install | 1 + scripts/restore | 11 ++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/backup b/scripts/backup index 4220f643..446c098b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -56,11 +56,11 @@ ynh_print_info "Backing up php-fpm configuration..." ynh_backup "/etc/php/7.2/fpm/pool.d/$app.conf" #================================================= -# BACKUP THE MYSQL DATABASE +# BACKUP THE PostgreSQL DATABASE #================================================= -ynh_print_info "Backing up the MySQL database..." +ynh_print_info "Backing up the PostgreSQL database..." -ynh_mysql_dump_db "$db_name" > db.sql +ynh_psql_dump_db "$db_name" > db.sql #================================================= # SPECIFIC BACKUP diff --git a/scripts/install b/scripts/install index c918054c..5592500c 100644 --- a/scripts/install +++ b/scripts/install @@ -67,6 +67,7 @@ db_name=$(ynh_sanitize_dbid $app) db_user=$db_name db_pwd=$(ynh_string_random) ynh_app_setting_set $app db_name $db_name +ynh_app_setting_set $app db_pwd $db_pwd # Initialize database and store postgres password for upgrade ynh_psql_setup_db $db_user $db_name $db_pwd diff --git a/scripts/restore b/scripts/restore index aa21579d..84b9be88 100644 --- a/scripts/restore +++ b/scripts/restore @@ -32,6 +32,7 @@ domain=$(ynh_app_setting_get $app domain) path_url=$(ynh_app_setting_get $app path) final_path=$(ynh_app_setting_get $app final_path) db_name=$(ynh_app_setting_get $app db_name) +db_pwd=$(ynh_app_setting_get $app db_pwd) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -90,13 +91,13 @@ ynh_print_info "Reinstalling dependencies..." ynh_install_app_dependencies $pkg_dependencies #================================================= -# RESTORE THE MYSQL DATABASE +# RESTORE THE PostgreSQL DATABASE #================================================= -ynh_print_info "Restoring the MySQL database..." +ynh_print_info "Restoring the PostgreSQL database..." -db_pwd=$(ynh_app_setting_get $app mysqlpwd) -ynh_mysql_setup_db $db_name $db_name $db_pwd -ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql +ynh_psql_test_if_first_run +ynh_psql_create_db "$db_name" "$db_name" "$db_pwd" +ynh_psql_execute_file_as_root ./db.sql "$db_name" #================================================= # RESTORE SYSTEMD From caad917ea68f70cb776e96197f7142764338e1ce Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Sun, 31 Mar 2019 15:33:09 +0200 Subject: [PATCH 15/18] follow shellcheck suggestions about quotes --- scripts/backup | 6 +++--- scripts/change_url | 4 ++-- scripts/install | 16 ++++++++-------- scripts/remove | 4 ++-- scripts/restore | 24 ++++++++++++------------ scripts/upgrade | 38 +++++++++++++++++++------------------- 6 files changed, 46 insertions(+), 46 deletions(-) diff --git a/scripts/backup b/scripts/backup index 446c098b..8871560e 100644 --- a/scripts/backup +++ b/scripts/backup @@ -28,9 +28,9 @@ ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get $app final_path) -domain=$(ynh_app_setting_get $app domain) -db_name=$(ynh_app_setting_get $app db_name) +final_path=$(ynh_app_setting_get "$app" final_path) +domain=$(ynh_app_setting_get "$app" domain) +db_name=$(ynh_app_setting_get "$app" db_name) #================================================= # STANDARD BACKUP STEPS diff --git a/scripts/change_url b/scripts/change_url index 7b500d34..60846630 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -27,7 +27,7 @@ app=$YNH_APP_INSTANCE_NAME ynh_print_info "Loading installation settings..." # Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get $app final_path) +final_path=$(ynh_app_setting_get "$app" final_path) # Add settings here as needed by your application #db_name=$(ynh_app_setting_get "$app" db_name) @@ -75,7 +75,7 @@ if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location ynh_delete_file_checksum "$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + mv "$nginx_conf_path" "/etc/nginx/conf.d/$new_domain.d/$app.conf" # Store file checksum for the new config file location ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" fi diff --git a/scripts/install b/scripts/install index 5592500c..7b0c0a75 100644 --- a/scripts/install +++ b/scripts/install @@ -54,7 +54,7 @@ ynh_print_info "Installing dependencies..." ynh_install_php --phpversion="7.2" -ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies "$pkg_dependencies" #================================================= # CREATE A POSTGRESQL DATABASE @@ -63,14 +63,14 @@ ynh_print_info "Creating a PostgreSQL database..." ynh_psql_test_if_first_run -db_name=$(ynh_sanitize_dbid $app) +db_name=$(ynh_sanitize_dbid "$app") db_user=$db_name db_pwd=$(ynh_string_random) -ynh_app_setting_set $app db_name $db_name -ynh_app_setting_set $app db_pwd $db_pwd +ynh_app_setting_set "$app" db_name "$db_name" +ynh_app_setting_set "$app" db_pwd "$db_pwd" # Initialize database and store postgres password for upgrade -ynh_psql_setup_db $db_user $db_name $db_pwd +ynh_psql_setup_db "$db_user" "$db_name" "$db_pwd" systemctl reload postgresql @@ -107,7 +107,7 @@ ynh_print_info "Configuring php-fpm..." ynh_add_fpm_config --phpversion="7.2" #Ugly move waiting 'ynh_add_fpm_config --phpversion='' released -mv /etc/php/7.0/fpm/pool.d/$app.conf /etc/php/7.2/fpm/pool.d/$app.conf +mv "/etc/php/7.0/fpm/pool.d/$app.conf" "/etc/php/7.2/fpm/pool.d/$app.conf" systemctl reload php7.2-fpm #================================================= @@ -116,7 +116,7 @@ systemctl reload php7.2-fpm chown -R "$app": "$final_path" -ynh_install_composer --workdir=$final_path +ynh_install_composer --workdir="$final_path" #================================================= # SPECIFIC SETUP @@ -145,7 +145,7 @@ ynh_store_file_checksum "$config" # DEPLOYMENT #================================================= -pushd $final_path +pushd "$final_path" php7.2 artisan -n key:generate --force php7.2 artisan config:clear php7.2 artisan config:cache diff --git a/scripts/remove b/scripts/remove index c3373304..8fd30572 100644 --- a/scripts/remove +++ b/scripts/remove @@ -32,7 +32,7 @@ ynh_psql_execute_as_root "\connect $db_name SELECT pg_terminate_backend (pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$db_name';" # Remove a database if it exists, along with the associated user -ynh_psql_remove_db $db_user $db_name +ynh_psql_remove_db "$db_user" "$db_name" #================================================= # REMOVE PHP-FPM CONFIGURATION @@ -40,7 +40,7 @@ ynh_psql_remove_db $db_user $db_name ynh_print_info "Removing php-fpm configuration" #Ugly move waiting 'ynh_add_fpm_config --phpversion='' released -mv /etc/php/7.2/fpm/pool.d/$app.conf /etc/php/7.0/fpm/pool.d/$app.conf +mv "/etc/php/7.2/fpm/pool.d/$app.conf" "/etc/php/7.0/fpm/pool.d/$app.conf" systemctl reload php7.2-fpm # Remove the dedicated php-fpm config diff --git a/scripts/restore b/scripts/restore index 84b9be88..d9035164 100644 --- a/scripts/restore +++ b/scripts/restore @@ -28,20 +28,20 @@ ynh_print_info "Loading settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) -final_path=$(ynh_app_setting_get $app final_path) -db_name=$(ynh_app_setting_get $app db_name) -db_pwd=$(ynh_app_setting_get $app db_pwd) +domain=$(ynh_app_setting_get "$app" domain) +path_url=$(ynh_app_setting_get "$app" path) +final_path=$(ynh_app_setting_get "$app" final_path) +db_name=$(ynh_app_setting_get "$app" db_name) +db_pwd=$(ynh_app_setting_get "$app" db_pwd) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= ynh_print_info "Validating restoration parameters..." -ynh_webpath_available $domain $path_url \ +ynh_webpath_available "$domain" "$path_url" \ || ynh_die "Path not available: ${domain}${path_url}" -test ! -d $final_path \ +test ! -d "$final_path" \ || ynh_die "There is already a directory: $final_path " #================================================= @@ -65,14 +65,14 @@ ynh_restore_file "$final_path" ynh_print_info "Recreating the dedicated system user..." # Create the dedicated user (if not existing) -ynh_system_user_create $app +ynh_system_user_create "$app" #================================================= # RESTORE USER RIGHTS #================================================= # Restore permissions on app files -chown -R root: $final_path +chown -R root: "$final_path" #================================================= # RESTORE THE PHP-FPM CONFIGURATION @@ -88,7 +88,7 @@ ynh_restore_file "/etc/php/7.2/fpm/pool.d/$app.conf" ynh_print_info "Reinstalling dependencies..." # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies "$pkg_dependencies" #================================================= # RESTORE THE PostgreSQL DATABASE @@ -105,13 +105,13 @@ ynh_psql_execute_file_as_root ./db.sql "$db_name" ynh_print_info "Restoring the systemd configuration..." ynh_restore_file "/etc/systemd/system/$app.service" -systemctl enable $app.service +systemctl enable "$app".service #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --log "/var/log/$app/$app.log" +yunohost service add "$app" --log "/var/log/$app/$app.log" #================================================= # RESTORE THE CRON FILE diff --git a/scripts/upgrade b/scripts/upgrade index a91107e9..843069f0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,13 +16,13 @@ ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) -admin=$(ynh_app_setting_get $app admin) -is_public=$(ynh_app_setting_get $app is_public) -final_path=$(ynh_app_setting_get $app final_path) -language=$(ynh_app_setting_get $app language) -db_name=$(ynh_app_setting_get $app db_name) +domain=$(ynh_app_setting_get "$app" domain) +path_url=$(ynh_app_setting_get "$app" path) +admin=$(ynh_app_setting_get "$app" admin) +is_public=$(ynh_app_setting_get "$app" is_public) +final_path=$(ynh_app_setting_get "$app" final_path) +language=$(ynh_app_setting_get "$app" language) +db_name=$(ynh_app_setting_get "$app" db_name) #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -31,23 +31,23 @@ ynh_print_info "Ensuring downward compatibility..." # Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set $app is_public 1 + ynh_app_setting_set "$app" is_public 1 is_public=1 elif [ "$is_public" = "No" ]; then - ynh_app_setting_set $app is_public 0 + ynh_app_setting_set "$app" is_public 0 is_public=0 fi # If db_name doesn't exist, create it -if [ -z $db_name ]; then - db_name=$(ynh_sanitize_dbid $app) - ynh_app_setting_set $app db_name $db_name +if [ -z "$db_name" ]; then + db_name=$(ynh_sanitize_dbid "$app") + ynh_app_setting_set "$app" db_name "$db_name" fi # If final_path doesn't exist, create it -if [ -z $final_path ]; then +if [ -z "$final_path" ]; then final_path=/var/www/$app - ynh_app_setting_set $app final_path $final_path + ynh_app_setting_set "$app" final_path "$final_path" fi #================================================= @@ -74,7 +74,7 @@ ynh_abort_if_errors # instead of /foo .... # If nobody installed your app before 2.7, then you may # safely remove this line -path_url=$(ynh_normalize_url_path $path_url) +path_url=$(ynh_normalize_url_path "$path_url") #================================================= # STANDARD UPGRADE STEPS @@ -99,7 +99,7 @@ ynh_add_nginx_config #================================================= ynh_print_info "Upgrading dependencies..." -ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies "$pkg_dependencies" #================================================= # CREATE DEDICATED USER @@ -107,7 +107,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_print_info "Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create $app +ynh_system_user_create "$app" #================================================= # PHP-FPM CONFIGURATION @@ -152,7 +152,7 @@ ynh_add_systemd_config #================================================= # Set permissions on app files -chown -R root: $final_path +chown -R root: "$final_path" #================================================= # SETUP SSOWAT @@ -163,7 +163,7 @@ ynh_print_info "Upgrading SSOwat configuration..." if [ $is_public -eq 1 ] then # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set $app unprotected_uris "/" + ynh_app_setting_set "$app" unprotected_uris "/" fi #================================================= From 5911a4fa767aead96146b665d2b5b8a13d130763 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 31 Mar 2019 17:51:19 +0200 Subject: [PATCH 16/18] switch from imagick to gd --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index cf0fed16..f467f6e0 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,7 +8,7 @@ pkg_dependencies="php7.2-pgsql php7.2-mbstring php7.2-bcmath php7.2-simplexml php7.2-curl postgresql redis-server \ php7.2-intl php7.2-exif \ libfreetype6 libjpeg62-turbo libpng16-16 libxpm4 libvpx4 libwebp6 libmagickwand-6.q16-3 \ -php7.2-imagick imagick \ +php7.2-gd \ pngquant jpegoptim gifsicle" #================================================= From d6006899e254fa5e21fe9c0e810fa31b10a68b97 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 31 Mar 2019 18:13:28 +0200 Subject: [PATCH 17/18] Fix bug generated by ynh_install_extra_repo --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index f467f6e0..8e0bc493 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -349,7 +349,7 @@ ynh_install_extra_repo () { else local key_ext=gpg fi - wget -q "$key" -O - | $wget_append /etc/apt/trusted.gpg.d/$name.$key_ext + wget -q "$key" -O - | gpg --dearmor | $wget_append /etc/apt/trusted.gpg.d/$name.$key_ext > /dev/null fi # Update the list of package with the new repo From 146598b0c15958d513dcae591c80b56529f7fc66 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 31 Mar 2019 19:33:25 +0200 Subject: [PATCH 18/18] reorder nginx and php-fpm --- scripts/install | 1 + scripts/remove | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/install b/scripts/install index 7b0c0a75..4c263969 100644 --- a/scripts/install +++ b/scripts/install @@ -108,6 +108,7 @@ ynh_add_fpm_config --phpversion="7.2" #Ugly move waiting 'ynh_add_fpm_config --phpversion='' released mv "/etc/php/7.0/fpm/pool.d/$app.conf" "/etc/php/7.2/fpm/pool.d/$app.conf" +systemctl reload php7.0-fpm systemctl reload php7.2-fpm #================================================= diff --git a/scripts/remove b/scripts/remove index 8fd30572..5784d04e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -34,6 +34,14 @@ SELECT pg_terminate_backend (pg_stat_activity.pid) FROM pg_stat_activity WHERE p # Remove a database if it exists, along with the associated user ynh_psql_remove_db "$db_user" "$db_name" +#================================================= +# REMOVE NGINX CONFIGURATION +#================================================= +ynh_print_info "Removing nginx web server configuration" + +# Remove the dedicated nginx config +ynh_remove_nginx_config + #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= @@ -42,6 +50,7 @@ ynh_print_info "Removing php-fpm configuration" #Ugly move waiting 'ynh_add_fpm_config --phpversion='' released mv "/etc/php/7.2/fpm/pool.d/$app.conf" "/etc/php/7.0/fpm/pool.d/$app.conf" systemctl reload php7.2-fpm +systemctl reload php7.0-fpm # Remove the dedicated php-fpm config ynh_remove_fpm_config @@ -52,8 +61,8 @@ ynh_remove_fpm_config ynh_print_info "Removing dependencies" # Remove metapackage and its dependencies -ynh_remove_php ynh_remove_app_dependencies +ynh_remove_php #================================================= # REMOVE APP MAIN DIR @@ -63,14 +72,6 @@ ynh_print_info "Removing app main directory" # Remove the app directory securely ynh_secure_remove "$final_path" -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_print_info "Removing nginx web server configuration" - -# Remove the dedicated nginx config -ynh_remove_nginx_config - #================================================= # GENERIC FINALIZATION #================================================= @@ -85,4 +86,4 @@ ynh_system_user_delete "$app" # END OF SCRIPT #================================================= -ynh_print_info "Removal of $app completed" \ No newline at end of file +ynh_print_info "Removal of $app completed"