dev-db/postgresql: respect PG_AUTOCONFIG env variable
authorAustin English <wizardedit@gentoo.org>
Mon, 3 Apr 2017 20:51:52 +0000 (15:51 -0500)
committerAustin English <wizardedit@gentoo.org>
Mon, 3 Apr 2017 20:56:56 +0000 (15:56 -0500)
This allows configuring postgresql without further input from the input
(i.e., makes it scriptable).

Gentoo-Bug: https://bugs.gentoo.org/610418

dev-db/postgresql/postgresql-9.5.5.ebuild
dev-db/postgresql/postgresql-9.5.6.ebuild
dev-db/postgresql/postgresql-9.6.1-r1.ebuild
dev-db/postgresql/postgresql-9.6.2.ebuild
dev-db/postgresql/postgresql-9999.ebuild

index b352149ac96d8c1320ad6e751b31f552bf2552f5..56cafc185c77b77a9be538486389f7fc447b4708 100644 (file)
@@ -350,17 +350,22 @@ pkg_config() {
        einfo "The database cluster will be created in:"
        einfo "    ${DATA_DIR}"
        einfo
-       while [ "$correct" != "true" ] ; do
-               einfo "Are you ready to continue? (y/n)"
-               read answer
-               if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
-                       correct="true"
-               elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
-                       die "Aborting initialization."
-               else
-                       echo "Answer not recognized"
-               fi
-       done
+
+       if [ -z "$PG_AUTOCONFIG" ] ; then
+               while [ "$correct" != "true" ] ; do
+                       einfo "Are you ready to continue? (y/n)"
+                       read answer
+                       if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
+                               correct="true"
+                       elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
+                               die "Aborting initialization."
+                       else
+                               echo "Answer not recognized"
+                       fi
+               done
+       else
+               einfo "PG_AUTOCONFIG set, not prompting"
+       fi
 
        if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
                eerror "The given directory, '${DATA_DIR}', is not empty."
index 8e8412b1fc7a929d575bee712d0c4a4cf26eaf79..eb493f3f39291ab1808fbdabbe4795d7a71208c1 100644 (file)
@@ -350,17 +350,21 @@ pkg_config() {
        einfo "The database cluster will be created in:"
        einfo "    ${DATA_DIR}"
        einfo
-       while [ "$correct" != "true" ] ; do
-               einfo "Are you ready to continue? (y/n)"
-               read answer
-               if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
-                       correct="true"
-               elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
-                       die "Aborting initialization."
-               else
-                       echo "Answer not recognized"
-               fi
-       done
+       if [ -z "$PG_AUTOCONFIG" ] ; then
+               while [ "$correct" != "true" ] ; do
+                       einfo "Are you ready to continue? (y/n)"
+                       read answer
+                       if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
+                               correct="true"
+                       elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
+                               die "Aborting initialization."
+                       else
+                               echo "Answer not recognized"
+                       fi
+               done
+       else
+               einfo "PG_AUTOCONFIG set, not prompting"
+       fi
 
        if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
                eerror "The given directory, '${DATA_DIR}', is not empty."
index 0c0ba8278ade20e3d2e3fc85bbb19f4eca135a85..0e4412b472c26b07dcc10eb71cdc090445fa3ca9 100644 (file)
@@ -347,17 +347,21 @@ pkg_config() {
        einfo "The database cluster will be created in:"
        einfo "    ${DATA_DIR}"
        einfo
-       while [ "$correct" != "true" ] ; do
-               einfo "Are you ready to continue? (y/n)"
-               read answer
-               if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
-                       correct="true"
-               elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
-                       die "Aborting initialization."
-               else
-                       echo "Answer not recognized"
-               fi
-       done
+       if [ -z "$PG_AUTOCONFIG" ] ; then
+               while [ "$correct" != "true" ] ; do
+                       einfo "Are you ready to continue? (y/n)"
+                       read answer
+                       if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
+                               correct="true"
+                       elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
+                               die "Aborting initialization."
+                       else
+                               echo "Answer not recognized"
+                       fi
+               done
+       else
+               einfo "PG_AUTOCONFIG set, not prompting"
+       fi
 
        if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
                eerror "The given directory, '${DATA_DIR}', is not empty."
index 0c0ba8278ade20e3d2e3fc85bbb19f4eca135a85..0e4412b472c26b07dcc10eb71cdc090445fa3ca9 100644 (file)
@@ -347,17 +347,21 @@ pkg_config() {
        einfo "The database cluster will be created in:"
        einfo "    ${DATA_DIR}"
        einfo
-       while [ "$correct" != "true" ] ; do
-               einfo "Are you ready to continue? (y/n)"
-               read answer
-               if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
-                       correct="true"
-               elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
-                       die "Aborting initialization."
-               else
-                       echo "Answer not recognized"
-               fi
-       done
+       if [ -z "$PG_AUTOCONFIG" ] ; then
+               while [ "$correct" != "true" ] ; do
+                       einfo "Are you ready to continue? (y/n)"
+                       read answer
+                       if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
+                               correct="true"
+                       elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
+                               die "Aborting initialization."
+                       else
+                               echo "Answer not recognized"
+                       fi
+               done
+       else
+               einfo "PG_AUTOCONFIG set, not prompting"
+       fi
 
        if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
                eerror "The given directory, '${DATA_DIR}', is not empty."
index b1d337683362b4749491c5eb41401e97d4057113..6a995c154baa33aa9444c9ea3ab5387c326bf0b0 100644 (file)
@@ -297,17 +297,21 @@ pkg_config() {
        einfo "The database cluster will be created in:"
        einfo "    ${DATA_DIR}"
        einfo
-       while [ "$correct" != "true" ] ; do
-               einfo "Are you ready to continue? (y/n)"
-               read answer
-               if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
-                       correct="true"
-               elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
-                       die "Aborting initialization."
-               else
-                       echo "Answer not recognized"
-               fi
-       done
+       if [ -z "$PG_AUTOCONFIG" ] ; then
+               while [ "$correct" != "true" ] ; do
+                       einfo "Are you ready to continue? (y/n)"
+                       read answer
+                       if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
+                               correct="true"
+                       elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
+                               die "Aborting initialization."
+                       else
+                               echo "Answer not recognized"
+                       fi
+               done
+       else
+               einfo "PG_AUTOCONFIG set, not prompting"
+       fi
 
        if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
                eerror "The given directory, '${DATA_DIR}', is not empty."