1616# initialization
1717./bin/postgresql-setup --init
1818
19+ # Create unix_socket directory
20+ mkdir -p /var/run/postgresql
21+ chown postgres:postgres /var/run/postgresql
22+ chmod 2775 /var/run/postgresql
23+
1924# start postgresql and check if it's running
2025PGDATA=/var/lib/pgsql/data
2126LOGFILE=/var/lib/pgsql/logfile
2227su - postgres -c "
23- /usr/bin/pg_ctl -D $PGDATA -l $LOGFILE -o \" -c unix_socket_directories=/tmp \" start
28+ /usr/bin/pg_ctl -D $PGDATA -l $LOGFILE start
2429/usr/bin/pg_ctl -D $PGDATA status && echo \" PostgreSQL is running\" || { echo \" PostgreSQL is NOT running\" ; exit 1; }
2530"
2631
2732# insert data
2833su - postgres -c "
2934echo \" User switched\" ;
3035
31- createdb -h /tmp testdb;
32- psql -h /tmp - U postgres -d testdb -c \" create table users (id serial primary key, name text)\" ;
33- psql -h /tmp - U postgres -d testdb -c \" insert into users (name) values ('Alice'), ('Bob'), ('Celine')\"
36+ createdb testdb;
37+ psql -U postgres -d testdb -c \" create table users (id serial primary key, name text)\" ;
38+ psql -U postgres -d testdb -c \" insert into users (name) values ('Alice'), ('Bob'), ('Celine')\"
3439"
3540su - postgres -c '
36- psql -h /tmp - U postgres -d testdb -c "select * from users"
41+ psql -U postgres -d testdb -c "select * from users"
3742' > expected.txt
3843
3944echo " Expected:"
@@ -51,12 +56,12 @@ dnf -y install postgresql17-upgrade
5156./bin/postgresql-setup --upgrade
5257
5358su - postgres -c "
54- /usr/bin/pg_ctl -D $PGDATA -l $LOGFILE -o \" -c unix_socket_directories=/tmp \" start
59+ /usr/bin/pg_ctl -D $PGDATA -l $LOGFILE -o start
5560/usr/bin/pg_ctl -D $PGDATA status && echo \" PostgreSQL is running\" || { echo \" PostgreSQL is NOT running\" ; exit 1; }
5661"
5762
5863su - postgres -c '
59- psql -h /tmp - U postgres -d testdb -c "select * from users"
64+ psql -U postgres -d testdb -c "select * from users"
6065' > actual.txt
6166
6267echo " Actual:"
0 commit comments