diff options
author | Tobias Scherbaum <dertobi123@gentoo.org> | 2009-10-17 17:52:02 +0000 |
---|---|---|
committer | Tobias Scherbaum <dertobi123@gentoo.org> | 2009-10-17 17:52:02 +0000 |
commit | 21d477d247dc28b8bf14062a369a67f8a4c1e19b (patch) | |
tree | 322d3a34008a97e832813690a09108a5926afd75 /mail-filter | |
parent | Version bump, #271435 (diff) | |
download | historical-21d477d247dc28b8bf14062a369a67f8a4c1e19b.tar.gz historical-21d477d247dc28b8bf14062a369a67f8a4c1e19b.tar.bz2 historical-21d477d247dc28b8bf14062a369a67f8a4c1e19b.zip |
Cleanup
Package-Manager: portage-2.2_rc46/cvs/Linux x86_64
Diffstat (limited to 'mail-filter')
-rw-r--r-- | mail-filter/sqlgrey/ChangeLog | 6 | ||||
-rw-r--r-- | mail-filter/sqlgrey/Manifest | 16 | ||||
-rw-r--r-- | mail-filter/sqlgrey/sqlgrey-1.6.7.ebuild | 249 | ||||
-rw-r--r-- | mail-filter/sqlgrey/sqlgrey-1.7.4.ebuild | 250 |
4 files changed, 6 insertions, 515 deletions
diff --git a/mail-filter/sqlgrey/ChangeLog b/mail-filter/sqlgrey/ChangeLog index a39714c49cb6..f0918cb1665e 100644 --- a/mail-filter/sqlgrey/ChangeLog +++ b/mail-filter/sqlgrey/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for mail-filter/sqlgrey # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/sqlgrey/ChangeLog,v 1.12 2009/09/20 21:46:11 maekke Exp $ +# $Header: /var/cvsroot/gentoo-x86/mail-filter/sqlgrey/ChangeLog,v 1.13 2009/10/17 17:52:02 dertobi123 Exp $ + + 17 Oct 2009; Tobias Scherbaum <dertobi123@gentoo.org> + -sqlgrey-1.6.7.ebuild, -sqlgrey-1.7.4.ebuild: + Cleanup 20 Sep 2009; Markus Meier <maekke@gentoo.org> sqlgrey-1.7.6.ebuild: amd64/x86 stable, bug #283386 diff --git a/mail-filter/sqlgrey/Manifest b/mail-filter/sqlgrey/Manifest index f2aaa37b021f..e5c0613c609d 100644 --- a/mail-filter/sqlgrey/Manifest +++ b/mail-filter/sqlgrey/Manifest @@ -1,19 +1,5 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - AUX sqlgrey-1.7.6-init.patch 412 RMD160 6f143dad5b0f68107028bc9f5537210369e79dc8 SHA1 3e4d268e3f93c0822cb1a8593db0fb79ab6ae1d8 SHA256 4b486f895628b128b3d9a853861f009097beb42cd1d3f059bca052bb2f8ceac6 -DIST sqlgrey-1.6.7.tar.bz2 42633 RMD160 6c857177886a5b3ffd982c43e4a6f36575427d27 SHA1 d293fa0ae3b9d9bcc28158a5fba30c85c7aed55c SHA256 f67b76799af93617f09a16bd7d5141b607d9952067fbb669f25bc3aa17bd7df5 -DIST sqlgrey-1.7.4.tar.bz2 56832 RMD160 d4b2e1d1321770ce8341b10d131b71118a003a18 SHA1 7c1031e51fa46b5e92119f2cc513b7f85d40d9fb SHA256 c5d2bb0632c9b9379538cc0bf77d0eae348d942f7199a4704b93c646f8c3c843 DIST sqlgrey-1.7.6.tar.bz2 63738 RMD160 1e9a46e42a8899f9426684ddbca01cfb5cc9b96a SHA1 ecf2d231b9f1e7ce6576ed95b87d939da7227d21 SHA256 48f6c855e18d3ac3d19a0c2ecd250394a355d0116acd631187b880cb813646d1 -EBUILD sqlgrey-1.6.7.ebuild 8647 RMD160 9d4f3ebb2d7d42c2ba81603aada12fc239688237 SHA1 97021d4835d28583a7b784cafbf6ef1d952b9f09 SHA256 2fa42adb0324d673d3636ab7b782a90daf217db16da46a086f8671b6889ee0ec -EBUILD sqlgrey-1.7.4.ebuild 8653 RMD160 878c19d908e067fb74feaf61bd172cfb389c6bde SHA1 995ddfd1a10136b25dedef3cb9c17e7aa9618b59 SHA256 c9e9d44164346c1c4752136a966b553d10583b0b82489ca5121654e3b34fe2f7 EBUILD sqlgrey-1.7.6.ebuild 8540 RMD160 032e5974699bff3e3daba9a36f12c0ec127cb0c4 SHA1 34189c118e34f4360fd796229e0f5b3732b62a82 SHA256 58791c009506c95b493c4c3d6ff811fec4c18140caf86b539ce305f79131d53f -MISC ChangeLog 2147 RMD160 c989494879660045324e2281faa7efac14e1d186 SHA1 6943096cda018000869d45fadf18090730c7ac24 SHA256 09bb8d7f269c8991fd21abbafbf3e23c4d8f74057f49dfbd5efc024c84d70d4f +MISC ChangeLog 2266 RMD160 3f14a977b45713ac7cc920f915905597e14fe0d6 SHA1 01f85e598f13e8e2d5a6cbdd12a91af2235f86e6 SHA256 477a33e0dadebb88ea596bc187625acf46e3008691fb8393b42da3506c63caab MISC metadata.xml 268 RMD160 b31bfd2e9b406e4ad0fbe849abe5591bccbb5f42 SHA1 ee1f79d2a8f5ad9046986b435ebe9849d40513e4 SHA256 7511d1483b3d7f112c2013cc1c8cc9aa46e38e1bb3ec1070d08407fd48726baf ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.11 (GNU/Linux) - -iEYEARECAAYFAkq2otAACgkQkKaRLQcq0GLscgCfVg5N2RU80vsiwLQKK1RN82kR -AL0AoJoDnrH4Ex5RUlJS8yUh13kbPkZv -=1+5c ------END PGP SIGNATURE----- diff --git a/mail-filter/sqlgrey/sqlgrey-1.6.7.ebuild b/mail-filter/sqlgrey/sqlgrey-1.6.7.ebuild deleted file mode 100644 index f38ec2e6c8f1..000000000000 --- a/mail-filter/sqlgrey/sqlgrey-1.6.7.ebuild +++ /dev/null @@ -1,249 +0,0 @@ -# Copyright 1999-2007 Gentoo Foundation# Distributed under the terms of the GNU General Public License v2 -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/sqlgrey/sqlgrey-1.6.7.ebuild,v 1.5 2007/02/15 11:30:39 dragonheart Exp $ - -inherit eutils - -DESCRIPTION="SQLgrey is a postfix policy service implementing a grey-listing policy" -SRC_URI="mirror://sourceforge/sqlgrey/${P}.tar.bz2" -HOMEPAGE="http://sqlgrey.sourceforge.net/" -LICENSE="GPL-2" -SLOT="0" -IUSE="mysql postgres sqlite" -RDEPEND="dev-lang/perl - dev-perl/DBI - dev-perl/net-server - dev-perl/Date-Calc - virtual/mailx - || ( postgres? ( dev-perl/DBD-Pg ) - sqlite? ( dev-perl/DBD-SQLite ) - mysql? ( dev-perl/DBD-mysql ) - dev-perl/DBD-Pg - )" -DEPEND="$RDEPEND - sys-apps/sed" -KEYWORDS="~x86 ~amd64" - -pkg_setup() { - has_version dev-perl/IO-Multiplex || die "IO-Multiplex needed. Please emerge it or run g-cpan.pl IO::Multiplex" - enewgroup sqlgrey - enewuser sqlgrey -1 -1 /var/spool/sqlgrey sqlgrey -} - -src_install () { - make gentoo-install ROOTDIR=${D} - dodoc HOWTO FAQ README README.OPTINOUT README.PERF COPYING TODO Changelog - - # keeps SQLgrey data in /var/spool/sqlgrey - diropts -m0775 -o sqlgrey -g sqlgrey - dodir /var/spool/sqlgrey -} - -pkg_postinst() { - echo - einfo "To make use of greylisting, please update your postfix config." - einfo - einfo "Put something like this in /etc/postfix/main.cf:" - einfo " smtpd_recipient_restrictions =" - einfo " ..." - einfo " check_policy_service inet:127.0.0.1:2501" - einfo - einfo "Remember to restart Postfix after that change. Also remember" - einfo "to make the daemon start durig boot:" - einfo " rc-update add sqlgrey default" - einfo - echo - einfo "To setup SQLgrey to run out-of-the-box on your system, run:" - einfo "emerge --config ${PN}" - echo - ewarn "Read the documentation for more info (perldoc sqlgrey) or the" - ewarn "included howto /usr/share/doc/${PF}/HOWTO.gz" - ewarn "If you are using MySQL >= 4.1 use \"latin1\" as charset for" - ewarn "the SQLgrey db" - echo - ebeep 2 - epause 5 -} - -pkg_config () { - - # SQLgrey configuration file - local SQLgrey_CONFIG="/etc/sqlgrey/sqlgrey.conf" - local SQLgrey_DB_USER_NAME="sqlgrey" - local SQLgrey_DB_NAME="sqlgrey" - - # Check if a password is set in sqlgrey.conf - local SQLgrey_CONF_PWD="" - if [ -f "${SQLgrey_CONFIG}" ]; then - if (grep -iq "^[\t ]*db_pass[\t ]*=[\t ]*.*$" ${SQLgrey_CONFIG}); then - # User already has a db_pass entry - SQLgrey_CONF_PWD="$(sed -n 's:^[\t ]*db_pass[\t ]*=[\t ]*\(.*\)[\t ]*:\1:gIp' ${SQLgrey_CONFIG})" - else - SQLgrey_CONF_PWD="" - fi - else - ewarn "SQLgrey configuration missing. Exiting now." - echo - exit 0 - fi - - # Check if we need SQLgrey to configure for this system or not - local SQLgrey_DB_HOST="localhost" - local SQLgrey_KEY_INPUT="l,r,x" - einfo "SQLgrey database backend configuration" - einfo " Please select where SQLgrey database will run:" - einfo " [l] Database backend runs on localhost" - einfo " [r] Database backend runs on remote host" - einfo " [x] Exit" - echo - einfo " Press one of the keys [${SQLgrey_KEY_INPUT}]: " - while true; do - read -n 1 -s SQLgrey_ACCESS_TYPE - case "${SQLgrey_ACCESS_TYPE}" in - "r" | "R" ) - SQLgrey_ACCESS_TYPE="r" - einfo " remote setup" - read -p " Please enter the remote hostname: " SQLgrey_DB_HOST - echo - break - ;; - "l" | "L" ) - SQLgrey_ACCESS_TYPE="l" - einfo " local setup" - echo - break - ;; - "x" | "X" ) - exit 0 - ;; - esac - done - - # Generate random password - if [[ "${SQLgrey_CONF_PWD}" == "" ]]; then - einfo "Generating random database user password..." - local SQLgrey_PWD_MATRIX="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - local SQLgrey_DB_USER_PWD="" - while [ "${n:=1}" -le "16" ]; do - SQLgrey_DB_USER_PWD="${SQLgrey_DB_USER_PWD}${SQLgrey_PWD_MATRIX:$(($RANDOM%${#SQLgrey_PWD_MATRIX})):1}" - let n+=1 - done - else - einfo "Reusing current database user password..." - local SQLgrey_DB_USER_PWD="${SQLgrey_CONF_PWD}" - fi - echo - - # Configure the various database backends - local SQLgrey_KEY_INPUT="" - einfo "Creating SQLgrey database backend data and configuration" - einfo " Please select what kind of database you like to use:" - if use postgres || has_version dev-perl/DBD-Pg ; then - einfo " [p] PostgreSQL" - SQLgrey_KEY_INPUT="${SQLgrey_KEY_INPUT},p" - fi - if use mysql || has_version dev-perl/DBD-mysql ; then - einfo " [m] MySQL" - SQLgrey_KEY_INPUT="${SQLgrey_KEY_INPUT},m" - fi - if use sqlite || has_version dev-perl/DBD-SQLite ; then - einfo " [s] SQLite" - SQLgrey_KEY_INPUT="${SQLgrey_KEY_INPUT},s" - fi - einfo " [x] Exit" - SQLgrey_KEY_INPUT="${SQLgrey_KEY_INPUT},x" - echo - einfo " Press one of the keys [${SQLgrey_KEY_INPUT:1}]: " - while true; do - read -n 1 -s SQLgrey_DB_TYPE - case "${SQLgrey_DB_TYPE}" in - "p" | "P" ) - SQLgrey_DB_TYPE="p" - einfo " PostgreSQL database backend" - echo - break - ;; - "m" | "M" ) - SQLgrey_DB_TYPE="m" - einfo " MySQL database backend" - echo - break - ;; - "s" | "S" ) - SQLgrey_DB_TYPE="s" - einfo " SQLite database backend" - echo - break - ;; - "x" | "X" ) - exit 0 - ;; - esac - done - - # If we don't use SQLite, the password must not be set - if [[ ( "${SQLgrey_DB_TYPE}" != "s" ) && ( "${SQLgrey_CONF_PWD}" != "" ) ]]; then - ewarn "This configuration is only for new installations. You seem to" - ewarn "have already a modified sqlgrey.conf" - ewarn "Do you want to continue?" - SQLgrey_KEY_INPUT="y,n" - einfo " Press one of the keys [$SQLgrey_KEY_INPUT]: " - while true; do - read -n 1 -s SQLgrey_Ignore - case "$SQLgrey_Ignore" in - "y"|"Y" ) - break - ;; - "n"|"N" ) - exit 0 - ;; - esac - done - fi - - ## Per-RDBMS configuration ## - # POSTGRESQL - if [[ "${SQLgrey_DB_TYPE}" == "p" ]] ; then - - ewarn "If prompted for a password, please enter your PgSQL postgres password" - ewarn "" - - einfo "Creating SQLgrey PostgreSQL database \"${SQLgrey_DB_NAME}\" and user \"${SQLgrey_DB_USER_NAME}\"" - /usr/bin/psql -h ${SQLgrey_DB_HOST} -d template1 -U postgres -c "CREATE USER ${SQLgrey_DB_USER_NAME} WITH PASSWORD '${SQLgrey_DB_USER_PWD}' NOCREATEDB NOCREATEUSER; CREATE DATABASE ${SQLgrey_DB_NAME}; GRANT ALL PRIVILEGES ON DATABASE ${SQLgrey_DB_NAME} TO ${SQLgrey_DB_USER_NAME}; GRANT ALL PRIVILEGES ON SCHEMA public TO ${SQLgrey_DB_USER_NAME}; UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='${SQLgrey_DB_USER_NAME}') WHERE datname='${SQLgrey_DB_NAME}';" - - einfo "Changing SQLgrey configuration in sqlgrey.conf" - sed -i "s:^[# ]*\(db_type[ \t]*= \).*:\1Pg:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_user[ \t]*= \).*:\1${SQLgrey_DB_USER_NAME}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_pass[ \t]*= \).*:\1${SQLgrey_DB_USER_PWD}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_host[ \t]*= \).*:\1${SQLgrey_DB_HOST}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_name[ \t]*= \).*:\1${SQLgrey_DB_NAME}:gI" ${SQLgrey_CONFIG} - elif [[ "${SQLgrey_DB_TYPE}" == "m" ]] ; then - # MYSQL - ewarn "If prompted for a password, please enter your MySQL root password" - ewarn "" - - einfo "Creating SQLgrey MySQL database \"${SQLgrey_DB_NAME}\" and user \"${SQLgrey_DB_USER_NAME}\"" - echo -ne " " - /usr/bin/mysql -u root -h ${SQLgrey_DB_HOST} -p -e "CREATE DATABASE IF NOT EXISTS ${SQLgrey_DB_NAME} CHARACTER SET latin1; GRANT ALL ON ${SQLgrey_DB_NAME}.* TO ${SQLgrey_DB_USER_NAME}@${SQLgrey_DB_HOST} IDENTIFIED BY '${SQLgrey_DB_USER_PWD}';FLUSH PRIVILEGES;" -D mysql - echo - - einfo "Changing SQLgrey configuration in sqlgrey.conf" - sed -i "s:^[# ]*\(db_type[ \t]*= \).*:\1mysql:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_user[ \t]*= \).*:\1${SQLgrey_DB_USER_NAME}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_pass[ \t]*= \).*:\1${SQLgrey_DB_USER_PWD}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_host[ \t]*= \).*:\1${SQLgrey_DB_HOST}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_name[ \t]*= \).*:\1${SQLgrey_DB_NAME}:gI" ${SQLgrey_CONFIG} - elif [[ "${SQLgrey_DB_TYPE}" == "s" ]] ; then - einfo "Changing SQLgrey configuration in sqlgrey.conf" - sed -i "s:^[# ]*\(db_type[ \t]*= \).*:\1SQLite:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_name[ \t]*= \).*:\1${SQLgrey_DB_NAME}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_user[ \t]*=.*\)$:# \1:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_pass[ \t]*= .*\)$:# \1:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_host[ \t]*= .*\)$:# \1:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_cleandelay[ \t]*= .*\)$:# \1:gI" ${SQLgrey_CONFIG} - fi - echo - if [[ "${SQLgrey_DB_TYPE}" != "s" ]]; then - einfo "Note: the database password is stored in $SQLgrey_CONFIG" - fi -} diff --git a/mail-filter/sqlgrey/sqlgrey-1.7.4.ebuild b/mail-filter/sqlgrey/sqlgrey-1.7.4.ebuild deleted file mode 100644 index eebde4acbab3..000000000000 --- a/mail-filter/sqlgrey/sqlgrey-1.7.4.ebuild +++ /dev/null @@ -1,250 +0,0 @@ -# Copyright 1999-2007 Gentoo Foundation# Distributed under the terms of the GNU General Public License v2 -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/sqlgrey/sqlgrey-1.7.4.ebuild,v 1.7 2007/02/15 11:30:39 dragonheart Exp $ - -inherit eutils - -DESCRIPTION="SQLgrey is a postfix policy service implementing a grey-listing policy" -SRC_URI="mirror://sourceforge/sqlgrey/${P}.tar.bz2" -HOMEPAGE="http://sqlgrey.sourceforge.net/" -LICENSE="GPL-2" -SLOT="0" -IUSE="mysql postgres sqlite" -RDEPEND="dev-lang/perl - dev-perl/DBI - dev-perl/net-server - dev-perl/Date-Calc - virtual/mailx - || ( postgres? ( dev-perl/DBD-Pg ) - sqlite? ( dev-perl/DBD-SQLite ) - mysql? ( dev-perl/DBD-mysql ) - dev-perl/DBD-Pg - )" -DEPEND="$RDEPEND - sys-apps/sed" -KEYWORDS="amd64 x86" - -pkg_setup() { - has_version dev-perl/IO-Multiplex || die "IO-Multiplex needed. Please emerge it or run g-cpan.pl IO::Multiplex" - enewgroup sqlgrey - enewuser sqlgrey -1 -1 /var/spool/sqlgrey sqlgrey -} - -src_install () { - make gentoo-install ROOTDIR="${D}" - dodoc HOWTO FAQ README README.OPTINOUT README.PERF COPYING TODO Changelog - - # keeps SQLgrey data in /var/spool/sqlgrey - diropts -m0775 -o sqlgrey -g sqlgrey - dodir /var/spool/sqlgrey -} - -pkg_postinst() { - echo - einfo "To make use of greylisting, please update your postfix config." - einfo - einfo "Put something like this in /etc/postfix/main.cf:" - einfo " smtpd_recipient_restrictions =" - einfo " ..." - einfo " check_policy_service inet:127.0.0.1:2501" - einfo - einfo "Remember to restart Postfix after that change. Also remember" - einfo "to make the daemon start durig boot:" - einfo " rc-update add sqlgrey default" - einfo - echo - einfo "To setup SQLgrey to run out-of-the-box on your system, run:" - einfo "emerge --config ${PN}" - echo - ewarn "Read the documentation for more info (perldoc sqlgrey) or the" - ewarn "included howto /usr/share/doc/${PF}/HOWTO.gz" - echo - ewarn "If you are using MySQL >= 4.1 use \"latin1\" as charset for" - ewarn "the SQLgrey db" - echo - ebeep 2 - epause 5 -} - -pkg_config () { - - # SQLgrey configuration file - local SQLgrey_CONFIG="/etc/sqlgrey/sqlgrey.conf" - local SQLgrey_DB_USER_NAME="sqlgrey" - local SQLgrey_DB_NAME="sqlgrey" - - # Check if a password is set in sqlgrey.conf - local SQLgrey_CONF_PWD="" - if [ -f "${SQLgrey_CONFIG}" ]; then - if (grep -iq "^[\t ]*db_pass[\t ]*=[\t ]*.*$" ${SQLgrey_CONFIG}); then - # User already has a db_pass entry - SQLgrey_CONF_PWD="$(sed -n 's:^[\t ]*db_pass[\t ]*=[\t ]*\(.*\)[\t ]*:\1:gIp' ${SQLgrey_CONFIG})" - else - SQLgrey_CONF_PWD="" - fi - else - ewarn "SQLgrey configuration missing. Exiting now." - echo - exit 0 - fi - - # Check if we need SQLgrey to configure for this system or not - local SQLgrey_DB_HOST="localhost" - local SQLgrey_KEY_INPUT="l,r,x" - einfo "SQLgrey database backend configuration" - einfo " Please select where SQLgrey database will run:" - einfo " [l] Database backend runs on localhost" - einfo " [r] Database backend runs on remote host" - einfo " [x] Exit" - echo - einfo " Press one of the keys [${SQLgrey_KEY_INPUT}]: " - while true; do - read -n 1 -s SQLgrey_ACCESS_TYPE - case "${SQLgrey_ACCESS_TYPE}" in - "r" | "R" ) - SQLgrey_ACCESS_TYPE="r" - einfo " remote setup" - read -p " Please enter the remote hostname: " SQLgrey_DB_HOST - echo - break - ;; - "l" | "L" ) - SQLgrey_ACCESS_TYPE="l" - einfo " local setup" - echo - break - ;; - "x" | "X" ) - exit 0 - ;; - esac - done - - # Generate random password - if [[ "${SQLgrey_CONF_PWD}" == "" ]]; then - einfo "Generating random database user password..." - local SQLgrey_PWD_MATRIX="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - local SQLgrey_DB_USER_PWD="" - while [ "${n:=1}" -le "16" ]; do - SQLgrey_DB_USER_PWD="${SQLgrey_DB_USER_PWD}${SQLgrey_PWD_MATRIX:$(($RANDOM%${#SQLgrey_PWD_MATRIX})):1}" - let n+=1 - done - else - einfo "Reusing current database user password..." - local SQLgrey_DB_USER_PWD="${SQLgrey_CONF_PWD}" - fi - echo - - # Configure the various database backends - local SQLgrey_KEY_INPUT="" - einfo "Creating SQLgrey database backend data and configuration" - einfo " Please select what kind of database you like to use:" - if use postgres || has_version dev-perl/DBD-Pg ; then - einfo " [p] PostgreSQL" - SQLgrey_KEY_INPUT="${SQLgrey_KEY_INPUT},p" - fi - if use mysql || has_version dev-perl/DBD-mysql ; then - einfo " [m] MySQL" - SQLgrey_KEY_INPUT="${SQLgrey_KEY_INPUT},m" - fi - if use sqlite || has_version dev-perl/DBD-SQLite ; then - einfo " [s] SQLite" - SQLgrey_KEY_INPUT="${SQLgrey_KEY_INPUT},s" - fi - einfo " [x] Exit" - SQLgrey_KEY_INPUT="${SQLgrey_KEY_INPUT},x" - echo - einfo " Press one of the keys [${SQLgrey_KEY_INPUT:1}]: " - while true; do - read -n 1 -s SQLgrey_DB_TYPE - case "${SQLgrey_DB_TYPE}" in - "p" | "P" ) - SQLgrey_DB_TYPE="p" - einfo " PostgreSQL database backend" - echo - break - ;; - "m" | "M" ) - SQLgrey_DB_TYPE="m" - einfo " MySQL database backend" - echo - break - ;; - "s" | "S" ) - SQLgrey_DB_TYPE="s" - einfo " SQLite database backend" - echo - break - ;; - "x" | "X" ) - exit 0 - ;; - esac - done - - # If we don't use SQLite, the password must not be set - if [[ ( "${SQLgrey_DB_TYPE}" != "s" ) && ( "${SQLgrey_CONF_PWD}" != "" ) ]]; then - ewarn "This configuration is only for new installations. You seem to" - ewarn "have already a modified sqlgrey.conf" - ewarn "Do you want to continue?" - SQLgrey_KEY_INPUT="y,n" - einfo " Press one of the keys [$SQLgrey_KEY_INPUT]: " - while true; do - read -n 1 -s SQLgrey_Ignore - case "$SQLgrey_Ignore" in - "y"|"Y" ) - break - ;; - "n"|"N" ) - exit 0 - ;; - esac - done - fi - - ## Per-RDBMS configuration ## - # POSTGRESQL - if [[ "${SQLgrey_DB_TYPE}" == "p" ]] ; then - - ewarn "If prompted for a password, please enter your PgSQL postgres password" - ewarn "" - - einfo "Creating SQLgrey PostgreSQL database \"${SQLgrey_DB_NAME}\" and user \"${SQLgrey_DB_USER_NAME}\"" - /usr/bin/psql -h ${SQLgrey_DB_HOST} -d template1 -U postgres -c "CREATE USER ${SQLgrey_DB_USER_NAME} WITH PASSWORD '${SQLgrey_DB_USER_PWD}' NOCREATEDB NOCREATEUSER; CREATE DATABASE ${SQLgrey_DB_NAME}; GRANT ALL PRIVILEGES ON DATABASE ${SQLgrey_DB_NAME} TO ${SQLgrey_DB_USER_NAME}; GRANT ALL PRIVILEGES ON SCHEMA public TO ${SQLgrey_DB_USER_NAME}; UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='${SQLgrey_DB_USER_NAME}') WHERE datname='${SQLgrey_DB_NAME}';" - - einfo "Changing SQLgrey configuration in sqlgrey.conf" - sed -i "s:^[# ]*\(db_type[ \t]*= \).*:\1Pg:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_user[ \t]*= \).*:\1${SQLgrey_DB_USER_NAME}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_pass[ \t]*= \).*:\1${SQLgrey_DB_USER_PWD}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_host[ \t]*= \).*:\1${SQLgrey_DB_HOST}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_name[ \t]*= \).*:\1${SQLgrey_DB_NAME}:gI" ${SQLgrey_CONFIG} - elif [[ "${SQLgrey_DB_TYPE}" == "m" ]] ; then - # MYSQL - ewarn "If prompted for a password, please enter your MySQL root password" - ewarn "" - - einfo "Creating SQLgrey MySQL database \"${SQLgrey_DB_NAME}\" and user \"${SQLgrey_DB_USER_NAME}\"" - echo -ne " " - /usr/bin/mysql -u root -h ${SQLgrey_DB_HOST} -p -e "CREATE DATABASE IF NOT EXISTS ${SQLgrey_DB_NAME} CHARACTER SET latin1; GRANT ALL ON ${SQLgrey_DB_NAME}.* TO ${SQLgrey_DB_USER_NAME}@${SQLgrey_DB_HOST} IDENTIFIED BY '${SQLgrey_DB_USER_PWD}';FLUSH PRIVILEGES;" -D mysql - echo - - einfo "Changing SQLgrey configuration in sqlgrey.conf" - sed -i "s:^[# ]*\(db_type[ \t]*= \).*:\1mysql:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_user[ \t]*= \).*:\1${SQLgrey_DB_USER_NAME}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_pass[ \t]*= \).*:\1${SQLgrey_DB_USER_PWD}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_host[ \t]*= \).*:\1${SQLgrey_DB_HOST}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_name[ \t]*= \).*:\1${SQLgrey_DB_NAME}:gI" ${SQLgrey_CONFIG} - elif [[ "${SQLgrey_DB_TYPE}" == "s" ]] ; then - einfo "Changing SQLgrey configuration in sqlgrey.conf" - sed -i "s:^[# ]*\(db_type[ \t]*= \).*:\1SQLite:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_name[ \t]*= \).*:\1${SQLgrey_DB_NAME}:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_user[ \t]*=.*\)$:# \1:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_pass[ \t]*= .*\)$:# \1:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_host[ \t]*= .*\)$:# \1:gI" ${SQLgrey_CONFIG} - sed -i "s:^[# ]*\(db_cleandelay[ \t]*= .*\)$:# \1:gI" ${SQLgrey_CONFIG} - fi - echo - if [[ "${SQLgrey_DB_TYPE}" != "s" ]]; then - einfo "Note: the database password is stored in $SQLgrey_CONFIG" - fi -} |