Skip to content

Commit

Permalink
dev-db/postgresql: respect PG_AUTOCONFIG env variable
Browse files Browse the repository at this point in the history
This allows configuring postgresql without further input from the input
(i.e., makes it scriptable).

Gentoo-Bug: https://bugs.gentoo.org/610418
  • Loading branch information
austin987 committed Apr 3, 2017
1 parent 7bb54c5 commit 3153234
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 55 deletions.
27 changes: 16 additions & 11 deletions dev-db/postgresql/postgresql-9.5.5.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
26 changes: 15 additions & 11 deletions dev-db/postgresql/postgresql-9.5.6.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
26 changes: 15 additions & 11 deletions dev-db/postgresql/postgresql-9.6.1-r1.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
26 changes: 15 additions & 11 deletions dev-db/postgresql/postgresql-9.6.2.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
26 changes: 15 additions & 11 deletions dev-db/postgresql/postgresql-9999.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 3153234

Please sign in to comment.