mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
upgrade ynh_install_php helper
This commit is contained in:
parent
0942da60bf
commit
bcb6775b6a
4 changed files with 19 additions and 31 deletions
|
@ -62,18 +62,20 @@ ynh_install_composer () {
|
||||||
|| ynh_die "Unable to update core dependencies with Composer."
|
|| ynh_die "Unable to update core dependencies with Composer."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Install another version of php.
|
# Install another version of php.
|
||||||
#
|
#
|
||||||
# usage: ynh_install_php --phpversion=phpversion
|
# usage: ynh_install_php --phpversion=phpversion [--package=packages]
|
||||||
# | arg: -v, --phpversion - Version of php to install. Can be one of 7.1, 7.2 or 7.3
|
# | arg: -v, --phpversion - Version of php to install. Can be one of 7.1, 7.2 or 7.3
|
||||||
|
# | arg: -p, --package - Additionnal php packages to install
|
||||||
ynh_install_php () {
|
ynh_install_php () {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=v
|
local legacy_args=vp
|
||||||
declare -Ar args_array=( [v]=phpversion= )
|
declare -Ar args_array=( [v]=phpversion= [p]=package= )
|
||||||
local phpversion
|
local phpversion
|
||||||
|
local package
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
package=${package:-}
|
||||||
|
|
||||||
# Store php_version into the config of this app
|
# Store php_version into the config of this app
|
||||||
ynh_app_setting_set $app php_version $phpversion
|
ynh_app_setting_set $app php_version $phpversion
|
||||||
|
@ -86,7 +88,16 @@ ynh_install_php () {
|
||||||
# Store the ID of this app and the version of php requested for it
|
# Store the ID of this app and the version of php requested for it
|
||||||
echo "$YNH_APP_INSTANCE_NAME:$phpversion" | tee --append "/etc/php/ynh_app_version"
|
echo "$YNH_APP_INSTANCE_NAME:$phpversion" | tee --append "/etc/php/ynh_app_version"
|
||||||
|
|
||||||
ynh_install_extra_app_dependencies --repo="https://packages.sury.org/php/ $(lsb_release -sc) main" --key="https://packages.sury.org/php/apt.gpg" --package="php$phpversion php${phpversion}-fpm php${phpversion}-common"
|
# Add an extra repository for those packages
|
||||||
|
ynh_install_extra_repo --repo="https://packages.sury.org/php/ $(lsb_release -sc) main" --key="https://packages.sury.org/php/apt.gpg" --priority=995 --name=extra_php_version
|
||||||
|
|
||||||
|
# Install requested dependencies from this extra repository.
|
||||||
|
# Install php-fpm first, otherwise php will install apache as a dependency.
|
||||||
|
ynh_add_app_dependencies --package="php${phpversion}-fpm"
|
||||||
|
ynh_add_app_dependencies --package="php$phpversion php${phpversion}-common $package"
|
||||||
|
|
||||||
|
# Remove this extra repository after packages are installed
|
||||||
|
ynh_remove_extra_repo --name=extra_php_version
|
||||||
|
|
||||||
# Advertise service in admin panel
|
# Advertise service in admin panel
|
||||||
yunohost service add php${phpversion}-fpm --log "/var/log/php${phpversion}-fpm.log"
|
yunohost service add php${phpversion}-fpm --log "/var/log/php${phpversion}-fpm.log"
|
||||||
|
@ -124,8 +135,6 @@ ynh_remove_php () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# FUTURE OFFICIAL HELPERS
|
# FUTURE OFFICIAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -59,14 +59,7 @@ ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Installing php..."
|
ynh_print_info "Installing php..."
|
||||||
|
|
||||||
ynh_install_php --phpversion="7.2"
|
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INSTALL PHP DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info "Installing php dependencies..."
|
|
||||||
|
|
||||||
ynh_install_extra_app_dependencies --repo="https://packages.sury.org/php/ $(lsb_release -sc) main" --key="https://packages.sury.org/php/apt.gpg" --package="$extra_pkg_dependencies"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A POSTGRESQL DATABASE
|
# CREATE A POSTGRESQL DATABASE
|
||||||
|
|
|
@ -84,14 +84,7 @@ ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Installing php..."
|
ynh_print_info "Installing php..."
|
||||||
|
|
||||||
ynh_install_php --phpversion="7.2"
|
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INSTALL PHP DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info "Installing php dependencies..."
|
|
||||||
|
|
||||||
ynh_install_extra_app_dependencies --repo="https://packages.sury.org/php/ $(lsb_release -sc) main" --key="https://packages.sury.org/php/apt.gpg" --package="$extra_pkg_dependencies"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE POSTGRESQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
|
|
|
@ -106,14 +106,7 @@ ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading php..."
|
ynh_print_info "Upgrading php..."
|
||||||
|
|
||||||
ynh_install_php --phpversion="7.2"
|
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE PHP DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info "Upgrading php dependencies..."
|
|
||||||
|
|
||||||
ynh_install_extra_app_dependencies --repo="https://packages.sury.org/php/ $(lsb_release -sc) main" --key="https://packages.sury.org/php/apt.gpg" --package="$extra_pkg_dependencies"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
|
Loading…
Add table
Reference in a new issue