From 55f6b6c23bfb3d39adaf64dd55e610599a7d2731 Mon Sep 17 00:00:00 2001 From: Michael van Elst Date: Tue, 4 Mar 2003 16:25:46 +0000 Subject: [PATCH] added rudimentary setup script --- powerdns/powerdns.spec | 29 +++++--- powerdns/powerdnssetup | 154 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 175 insertions(+), 8 deletions(-) create mode 100755 powerdns/powerdnssetup diff --git a/powerdns/powerdns.spec b/powerdns/powerdns.spec index 73a3b5c5d2..e1e5ab23d3 100644 --- a/powerdns/powerdns.spec +++ b/powerdns/powerdns.spec @@ -35,7 +35,7 @@ Distribution: OpenPKG [JUNK] Group: unknown License: GPL Version: 2.9.6 -Release: 20030228 +Release: 20030304 # list of sources Source0: http://downloads.powerdns.com/releases/pdns-%{version}.tar.gz @@ -43,6 +43,7 @@ Source1: rc.powerdns Source2: fsl.powerdns # package options +%option with_fsl yes %option with_pipe no %option with_mysql no %option with_pgsql no @@ -71,21 +72,15 @@ AutoReqProv: no The PowerDNS name server is a modern, advanced and high performance authoritative-only nameserver. It is written from scratch and conforms to all the relevant DNS standards documents. - The PowerDNS name server utilizes a flexible backend architecture which can access DNS information from any data source. This includes file formats, Bind zone files, relational databases or LDAP directories. - By connecting directly to a database, no 'reloading' is needed. Changes committed to the database are effective immediately. - If you have specific needs for your DNS infrastructure then you can use the Backend Developers Kit to write the 'glue' between PowerDNS and your data or logic. - Since version 2.9, PowerDNS is licensed under GNU General Public License - version 2. - %prep %setup -q -n pdns-%{version} @@ -101,12 +96,19 @@ AutoReqProv: no MODULES="$MODULES gpgsql" %endif MODULES=`echo "$MODULES" | sed 's;^ ;;'` + lf="%{l_ldflags}" + li="" +%if "%{with_fsl}" == "yes" + lf="$lf `%{l_prefix}/bin/fsl-config --all --ldflags --libs`" + li="$li `%{l_prefix}/bin/fsl-config --all --libs`" +%endif CC="%{l_cc}" \ CXX="%{l_cxx}" \ CFLAGS="%{l_cflags -O}" \ CXXFLAGS="%{l_cxxflags -O} -DDLLIMPORT=" \ CPPFLAGS="%{l_cppflags} -DDLLIMPORT=" \ - LDFLAGS="%{l_ldflags}" \ + LDFLAGS="$lf" \ + LIBS="$li" \ ./configure \ --prefix=%{l_prefix} \ --sysconfdir=%{l_prefix}/etc/powerdns \ @@ -142,6 +144,9 @@ AutoReqProv: no # Setup config file mv $RPM_BUILD_ROOT%{l_prefix}/etc/powerdns/pdns.conf-dist \ $RPM_BUILD_ROOT%{l_prefix}/etc/powerdns/pdns.conf + %{l_shtool} subst \ + -e 's;@l_prefix@;%{l_prefix};g' \ + $RPM_BUILD_ROOT%{l_prefix}/etc/powerdns/pdns.conf # Creating run-command script %{l_shtool} mkdir -f -p -m 755 \ @@ -151,6 +156,14 @@ AutoReqProv: no -e 's;@l_musr@;%{l_musr};g' -e 's;@l_mgrp@;%{l_mgrp};g' \ %{SOURCE rc.powerdns} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ +%if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" + # Install setup script + %{l_shtool} mkdir -p -m 755 \ + powerdnssetup} $RPM_BUILD_ROOT%{l_prefix}/sbin + %{l_shtool} install -c -m 755 \ + %{SOURCE powerdnssetup} $RPM_BUILD_ROOT%{l_prefix}/sbin/ +%endif + # Creating fsl directory %{l_shtool} mkdir -f -p -m 755 \ $RPM_BUILD_ROOT%{l_prefix}/etc/fsl diff --git a/powerdns/powerdnssetup b/powerdns/powerdnssetup new file mode 100755 index 0000000000..bbae27c0bf --- /dev/null +++ b/powerdns/powerdnssetup @@ -0,0 +1,154 @@ +#!/bin/sh + +case "$1" in +gmysql) + dbtype=MySQL + ;; +gpgsql) + dbtype=PostgreSQL + ;; +*) + echo "usage: $0 [ gmysql | gpgsql ]" + exit 1 + ;; +esac + +while [ ".$db" = . ]; do +echo "Please enter the name of the database to be created:" +read db +done + +while [ ".$root" = . ]; do +echo "Please enter the name of the database administrator account:" +read root +done + +while [ ".$pdnsadm" = . ]; do +echo "Please enter the name of the DNS administrator account:" +read pdnsadm +done + +while [ ".$pdns" = . ]; do +echo "Please enter the name of the DNS user account:" +read pdns +done + +echo "" +echo "The $dbtype database '$db' will be created by '$root'." +echo "Access is granted to the DNS administrator '$pdnsadm'" +echo "and the DNS user '$pdns'." +echo "" + +case "$1" in +gmysql) + echo "Please log in as the $dbtype database administrator ($root)" + mysql -u$root -p mysql <