Add a --yes command line option to setup-web.sh to allow non-interactive use. Fixes #5610.

This commit is contained in:
Dave Page 2020-07-27 06:29:01 -04:00
parent f93cfe8c4c
commit f57558fdb2
2 changed files with 32 additions and 4 deletions

View File

@ -9,6 +9,7 @@ This release contains a number of bug fixes and new features since the release o
New features
************
| `Issue #5610 <https://redmine.postgresql.org/issues/5610>`_ - Add a --yes command line option to setup-web.sh to allow non-interactive use.
Housekeeping
************
@ -20,4 +21,4 @@ Bug fixes
*********
| `Issue #4810 <https://redmine.postgresql.org/issues/4810>`_ - Fixed an issue where the user is not able to save the new row if the table is empty.
| `Issue #5646 <https://redmine.postgresql.org/issues/5646>`_ - Ensure that RLS Policy node should be searchable using search object.
| `Issue #5646 <https://redmine.postgresql.org/issues/5646>`_ - Ensure that RLS Policy node should be searchable using search object.

View File

@ -9,11 +9,23 @@ if [ "$EUID" -ne 0 ]
exit 1
fi
if [[ "$#" -ne 0 ]] && ([[ "$#" -eq 1 ]] && [[ "$1" != "--yes" ]]); then
echo "Usage: $0 [--yes]"
exit 1
fi
# Get the distro
IS_REDHAT=0
IS_DEBIAN=0
UNAME=$(uname -a)
# Is this an automated install?
AUTOMATED=0
if [ "$#" -eq 1 ]; then
AUTOMATED=1
echo "Running in non-interactive mode..."
fi
if [ -f /etc/redhat-release ]; then
IS_REDHAT=1
APACHE=httpd
@ -57,7 +69,12 @@ fi
# Setup Apache on Debian/Ubuntu
if [ ${IS_DEBIAN} == 1 ]; then
read -p "We can now configure the Apache Web server for you. This involves enabling the wsgi module and configuring the pgAdmin 4 application to mount at /pgadmin4. Do you wish to continue (y/n)? " RESPONSE
if [ ${AUTOMATED} == 1 ]; then
RESPONSE=Y
else
read -p "We can now configure the Apache Web server for you. This involves enabling the wsgi module and configuring the pgAdmin 4 application to mount at /pgadmin4. Do you wish to continue (y/n)? " RESPONSE
fi
case ${RESPONSE} in
y|Y )
a2enmod wsgi 1> /dev/null
@ -70,7 +87,12 @@ fi
APACHE_STATUS=`ps cax | grep ${APACHE}`
if [ $? -eq 0 ]; then
read -p "The Apache web server is running and must be restarted for the pgAdmin 4 installation to complete. Continue (y/n)? " RESPONSE
if [ ${AUTOMATED} == 1 ]; then
RESPONSE=Y
else
read -p "The Apache web server is running and must be restarted for the pgAdmin 4 installation to complete. Continue (y/n)? " RESPONSE
fi
case ${RESPONSE} in
y|Y )
systemctl restart ${APACHE}
@ -83,7 +105,12 @@ if [ $? -eq 0 ]; then
exit 1;;
esac
else
read -p "The Apache web server is not running. We can enable and start the web server for you to finish pgAdmin 4 installation. Continue (y/n)? " RESPONSE
if [ ${AUTOMATED} == 1 ]; then
RESPONSE=Y
else
read -p "The Apache web server is not running. We can enable and start the web server for you to finish pgAdmin 4 installation. Continue (y/n)? " RESPONSE
fi
case ${RESPONSE} in
y|Y )
systemctl enable ${APACHE}