diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | README.md | 11 | ||||
-rwxr-xr-x | configure | 25 | ||||
-rwxr-xr-x | temp-postgres.sh | 2 |
5 files changed, 43 insertions, 8 deletions
@@ -1 +1,2 @@ config.mk +temp-postgres.1.gz @@ -1,4 +1,4 @@ -# Portable makefile supporting OpenBSD and GNU/Linux. +# Portable makefile supporting OpenBSD, FreeBSD, and GNU/Linux. PREFIX = /usr/local INSTALL = install @@ -10,12 +10,15 @@ MANDIR = man/man MANOWN = root MANGRP = root MANMODE = 444 +MANGZ = 0 include config.mk all: + gzip -c temp-postgres.1 >temp-postgres.1.gz clean: + rm temp-postgres.1.gz lint: shellcheck -a temp-postgres.sh @@ -24,8 +27,13 @@ lint: install: ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} temp-postgres.sh ${DESTDIR}${PREFIX}/${BINDIR}/temp-postgres - ${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} temp-postgres.1 ${DESTDIR}${PREFIX}/${MANDIR}1/temp-postgres.1 + if [ ${MANGZ} -eq 1 ] ; then \ + ${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} temp-postgres.1.gz ${DESTDIR}${PREFIX}/${MANDIR}1/temp-postgres.1.gz ; \ + else \ + ${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} temp-postgres.1 ${DESTDIR}${PREFIX}/${MANDIR}1/temp-postgres.1 ; \ + fi uninstall: rm -f ${DESTDIR}${PREFIX}/${BINDIR}/temp-postgres rm -f ${DESTDIR}${PREFIX}/${MANDIR}1/temp-postgres.1 + rm -f ${DESTDIR}${PREFIX}/${MANDIR}1/temp-postgres.1.gz @@ -3,7 +3,10 @@ The `temp-postgres` utility runs the PostgreSQL server off a temporary data directory. See [this][intro] blog post for an introduction. +This project's original source code is hosted [here][home]. + [intro]: https://www.skreutz.com/posts/temporary-postgresql-server/ +[home]: https://git.skreutz.com/temp-postgres.git/ ## Usage @@ -25,10 +28,18 @@ On OpenBSD you can install the dependencies using `pkg_add(1)`: $ doas pkg_add postgresql-server postgresql-client +On FreeBSD you can install the dependencies using `pkg-install(8)`: + + $ sudo pkg install postgresql16-server postgresql16-client + On Void Linux you can install the dependencies using `xbps-install(1)`: $ sudo xbps-install -S dash postgresql postgresql-client +On Arch Linux you can install the dependencies using `pacman(8)`: + + $ sudo pacman -Syu postgresql + ## Installation $ ./configure @@ -1,7 +1,6 @@ #! /bin/sh -set -o errexit -set -o nounset +set -eu exec 3>config.mk @@ -10,9 +9,25 @@ case "$( uname )" in echo 'BINGRP = bin' 1>&3 echo 'MANGRP = bin' 1>&3 ;; - Linux) - echo 'BINMODE = 755' 1>&3 - echo 'MANMODE = 644' 1>&3 + FreeBSD) + echo 'BINGRP = wheel' 1>&3 echo 'MANDIR = share/man/man' 1>&3 + echo 'MANGRP = wheel' 1>&3 + ;; + Linux) + case "$( sed -n 's/^ID=//p' /etc/os-release )" in + void) + echo 'BINMODE = 755' 1>&3 + echo 'MANMODE = 644' 1>&3 + echo 'MANDIR = share/man/man' 1>&3 + ;; + arch) + echo 'PREFIX = /usr' 1>&3 + echo 'BINMODE = 755' 1>&3 + echo 'MANDIR = share/man/man' 1>&3 + echo 'MANMODE = 644' 1>&3 + echo 'MANGZ = 1' 1>&3 + ;; + esac ;; esac diff --git a/temp-postgres.sh b/temp-postgres.sh index 48bb9e8..15e169b 100755 --- a/temp-postgres.sh +++ b/temp-postgres.sh @@ -14,7 +14,7 @@ # OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -set -o nounset +set -u # Remove the temporary directory before exiting. trap 'quit' INT |