diff options
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | README.md | 18 | ||||
-rw-r--r-- | temp-postgres.1 | 54 | ||||
-rwxr-xr-x | temp-postgres.sh | 12 |
4 files changed, 82 insertions, 11 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5cc9272 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +MAN= installiso.8 +BINDIR= /usr/local/bin +MANDIR= /usr/local/man/man + +beforeinstall: + ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + ${.CURDIR}/temp-postgres.sh ${DESTDIR}${BINDIR}/temp-postgres + +.include <bsd.prog.mk> diff --git a/README.md b/README.md new file mode 100644 index 0000000..b7c9fa6 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# temp-postgres + +The temp-postgres utility runs the PostgreSQL server off a temporary data directory. +See [this](https://www.skreutz.com/posts/temporary-postgresql-server/) blog post for an introduction, and refer to the man page for details. + +## Install + +Run `make install` as root to install the `temp-postgres` utility and man page. + +## Release + +Create an annotated tag, and an archive as follows, replacing `0.1.0` with the +current version. + + $ git tag --annotate --message "Version 0.1.0" 0.1.0 + $ git archive --format=tar.gz --prefix=temp-postgres-0.1.0/ \ + --output temp-postgres-0.1.0.tar.gz 0.1.0 + diff --git a/temp-postgres.1 b/temp-postgres.1 new file mode 100644 index 0000000..caf4b78 --- /dev/null +++ b/temp-postgres.1 @@ -0,0 +1,54 @@ +.\" Copyright (c) 2022 Stefan Kreutz <mail@skreutz.com> +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.Dd $Mdocdate: May 19 2022 $ +.Dt TEMP-POSTGRES 1 +.Os +.Sh NAME +.Nm temp-postgres +.Nd temporary PostgreSQL server +.Sh SYNOPSIS +.Nm temp-postgres +.Ar database +.Ar superuser +.Sh DESCRIPTION +The +.Nm +utility runs the PostgreSQL server off a temporary data directory. +.Pp +It expects exactly two arguments: +a +.Ar database +name +and a +.Ar superuser +name. +You may also set the port using PGPORT, see +.Xr postgres 1 . +.Sh EXIT STATUS +.Ex -std temp-postgres +.Sh EXAMPLES +Create a temporary database "test" with superuser "alex": +.Bd -literal -offset indent +$ temp-postgres test alex +.Ed +.Pp +Connect to the "test" database: +.Bd -literal -offset indent +$ psql --host=localhost test alex +.Ed +.Sh SEE ALSO +.Xr postgres 1 , +.Xr psql 1 +.Sh AUTHORS +.An Stefan Kreutz Aq Mt mail@skreutz.com diff --git a/temp-postgres.sh b/temp-postgres.sh index 14d7d16..48bb9e8 100755 --- a/temp-postgres.sh +++ b/temp-postgres.sh @@ -1,6 +1,6 @@ #! /bin/sh -# Copyright (c) 2019-2020 Stefan Kreutz <mail@skreutz.com> +# Copyright (c) 2019, 2020, 2022 Stefan Kreutz <mail@skreutz.com> # # Permission to use, copy, modify, and distribute this software for any purpose # with or without fee is hereby granted, provided that the above copyright @@ -14,16 +14,6 @@ # OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# Run the PostgreSQL server off a temporary data directory. -# -# Expects exactly two arguments: database name and user name. You may also set -# the port by setting the environment variable PGPORT, see postgres(1). -# -# Exits 0 on SIGINT, and >0 if an error occurs. -# -# First published at https://www.skreutz.com/posts/temporary-postgresql-server/ -# on 14 October 2020. - set -o nounset # Remove the temporary directory before exiting. |