commit 294153072816053cacfceca7d94142dd476a97d4 Author: kueller Date: Sat May 3 16:59:08 2008 +0000 V961 Tree Umbau git-svn-id: svn://svn.compuextreme.de/Viitor/V961/Viitor_postgresql@4305 504e572c-2e33-0410-9681-be2bf7408885 diff --git a/etc/init.d/postgresql b/etc/init.d/postgresql new file mode 100644 index 0000000..e9f29ff --- /dev/null +++ b/etc/init.d/postgresql @@ -0,0 +1,53 @@ +#!/bin/sh +# des systemvinit prozesses +#Script Framework - Automatisiertes Erzeugen der Monsum Linux Distribution +#(c) Rainmaker MultiMedia OHG +# +#$Author$ +#$Date$ +#$Revision$ +# +#$Log$ +#Revision 1.6 2003/04/19 07:49:53 kueller +#Nicht ufnktionierende Optionene status und reload entfernt +# +#Revision 1.5 2001/11/03 20:37:46 segler +# +#Variable PGNET (Option -i bzw. nix) in /etc/sysconfig/profile.d/PostgreSQL eingefuehrt. Wenn auskommentiert passiert nix, wenn nicht horcht postgres auf Netzverbindungen auf Port 5432 +# +#Revision 1.3 2001/10/10 19:28:37 kueller +#Fehler korrekturen: +#source /etc/sysconfig/profile.d/postgresql ->falsch geschrieben - PostgreSQL +#loadproc muß postmaster bei verwendung von su mit absolutem Pfad starten +# +#Revision 1.2 2001/10/08 08:35:35 kueller +#cvs header korrigiert +# +# + +source /etc/init.d/functions +source /etc/sysconfig/profile.d/PostgreSQL + +case "$1" in + start) + echo -n "Starting PostgreSQL" + su - postgres -c "/opt/PostgreSQL/bin/postmaster $PGNET -D $PGDATA &" + ;; + + stop) + echo -n "Stopping PostgreSQL" + killproc postmaster + ;; + + restart) + $0 stop + /usr/bin/sleep 1 + $0 start + ;; + + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; + +esac diff --git a/etc/sysconfig/profile.d/PostgreSQL b/etc/sysconfig/profile.d/PostgreSQL new file mode 100644 index 0000000..f948a4f --- /dev/null +++ b/etc/sysconfig/profile.d/PostgreSQL @@ -0,0 +1,34 @@ +#!/bin/bash +#Automatische Generierung von glibc +#Script Framework - Automatisiertes Erzeugen der Monsum Linux Distribution +#(c) Rainmaker MultiMedia OHG +# +#$Author$ +#$Date$ +#$Revision$ +# +#$Log$ +#Revision 1.4 2006/10/25 12:09:56 kueller +#Anpassung an 32/64 Bit Viitor +# +#Revision 1.3 2001/11/03 20:38:42 segler +# +#Variable PGNET fuer Netzwerkfaehigkeit des postmasters eingefuehrt. (siehe /etc/init.d/postgresql +# +#Revision 1.2 2001/10/08 08:36:04 kueller +#cvs header hinzugefügt +# +# + +PGHOME=/opt/PostgreSQL +PGBIN=/opt/PostgreSQL/bin +if [ -d /opt/PostgreSQL/lib64 ]; then + PGLIB=/opt/PostgreSQL/lib64 +else + PGLIB=/opt/PostgreSQL/lib +fi +PGDATA=/opt/PostgreSQL/data +PGMANPATH=/opt/PostgreSQL/man +PATH=$PATH:/opt/PostgreSQL/bin +#PGNET="-i" +export PGHOME PGBIN PGLIB PGDATA PGMANPATH PATH PGNET diff --git a/init/genpkg b/init/genpkg new file mode 100644 index 0000000..638e21d --- /dev/null +++ b/init/genpkg @@ -0,0 +1,45 @@ +#!/bin/bash +#Automatische Generierung von glibc +#Script Framework - Automatisiertes Erzeugen der Monsum Linux Distribution +#(c) Rainmaker MultiMedia OHG +# +#$Author$ +#$Date$ +#$Revision$ +# +#$Log$ +#Revision 1.4 2001/10/17 10:11:18 kueller +#Rechtekorrektur für init script +# +#Revision 1.3 2001/10/10 19:26:37 kueller +#Korrektur beim Anlegen der start/stop Links in den Runleveln +#Es darf nicht lS25postgresql heissen..:-)) +#und: +#Runlevel 2 - Start der minimal Notwendigen Dienste +#Runlevel 3 - Start in den kompletten Servermodus +#Runlevel 4 - Erweiterter Modus (z.B. Grafische Oberfläche) +#Runlevel 5 - noch nicht definiert +# +#-> Daher muss postgresql eindeutig ab RunLevel 3 gestartet werden +# +#Revision 1.2 2001/10/08 08:36:37 kueller +#cvs header hinzugefügt +# +# + +WDIR=`pwd` +cd etc/init.d +chmod 755 postgresql +mkdir rc{0,1,2,3,4,5,6}.d +for i in 0 1 2 6; do + cd rc$i.d + ln -s ../postgresql K25postgresql + cd .. +done +for i in 3 4 5; do + cd rc$i.d + ln -s ../postgresql S25postgresql + cd .. +done +cd $WDIR + ~ diff --git a/tmp/postinstall b/tmp/postinstall new file mode 100644 index 0000000..edc82e0 --- /dev/null +++ b/tmp/postinstall @@ -0,0 +1,126 @@ +#!/bin/bash +#Framework, welches ein komplettes Linux System aus den Sourcen erstellt +#dieses Framework wird im CVS Repository +#:pserver:cvs.rainmaker-mm.de/RMM/cvs zur Verfügung gestellt +# +#Lage dieser Datei im Archiv: $Source$ +# +#(c) Rainmaker MultiMedia OHG +#This program is free software; you can redistribute it and/or +#modify ist under the terms of the GNU General Public License +#as published by the Free Software Foundation; either version +#2 of the License, or (at your option) any later version. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +#See the GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +#along with this program; if not write to the Free Software Foundation, +#Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +#Beschreibung: +#Postinstall Script für postgresql +# +#Aufrufparameter: +#keine +# +#Letzte Änderung von: $Author$ +#Datum der letzten Änderung: $Date$ +#Version der Datei: $Revision$ +# +#$Log$ +#Revision 1.12 2007/04/29 12:15:20 kueller +#postgres erhaelt jetzt fest die uid 49 +# +#Revision 1.11 2006/10/25 12:08:49 kueller +#Anpassung an 32/64 Bit Viitor +# +#Revision 1.10 2002/10/09 07:59:51 kueller +#Anpassungen an neuen chroot Modus von installpkg. Parameter $1 nicht mehr +#notwendig, da chroot auf $1 ausgeführt wird. Script entsprechend Angepasst. +#Ausserdem anpassung des Headers an neue GPLizes Standart Header. +# +# +#Revision 1.9 2001/12/11 11:58:17 kueller +#Korrektur kleinerer Fehler. Segmention fault nachwievor bei installation. +#/tmp/inidb.$$ kann nicht gelesen werden (rechte) - fuehrt dazu, dass +#initdb nach dem vacuuming der Datenbank mit einem segmention fault abbricht. +#Kann durch Loeschen des Datenbank Verzeichnisses (nur den Inhalt!), sowie einem +#neuerlichen lauf von initdb (unter user postgres) behoben werden - funktioniert +#bei haendischem aufruf! +# +#Revision 1.8 2001/12/11 11:33:59 kueller +#sed aufruf korrigiert (unterminated s command) +# +#Revision 1.7 2001/12/11 11:20:46 kueller +#Rechte von /opt/PostgreSQL werden nun korrigiert. Setzen von defaultpath fuer +#die Datenbanken korrigiert. +# +#Revision 1.6 2001/11/03 21:52:26 segler +# +#initdb haette den postmaster gerne am laufen. Daher tuen wir ihm den Gefallen und starten /etc/init.d/postgresql start, das zu diesem Zeitpunkt anwesend sein sollte. Dafuer legt initdb /data mit entsprechenden Rechten selber an. +# +#Revision 1.5 2001/10/10 19:40:55 kueller +#Diverse Korrekturen - +#Doppelte Read Abfrage für DATADIR wenn nicht default entfernt +#$1 wird nun ausgewertet und als alternativer installpath +#verwendet (unattendet Installation) +# +#Revision 1.4 2001/10/08 08:34:51 kueller +#cvs header hinzugefügt +# +# + +LIBINST=`grep "/opt/PostgreSQL/lib" /etc/ld.so.conf` +if [ ! "$LIBINST" ]; then + echo "/opt/PostgreSQL/lib" >>/etc/ld.so.conf + if [ -d /opt/PostgreSQL/lib64 ]; then + echo "/opt/PostgreSQL/lib64" >>/etc/ld.so.conf + fi +fi +if ! getent passwd postgres; then + useradd -u 49 -g daemon -d /opt/PostgreSQL -s /bin/bash postgres +fi +chown -R postgres:daemon /opt/PostgreSQL +if [ ! -f /tmp/NOQUEST ]; then + echo "Where would you install the Databases ? [/opt/PostgreSQL/data] " + read +fi +if [ "$REPLY" ]; then + DATADIR=$REPLY +else + DATADIR=/opt/PostgreSQL/data +fi +if [ $DATADIR ] && [ ! -f /tmp/NOQUEST ]; then + if [ ! -d $DATADIR ]; then + echo "The directory $DATADIR dont exist!" + echo "Should i create it for you ? [Y/n] " + read + if [ "$REPLY" != "y" ]; then + echo "Exiting. You have to build the Database manualy" + echo "-> initdb -D /PATH_TO_DATADIR" + echo "-> edit /etc/sysconfig/PostgreSQL" + echo "-> /etc/init.d/postgresql start - to launch the server" + else + sed -e "s%PGDATA=/opt/PostgreSQL/data%PGDATA=$DATADIR%" /etc/sysconfig/profile.d/PostgreSQL > /tmp/PostgreSQL.tmp + mv /tmp/PostgreSQL.tmp /etc/sysconfig/profile.d/PostgreSQL + source /tmp/PostgreSQL.tmp + rm /tmp/PostgreSQL.tmp + mkdir -p /$DATADIR + chown postgres /$DATADIR + su - postgres -c "/opt/PostgreSQL/bin/initdb -D /$DATADIR" + fi + else + echo "Exiting. $DATADIR still exists !" + exit + fi +else + echo "Creating initial database in : /opt/PostgreSQL/data" + source /etc/sysconfig/profile.d/PostgreSQL + mkdir -p /opt/PostgreSQL/data + chown postgres:daemon /opt/PostgreSQL/data + /etc/init.d/postgresql start + su - postgres -c "/opt/PostgreSQL/bin/initdb -D /opt/PostgreSQL/data" +fi