aboutsummaryrefslogtreecommitdiff
path: root/getmepostgres.sh
diff options
context:
space:
mode:
authorTom Harley2018-02-22 18:32:15 +0000
committerTom Harley2018-02-22 18:32:15 +0000
commit59c4e0f06b2bfb41c17111017823daa15900f94a (patch)
tree725ccb6573c5b0a1f640a43aa65eaf40a8fa0d45 /getmepostgres.sh
parentMerge branch 'trh/error-middleware' into 'trh/payload-checker' (diff)
parentMerge branch 'trh/editorconfig' into 'master' (diff)
downloadmedicine-59c4e0f06b2bfb41c17111017823daa15900f94a.tar.gz
medicine-59c4e0f06b2bfb41c17111017823daa15900f94a.zip

Merge branch ‘master’ into trh/payload-checker

Diffstat (limited to 'getmepostgres.sh')
-rwxr-xr-xgetmepostgres.sh59
1 files changed, 29 insertions, 30 deletions
diff --git a/getmepostgres.sh b/getmepostgres.sh
index 035b300..50976f8 100755
--- a/getmepostgres.sh
+++ b/getmepostgres.sh
@@ -1,27 +1,26 @@
#!/bin/bash
-PGDIR=${1-"$HOME/pg"}
-
-echo "> Checking for postgres at $PGDIR";
-if [ -d "$PGDIR" ]; then
+echo "> Checking for postgres at ~/pg";
+if [ -d "~/pg" ]; then
echo "Postgres Directory exists, nevermind...";
exit 1;
fi
-echo;
-echo;
-echo;
+echo " ";
+echo " ";
+echo " ";
echo "This installation process takes ~3:50 minutes to complete.";
-echo;
-echo;
-echo;
+echo " ";
+echo " ";
+echo " ";
+sleep 3;
-echo "> Making postgres directory at $PGDIR";
-mkdir -p "$PGDIR";
+echo "> Making postgres directory at ~/pg";
+mkdir ~/pg;
currentDir=$(pwd);
-echo "> Changing dir to $PGDIR";
-cd "$PGDIR";
+echo "> Chaning dir to ~/pg";
+cd ~/pg;
echo "> Cloning Repo";
git clone https://github.com/postgres/postgres.git;
@@ -31,34 +30,34 @@ cd ./postgres;
git reset --hard REL_10_1;
echo "> Configuring";
-./configure --prefix="$PWD" --with-python PYTHON="/usr/bin/python2.7";
+./configure --prefix=$HOME/pg/postgres/ --with-python PYTHON=/usr/bin/python2.7;
echo "> Building Postgres";
-make;
+make -j 5;
echo "> Installing Postgres";
make install;
echo "> Initialise the Database";
-"$PGDIR/postgres/bin/initdb" -D "$PGDIR/postgres/data/";
-echo;
-echo;
-echo;
-echo;
+~/pg/postgres/bin/initdb -D ~/pg/postgres/data/;
+echo " ";
+echo " ";
+echo " ";
+echo " ";
echo "> Starting the postgres server";
-"$PGDIR/postgres/bin/pg_ctl" -D "$PGDIR/postgres/data/" -l POSTGRES_logfile start;
+~/pg/postgres/bin/pg_ctl -D ~/pg/postgres/data/ -l POSTGRES_logfile start;
echo "> Create the Database";
-"$PGDIR/postgres/bin/createdb" be4;
+~/pg/postgres/bin/createdb be4;
echo "> Creating Admin user";
-"$PGDIR/postgres/bin/psql" -U ${USER} postgres -c "CREATE USER admin;";
+~/pg/postgres/bin/psql -U ${USER} postgres -c "CREATE USER admin WITH PASSWORD 'eprprJacR0hBpmWvs5IDJZTnjRAY2gM3tSm0b1af';";
echo "> Granting Admin Permissions";
-"$PGDIR/postgres/bin/psql" -U ${USER} postgres -c "ALTER DATABASE be4 OWNER TO admin;";
+~/pg/postgres/bin/psql -U ${USER} postgres -c "ALTER DATABASE be4 OWNER TO admin;";
-echo;
-echo;
-echo;
-echo;
-echo;
+echo " ";
+echo " ";
+echo " ";
+echo " ";
+echo " ";
echo "> Completed the installation of Postgres.";
cd $currentDir;