From a4db1edb5cfdb0f2e27504c7b92d5fd8f84a09ed Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 13 Feb 2019 14:00:22 +0100 Subject: [SSUS] php.ini patching: Look for php5 and php7 --- satellit_upgrader/updater.template.sh | 37 +++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh index 2f34c0c..88f6639 100644 --- a/satellit_upgrader/updater.template.sh +++ b/satellit_upgrader/updater.template.sh @@ -428,23 +428,30 @@ fi # ************************** PHP *************************** -declare -rg PHPINIFILE=/etc/php5/cgi/php.ini -if ! grep -q -E '^\s*upload_max_filesize = 100M' "$PHPINIFILE"; then - echo "PHP: Increasing upload_max_filesize to 100MB" - if grep -q -E '^\s*upload_max_filesize' "$PHPINIFILE"; then - sed -i -e '/^\s*upload_max_filesize/c\upload_max_filesize = 100M' "$PHPINIFILE" || pwarning "Could not increase PHP upload limit :( (1.a)" - else - echo "upload_max_filesize = 100M" >> "$PHPINIFILE" || pwarning "Could not incease PHP upload limit :( (2.a)" +inicount=0 +for PHPINIFILE in "/etc/php5/cgi/php.ini" "/etc/php/7.0/cgi/php.ini"; do + [ -f "$PHPINIFILE" ] || continue + inicount=$(( inicount + 1 )) + if ! grep -q -E '^\s*upload_max_filesize = 100M' "$PHPINIFILE"; then + echo "PHP: Increasing upload_max_filesize to 100MB" + if grep -q -E '^\s*upload_max_filesize' "$PHPINIFILE"; then + sed -i -e '/^\s*upload_max_filesize/c\upload_max_filesize = 100M' "$PHPINIFILE" || pwarning "Could not increase PHP upload limit :( (1.a)" + else + echo "upload_max_filesize = 100M" >> "$PHPINIFILE" || pwarning "Could not incease PHP upload limit :( (2.a)" + fi fi -fi -if ! grep -q -E '^\s*post_max_size = 100M' "$PHPINIFILE"; then - echo "PHP: Increasing post_max_size to 100MB" - if grep -q -E '^\s*post_max_size' "$PHPINIFILE"; then - sed -i -e '/^\s*post_max_size/c\post_max_size = 100M' "$PHPINIFILE" || pwarning "Could not increase PHP upload limit :( (1.b)" - else - echo "post_max_size = 100M" >> "$PHPINIFILE" || pwarning "Could not incease PHP upload limit :( (2.b)" + if ! grep -q -E '^\s*post_max_size = 100M' "$PHPINIFILE"; then + echo "PHP: Increasing post_max_size to 100MB" + if grep -q -E '^\s*post_max_size' "$PHPINIFILE"; then + sed -i -e '/^\s*post_max_size/c\post_max_size = 100M' "$PHPINIFILE" || pwarning "Could not increase PHP upload limit :( (1.b)" + else + echo "post_max_size = 100M" >> "$PHPINIFILE" || pwarning "Could not incease PHP upload limit :( (2.b)" + fi + RESTART_LIGHTY=ja fi - RESTART_LIGHTY=ja +done +if [ "$inicount" -ne 1 ]; then + pwarning "Odd. Found $inicount php.ini files, expected only one..." fi echo "* TFTP" -- cgit v1.2.3-55-g7522