head 1.40; access; symbols Version_2_1:1.19 Version_2:1.10; locks; strict; comment @# @; 1.40 date 92.08.19.08.28.46; author mer; state Exp; branches; next 1.39; 1.39 date 92.08.18.00.21.36; author mer; state Exp; branches; next 1.38; 1.38 date 92.08.14.19.19.38; author mer; state Exp; branches; next 1.37; 1.37 date 92.08.14.16.50.07; author mer; state Exp; branches; next 1.36; 1.36 date 92.08.12.03.38.10; author mao; state Exp; branches; next 1.35; 1.35 date 92.06.23.18.21.55; author mer; state Exp; branches; next 1.34; 1.34 date 91.12.04.23.45.39; author mer; state Exp; branches; next 1.33; 1.33 date 91.11.19.23.17.47; author mer; state Exp; branches; next 1.32; 1.32 date 91.08.18.03.27.08; author kemnitz; state Exp; branches; next 1.31; 1.31 date 91.08.17.23.56.37; author kemnitz; state Exp; branches; next 1.30; 1.30 date 91.08.15.08.11.11; author kemnitz; state Exp; branches; next 1.29; 1.29 date 91.07.29.19.51.13; author kemnitz; state Exp; branches; next 1.28; 1.28 date 91.05.13.01.11.19; author kemnitz; state Exp; branches; next 1.27; 1.27 date 91.05.09.03.40.23; author kemnitz; state Exp; branches; next 1.26; 1.26 date 91.05.09.03.32.29; author kemnitz; state Exp; branches; next 1.25; 1.25 date 91.05.09.03.30.25; author kemnitz; state Exp; branches; next 1.24; 1.24 date 91.05.07.22.54.19; author mao; state Exp; branches; next 1.23; 1.23 date 91.05.07.22.26.09; author mao; state Exp; branches; next 1.22; 1.22 date 91.04.02.18.31.35; author kemnitz; state Exp; branches; next 1.21; 1.21 date 91.03.28.00.47.41; author kemnitz; state Exp; branches; next 1.20; 1.20 date 91.03.21.19.37.29; author kemnitz; state Exp; branches; next 1.19; 1.19 date 91.03.07.01.56.37; author kemnitz; state Exp; branches; next 1.18; 1.18 date 91.02.06.16.29.24; author kemnitz; state Exp; branches; next 1.17; 1.17 date 91.02.06.16.05.53; author kemnitz; state Exp; branches; next 1.16; 1.16 date 90.10.25.22.34.39; author kemnitz; state Exp; branches; next 1.15; 1.15 date 90.10.25.20.07.28; author kemnitz; state Exp; branches; next 1.14; 1.14 date 90.10.23.14.48.49; author kemnitz; state Exp; branches; next 1.13; 1.13 date 90.08.22.17.24.44; author kemnitz; state Exp; branches; next 1.12; 1.12 date 90.08.17.15.29.14; author kemnitz; state Exp; branches; next 1.11; 1.11 date 90.08.09.18.25.11; author kemnitz; state Exp; branches; next 1.10; 1.10 date 90.07.30.23.54.53; author postgres; state Version_2; branches; next 1.9; 1.9 date 90.07.23.18.09.00; author kemnitz; state Exp; branches; next 1.8; 1.8 date 90.07.20.13.41.27; author kemnitz; state Exp; branches; next 1.7; 1.7 date 90.07.13.17.42.19; author kemnitz; state Exp; branches; next 1.6; 1.6 date 90.07.13.17.23.10; author kemnitz; state Exp; branches; next 1.5; 1.5 date 90.07.12.18.51.34; author kemnitz; state Exp; branches; next 1.4; 1.4 date 90.03.02.20.30.23; author kemnitz; state Exp; branches; next 1.3; 1.3 date 90.03.02.19.57.35; author kemnitz; state Exp; branches; next 1.2; 1.2 date 90.03.02.19.26.34; author kemnitz; state Exp; branches; next 1.1; 1.1 date 90.02.08.16.12.02; author kemnitz; state Exp; branches; next ; desc @Installation script to be used under 'Make install'. @ 1.40 log @regression test installation gets a little trickier @ text @#!/bin/sh # expects arg1 to be the Postgres home directory # expects arg2 to be the basename of the Postgres Object directory # expects arg3 to be the port # expects arg4 to be the identifier for "SHIP" # expects arg5 to be the path to 'make' # # $Header: /private/mer/pg/newconf/RCS/install.sh,v 1.39 1992/08/18 00:21:36 mer Exp mer $ # # Now does an installation in $POSTGRESHOME/bin if $POSTGRESHOME is # defined # if (test -n "$POSTGRESHOME") then if (test -d "$POSTGRESHOME") then echo "Installing in $POSTGRESHOME" echo else echo "Error: $POSTGRESHOME does not exist." exit 1 fi DEST=$POSTGRESHOME else echo "Installing in $1" echo DEST=$1 fi TREE=$1 OBJ=$2 PORT=$3 SHIP=$4 MAKE=$5 EXEC_CHOWN=0 EXEC_INITDB=1 BINDIR=$DEST/bin FILEDIR=$DEST/files SUPODIR=$TREE/`basename $OBJ`/support SCRIPTDIR=$TREE/src/scripts if (test -f $BINDIR/pg_id) then PG_ID=$BINDIR/pg_id else PG_ID=$SUPODIR/pg_id fi if (test $SHIP = 1) then if (test ! -f $PG_ID) then echo "Executing 'Make pg_id'..." $TREE/newconf/Make pg_id if (test ! -f $PG_ID) then echo "Make pg_id failed - installation aborting." exit 1 fi fi # # Test to see if the user is trying to do the install as root. # If the user is, we'll have to chown postgres on all the bin, files, # and data directories, as well as $POSTGRESHOME itself. # # If there is no Postgres user (and this will break if there is no # /etc/passwd file), initdb can't be run until the installer fixes this # problem. # if (test "`$PG_ID`" = "0") then if (test "`grep '^postgres' /etc/passwd|sed 's/:.*//'`" = "postgres") then echo -n "Make install: NOTICE: will change ownership of files" echo " to user \"postgres\"" EXEC_CHOWN=1 else echo "Make install: WARNING: you are installing as root and" echo "there is as yet no Postgres user. Postgres will" echo "NOT WORK until you change ownership (see chown(2)) of" echo "all files under $TREE and $TREE itself to a registered" echo "Postgres user, preferably \"postgres\". The" echo "installation will continue, but the initial template" echo "database will not be created." echo EXEC_INITDB=0 fi fi if (test ! -f $TREE/newconf/everything.stat) then echo "Executing 'Make everything'..." $TREE/newconf/Make everything if (test $? -ne 0) then echo "Make everything failed." echo "installation aborting." exit 1 fi fi fi if (test ! -d $BINDIR) then echo "creating $BINDIR" mkdir $BINDIR fi SETUIDS="postgres postmaster" EXECUTABLES="$SETUIDS pg_version monitor pg_id pagedoc shmemdoc" for i in $EXECUTABLES do if (test -f $SUPODIR/$i) then echo "moving file $SUPODIR/$i" mv $SUPODIR/$i $BINDIR elif (test -f $BINDIR/$i) then true else echo "File $SUPODIR/$i does not exist." echo "Your build may have failed" echo "or have not been run yet." exit 1 fi done for i in $SETUIDS do chmod 4755 $BINDIR/$i done SCRIPTS="createdb createdb.sh destroydb initdb vacuum createuser destroyuser" for i in $SCRIPTS do if (test ! -f $BINDIR/$i) then echo "moving file $SCRIPTDIR/$i" cp $SCRIPTDIR/$i $BINDIR fi done if (test ! -f $BINDIR/ipcclean) then if (test -f $TREE/newconf/IPCCLEAN/ipcclean.$PORT) then cp $TREE/newconf/IPCCLEAN/ipcclean.$PORT $BINDIR/ipcclean echo "creating file $BINDIR/ipcclean" chmod 4755 $BINDIR/ipcclean else echo "File $TREE/newconf/IPCCLEAN/ipcclean.$PORT does not exist." fi fi if (test ! -d $FILEDIR) then echo "creating $FILEDIR" mkdir $FILEDIR fi # # Now create the bki files # if (test ! -f $FILEDIR/local1_template1.bki) then if (test ! -f $SUPODIR/local.bki) then echo "$SUPODIR/local.bki does not exist. You will need this file" echo "to run Postgres properly" exit 1 else echo "Moving $SUPODIR/local.bki to $FILEDIR/local1_template1.bki" mv $SUPODIR/local.bki $FILEDIR/local1_template1.bki fi fi if (test ! -f $FILEDIR/global1.bki) then if (test ! -f $SUPODIR/dbdb.bki) then echo "$SUPODIR/dbdb.bki does not exist. You will need this file" echo "to run Postgres properly" exit 1 else echo "Moving $SUPODIR/dbdb.bki to $FILEDIR/global1.bki" cat $SUPODIR/dbdb.bki | \ sed -e "s/PGUID/`$SUPODIR/pg_uid`/g" > $FILEDIR/global1.bki rm -f $SUPODIR/dbdb.bki fi fi echo "Compiling demo files..." cd $TREE/demo if (test ! -f makefile) then cat $TREE/newconf/config.mk ./makefile.source > makefile fi $MAKE < ./makefile if (test $? -ne 0) then echo "demo file compilation failed." echo "installation aborting." exit 1 fi echo "Compiling video demo files..." cd $TREE/video cp $TREE/demo/*.o $TREE/video if (test ! -f makefile) then cat $TREE/newconf/config.mk ./makefile.source > makefile fi $MAKE < ./makefile if (test $? -ne 0) then echo "video demo file compilation failed." echo "installation aborting." exit 1 fi if (test -d $TREE/test/regress) then echo Compiling regression test files... cd $TREE/test/regress if (test ! -f makefile) then cat $TREE/newconf/config.mk ./makefile.source > makefile chmod 444 makefile fi $MAKE < ./makefile cd funcs if (test ! -f makefile) then cat $TREE/newconf/config.mk ./makefile.source > makefile chmod 444 makefile fi $MAKE < ./makefile fi echo done cd $TREE if (test $EXEC_CHOWN -eq 1) then for i in $TREE $TREE/bin $TREE/files $TREE/bin/* $TREE/files/* \ $TREE/demo $TREE/demo/* do echo "executing chown to postgres on $i" chown postgres $i if (test $? -ne 0) then echo "chown to postgres failed." echo "Postgres will NOT work as installed." echo "installation aborting." exit 1 fi done fi if (test "$EXEC_INITDB" != 1) then echo "For reasons indicated above, initdb will NOT be executed. You will" echo "have to run it directly after making the above required changes." echo "Installation aborting." exit 1 fi echo echo "Initializing template database..." if (test ! -d data) then $TREE/bin/initdb if (test ?$ -ne 0) then echo "initialization of template database failed." echo "installation aborting." exit 1 fi fi echo if [ $DEVELOPMENT = "f" ] then echo "Cleaning up..." rm -f $OBJ/*.o fi echo "Installation complete." @ 1.39 log @make regression test generated makefile non-readable once created @ text @d8 1 a8 1 # $Header: /private/mer/pg/newconf/RCS/install.sh,v 1.38 1992/08/14 19:19:38 mer Exp mer $ d237 8 a244 1 cd $TREE/test/regress/funcs @ 1.38 log @fix up messages @ text @d8 1 a8 1 # $Header: /private/mer/pg/newconf/RCS/install.sh,v 1.37 1992/08/14 16:50:07 mer Exp mer $ d241 1 @ 1.37 log @add regression test stuff to installation (if regress directory exists) ./ @ text @d8 1 a8 1 # $Header: /private/mer/pg/newconf/RCS/install.sh,v 1.36 1992/08/12 03:38:10 mao Exp mer $ d218 1 a218 1 echo "Creating video demo objects..." a232 1 echo done d236 1 a236 1 echo compiling regression test objects d245 1 @ 1.36 log @add pagedoc, shmemdoc @ text @d8 1 a8 1 # $Header: /private/mao/postgres/newconf/RCS/install.sh,v 1.35 1992/06/23 18:21:55 mer Exp mao $ d229 1 a229 1 echo "demo file compilation failed." d234 11 @ 1.35 log @pass global1.bki through sed to replace the postgres user id appropriately @ text @d8 1 a8 1 # $Header: /private/mer/pg2/newconf/RCS/install.sh,v 1.34 1991/12/04 23:45:39 mer Exp mer $ d118 1 a118 1 EXECUTABLES="$SETUIDS pg_version monitor pg_id" @ 1.34 log @fix bug with deleting .o files too soon @ text @d8 1 a8 1 # $Header: /users/mer/postgres/newconf/RCS/install.sh,v 1.33 1991/11/19 23:17:47 mer Exp mer $ d197 3 a199 1 mv $SUPODIR/dbdb.bki $FILEDIR/global1.bki @ 1.33 log @bring the video demo into the golden age of automation @ text @d8 1 a8 1 # $Header$ d272 7 @ 1.32 log @fixed problem with "permission denied". @ text @d7 3 d218 1 d220 11 @ 1.31 log @copies scripts (rather than moving them) so that Make install will work after the bin directory has been blown away. @ text @d143 1 a143 1 if (test -f $SCRIPTDIR/$i) @ 1.30 log @copies demo .o's to video. @ text @d146 1 a146 1 mv $SCRIPTDIR/$i $BINDIR @ 1.29 log @fixed script problem. @ text @d213 5 @ 1.28 log @the program "backend" is now dead - hurray! @ text @a146 7 elif (test -f $BINDIR/$i) then true else echo "$SCRIPTDIR/$i does not exist." echo "Postgres may have not been installed properly." echo "or your build may have failed." @ 1.27 log @moved adduser/deluser to createuser/destroyuser @ text @d114 1 a114 1 SETUIDS="postgres backend postmaster" @ 1.26 log @created adduser and deluser @ text @d114 2 a115 1 EXECUTABLES="postgres postmaster pg_version backend monitor pg_id" d134 4 a137 1 chmod 4755 $BINDIR/postgres $BINDIR/postmaster $BINDIR/backend d139 1 a139 1 SCRIPTS="createdb createdb.sh destroydb initdb vacuum adduser deluser" @ 1.25 log @added "scripts" stuff @ text @d135 1 a135 1 SCRIPTS="createdb createdb.sh destroydb initdb vacuum" @ 1.24 log @don't need setuid shell scripts going out; only the programs that have to be are setuid now. @ text @d41 1 d90 1 a90 1 echo d114 1 a114 2 EXECUTABLES="postgres postmaster pg_version createdb destroydb backend \ monitor vacuum pg_id" d133 1 a133 2 chmod 4755 $BINDIR/postgres $BINDIR/postmaster $BINDIR/backend $BINDIR/pg_id \ $BINDIR/pg_version d135 17 a151 4 cp $TREE/src/support/createdb $BINDIR/createdb.sh chmod 4755 $BINDIR/createdb.sh cp $TREE/src/support/initdb $BINDIR/initdb chmod 4755 $BINDIR/initdb @ 1.23 log @get rid of vacuumd, vcontrol; install vacuum @ text @a121 1 chmod 4755 $BINDIR/$i d132 3 @ 1.22 log @If the installer is root or any user with userid 0, "Make install" will setuid the binaries to Postgres and change ownership on the directories to Postgres. In this way, people can do the complete installation as root. @ text @d114 1 a114 1 vacuumd monitor vcontrol pg_id" @ 1.21 log @Now checks for error codes from various steps in the installation. @ text @d35 2 d38 13 d53 41 a106 4 BINDIR=$DEST/bin FILEDIR=$DEST/files SUPODIR=$TREE/`basename $OBJ`/support d203 25 @ 1.20 log @Uses $MAKE rather than just the default make. @ text @d15 9 a23 9 if (test -d "$POSTGRESHOME") then echo "Installing in $POSTGRESHOME" echo else echo "Error: $POSTGRESHOME does not exist." exit 1 fi DEST=$POSTGRESHOME d25 3 a27 3 echo "Installing in $1" echo DEST=$1 d38 11 a48 5 if (test ! -f $TREE/newconf/everything.stat) then echo "Executing 'Make everything'..." $TREE/newconf/Make everything fi d57 2 a58 2 echo "creating $BINDIR" mkdir $BINDIR d62 1 a62 1 vacuumd monitor vcontrol pg_id" d66 14 a79 14 if (test -f $SUPODIR/$i) then echo "moving file $SUPODIR/$i" mv $SUPODIR/$i $BINDIR chmod 4755 $BINDIR/$i elif (test -f $BINDIR/$i) then true else echo "File $SUPODIR/$i does not exist." echo "Your build may have failed" echo "or have not been run yet." exit 1 fi d89 8 a96 8 if (test -f $TREE/newconf/IPCCLEAN/ipcclean.$PORT) then cp $TREE/newconf/IPCCLEAN/ipcclean.$PORT $BINDIR/ipcclean echo "creating file $BINDIR/ipcclean" chmod 4755 $BINDIR/ipcclean else echo "File $TREE/newconf/IPCCLEAN/ipcclean.$PORT does not exist." fi d101 2 a102 2 echo "creating $FILEDIR" mkdir $FILEDIR d111 9 a119 9 if (test ! -f $SUPODIR/local.bki) then echo "$SUPODIR/local.bki does not exist. You will need this file" echo "to run Postgres properly" exit 1 else echo "Moving $SUPODIR/local.bki to $FILEDIR/local1_template1.bki" mv $SUPODIR/local.bki $FILEDIR/local1_template1.bki fi d124 9 a132 9 if (test ! -f $SUPODIR/dbdb.bki) then echo "$SUPODIR/dbdb.bki does not exist. You will need this file" echo "to run Postgres properly" exit 1 else echo "Moving $SUPODIR/dbdb.bki to $FILEDIR/global1.bki" mv $SUPODIR/dbdb.bki $FILEDIR/global1.bki fi d135 1 a135 1 echo "Creating demo files..." d140 1 a140 1 cat $TREE/newconf/config.mk ./makefile.source > makefile d143 6 d157 7 a163 1 $TREE/bin/initdb @ 1.19 log @createdb is now a binary (again) - not a script. @ text @d4 3 d34 1 d136 1 a136 1 make -f ./makefile @ 1.18 log @Added more stuff for initdb to work right. @ text @a44 18 # # Move createdb out of the source directory so it won't be missed by the # below for loop. # if (test -f $SUPODIR/createdb) then rm -f $SUPODIR/createdb fi if (test -f $SUPODIR/initdb) then rm -f $SUPODIR/initdb fi cp $TREE/src/support/createdb $SUPODIR/createdb cp $TREE/src/support/initdb $SUPODIR/initdb d51 2 a52 2 EXECUTABLES="postgres postmaster createdb createdb2 initdb pg_version \ destroydb backend vacuumd monitor vcontrol pg_id" d71 5 @ 1.17 log @Added target for initdb and population of initial database. @ text @d55 5 d61 1 d148 3 @ 1.16 log @changed "rm" to "rm -f" so that annoying questions won't be asked on some platforms. @ text @d63 2 a64 2 EXECUTABLES="postgres postmaster createdb pg_version destroydb backend vacuumd \ monitor vcontrol pg_id" d140 7 @ 1.15 log @New stuff added for making demo @ text @d52 1 a52 1 rm $SUPODIR/createdb @ 1.14 log @Added target for pg_id @ text @d135 4 @ 1.13 log @Changed around handling of createdb - fixed pg_version stuff. @ text @d50 5 d64 1 a64 1 monitor vcontrol" @ 1.12 log @Added vcontrol.c @ text @d45 7 d58 1 a58 1 EXECUTABLES="postgres postmaster createdb destroydb backend vacuumd \ @ 1.11 log @Now, "Make install" does everything @ text @d52 1 a52 1 monitor" @ 1.10 log @Changed chdir to cd. @ text @d30 10 @ 1.9 log @Added stuff to support installation of ipcclean @ text @d112 1 a112 1 chdir $TREE/demo @ 1.8 log @It now does an installation in $POSTGRESHOME/bin if it is defined, $TREE/bin otherwise. @ text @d29 2 d42 1 a42 1 monitor ipcclean" a53 3 elif (test "$i" = ipcclean) then true d61 12 @ 1.7 log @Uses new .bki files @ text @d5 22 d29 2 a30 2 BINDIR=$TREE/bin FILEDIR=$TREE/files d54 1 a54 5 echo "$BINDIR/ipcclean does not exist. This file is relatively" echo "unimportant and Postgres can run without it. However, if" echo "Postgres crashes, you will need to run ipcrm directly" echo "rather than using ipcclean to clean up shared memory and" echo "semaphores left behind. Installation continuing..." @ 1.6 log @it does a make in the demo directory to use jeff's new pathname stuff. @ text @d9 1 a9 1 SUPDIR=$TREE/src/support d22 1 a22 1 if (test -f $OBJ/support/$i) d24 2 a25 2 echo "moving file $OBJ/support/$i" mv $OBJ/support/$i $BINDIR d38 1 a38 1 echo "File $OBJ/support/$i does not exist." d57 1 a57 1 if (test ! -f $SUPDIR/local.bki) d59 1 a59 1 echo "$SUPDIR/local.bki does not exist. You will need this file" d63 2 a64 2 echo "Moving $SUPDIR/local.bki to $FILEDIR/local1_template1.bki" mv $SUPDIR/local.bki $FILEDIR/local1_template1.bki d70 1 a70 1 if (test ! -f $SUPDIR/dbdb.bki) d72 1 a72 1 echo "$SUPDIR/dbdb.bki does not exist. You will need this file" d76 2 a77 2 echo "Moving $SUPDIR/dbdb.bki to $FILEDIR/global1.bki" mv $SUPDIR/dbdb.bki $FILEDIR/global1.bki @ 1.5 log @Fixed pathname problem. @ text @d81 5 @ 1.4 log @Fixed a couple of problems with install.sh @ text @d6 1 a6 1 OBJ=$TREE/$2 @ 1.3 log @Fixed tiny problem with install.sh @ text @d22 1 a22 1 if (test -f $BINDIR/$i) d24 1 a24 1 echo "moving file $BINDIR/$i" d27 3 d38 1 a38 1 echo "File $BINDIR/$i does not exist." @ 1.2 log @Added lots of error checking and user friendliness. @ text @d35 2 a36 1 echo "File $BINDIR/$i does not exist. Your build may have failed" @ 1.1 log @Initial revision @ text @d8 2 d11 5 a15 1 EXECUTABLES="postgres postmaster createdb destroydb backend vacuumd monitor" d17 3 d22 17 a38 3 echo "creating file $BINDIR/$i" mv $OBJ/support/$i $BINDIR chmod 4755 $BINDIR/$i d41 5 a45 1 chmod 4755 $BINDIR/ipcclean d47 31 a77 3 mkdir $TREE/files mv $TREE/src/support/local.bki $TREE/files/local1_template1.bki mv $TREE/src/support/dbdb.bki $TREE/files/global1.bki @