Ken Moffat wrote: > I've now got the postgresql testsuite working for a normal user, > using the attached patch (based on gentoo, but simplified - they > make one other change, which seems unnecessary, and use @SOCKETDIR@ > then sed that to /tmp after applying the patch. > > Bruce managed to get the tests working after su'ing to user > postgres, but that doesn't work for me (details in the ticket). > > This is all because we now move the socket (and lock file) from > /tmp to /run/postgresql. We do that with a sed, but using sed on > the first of the test files is likely to be error prone (a lot of > other SYSTEMQUOTE lines don't get changed), so I'm inclined to > patch. Which begs the question - should I convert the sed to a patch > and include it all together, as e.g. -use_run- or leave this patch > separate ?
I don't think the patch is necessary. There are several places in the section already that use su - postgres -c 'command'. this is what I suggest: As the root user: groupadd -g 41 postgres && useradd -c "PostgreSQL Server" -g postgres -d /srv/pgsql/data \ -u 41 postgres && install -v -dm700 /srv/pgsql/data && install -v -dm755 /run/postgresql && chown -Rv postgres:postgres /srv/pgsql /run/postgresql Now proceed as a normal user (note different sed): sed -i -e '/DEFAULT_PGSOCKET_DIR/s@tmp@run/postgresql@' \ src/include/pg_config_manual.h && ./configure --prefix=/usr \ --enable-thread-safety \ --docdir=/usr/share/doc/postgresql-9.2.4 && make To test the results, as the root user: su postgres -c 'make check' Now install as the root user: make install && make install-docs Initialize a database cluster with the following command issued by the root user: su - postgres -c '/usr/bin/initdb -D /srv/pgsql/data' Again as the root user, start the database server with the following command: su - postgres -c '/usr/bin/postmaster -D /srv/pgsql/data > \ /srv/pgsql/data/logfile 2>&1 &' Still as user root, create a database and verify the installation: su - postgres -c '/usr/bin/createdb test' && echo "create table t1 ( name varchar(20), location varchar(20) );" | (su - postgres -c '/usr/bin/psql test ') && echo "insert into t1 values ('Billy', 'NewYork');" | (su - postgres -c '/usr/bin/psql test ') && echo "insert into t1 values ('Evanidus', 'Quebec');" | (su - postgres -c '/usr/bin/psql test ') && echo "insert into t1 values ('Jesse', 'Ontario');" | (su - postgres -c '/usr/bin/psql test ') && echo "select * from t1;" | (su - postgres -c '/usr/bin/psql test') We probably need a command to shut down the db server at this point. Possibly su - postgres -c '/usr/bin/dropdb test' && killall postmaster I see that postmaster is deprecated in favor of postgres. Note that the pipe (|) does not require escaping a new line if its last on the line. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page