From 62ad4e23182210554e108a820fbdffdd31cb6ec4 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 9 Sep 2016 19:41:14 +0200 Subject: [SSUS] Patch max upload filesize in php.ini --- satellit_upgrader/updater.template.sh | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'satellit_upgrader/updater.template.sh') diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh index 93e6067..7476232 100644 --- a/satellit_upgrader/updater.template.sh +++ b/satellit_upgrader/updater.template.sh @@ -287,14 +287,33 @@ if [ -n "$TGZ_TFTP" ]; then echo "TFTP upgrade complete" fi +RESTART_LIGHTY= # ********************** lighttpd config ******************* if [ -e "$FILEDIR/lighttpd.conf" ] && [ -e "/etc/lighttpd/lighttpd.conf" ]; then echo "* Replacing lighttpd.conf" cp "$FILEDIR/lighttpd.conf" "/etc/lighttpd/lighttpd.conf" || perror "Could not replace /etc/lighttpd/lighttpd.conf" - restart_service lighttpd + RESTART_LIGHTY=ja echo "lighttpd config upgrade complete" fi +# ************************** PHP *************************** +declare -rg PHPINIFILE=/etc/php5/cgi/php.ini +if ! grep -q 'upload_max_filesize = 100M' "$PHPINIFILE"; then + echo "* Increasing php upload limit" + 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)" + else + echo "upload_max_filesize = 100M" >> "$PHPINIFILE" || pwarning "Could not incease PHP upload limit :( (2)" + fi + RESTART_LIGHTY=ja +fi + +# ** +if [ -n "$RESTART_LIGHTY" ]; then + echo "* Restarting lighttpd" + restart_service lighttpd +fi + # ********************** atftpd.service ******************** if [ -e "$FILEDIR/atftpd.service" ]; then echo "* Replacing atftpd.service" @@ -338,17 +357,20 @@ fi # ************************** tmate ************************ if ! which tmate > /dev/null 2>&1; then - echo "* tmate" + echo "* Installing tmate" echo "deb http://ftp.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/10-added_repos.list + echo "Running apt update..." if ! apt-get update > "$TMPDIR/apt.log" 2>&1; then cat "$TMPDIR/apt.log" pwarning "Adding backborts repo: update failed" fi + echo "Installing package..." if ! apt-get install -y tmate > "$TMPDIR/apt.log" 2>&1; then cat "$TMPDIR/apt.log" pwarning "Could not install tmate. Easy remote assistance will not be available." pwarning "Please check whether repo 'jessie-backports' was added and install by hand." fi + echo "Writing config..." cat > /root/.tmate.conf <<-JUSTANOTHERDOC set -g tmate-server-host "tmate.ruf.uni-freiburg.de" set -g tmate-server-port 2222 @@ -358,7 +380,7 @@ if ! which tmate > /dev/null 2>&1; then JUSTANOTHERDOC if which tmate > /dev/null 2>&1; then - echo "tmate installation complete" + echo "tmate installation complete!" fi fi -- cgit v1.2.3-55-g7522