Refactor PHP packages to a config

This commit is contained in:
Shivam Mathur 2022-01-03 03:20:24 +05:30
parent 45a631dbaf
commit e6e79e1717
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
2 changed files with 7 additions and 1 deletions

6
src/configs/php_packages Normal file
View File

@ -0,0 +1,6 @@
cli
curl
dev
intl
mbstring
xml

View File

@ -128,7 +128,7 @@ switch_version() {
add_packaged_php() { add_packaged_php() {
if [ "$runner" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then if [ "$runner" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
IFS=' ' read -r -a packages <<<"$(echo "cli curl dev mbstring xml intl" | sed "s/[^ ]*/php$version-&/g")" IFS=' ' read -r -a packages <<<"$(sed "s/[^ ]*/php$version-&/g" "$dist"/../src/configs/php_packages | tr '\n' ' ')"
install_packages "${packages[@]}" install_packages "${packages[@]}"
else else
run_script "php-ubuntu" "$version" run_script "php-ubuntu" "$version"