From 9a08dec095725012546ea93ac07142a570d1b220 Mon Sep 17 00:00:00 2001 From: Stefan Kreutz Date: Wed, 9 Nov 2022 09:49:02 +0100 Subject: Port to GNU/Linux Tested on Void Linux x86_64 glibc. --- .gitignore | 1 + Makefile | 36 +++++++++++++++++++++++++++++------- README.md | 21 ++++++++++++++++++--- configure | 18 ++++++++++++++++++ 4 files changed, 66 insertions(+), 10 deletions(-) create mode 100644 .gitignore create mode 100755 configure diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aee2e4c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config.mk diff --git a/Makefile b/Makefile index 552ebda..8f06eeb 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,31 @@ -MAN= jotpass.1 -BINDIR= /usr/local/bin -MANDIR= /usr/local/man/man +# Portable makefile supporting OpenBSD and GNU/Linux. -beforeinstall: - ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - ${.CURDIR}/jotpass.ksh ${DESTDIR}${BINDIR}/jotpass +PREFIX = /usr/local +INSTALL = install +BINDIR = bin +BINOWN = root +BINGRP = root +BINMODE = 555 +MANDIR = man/man +MANOWN = root +MANGRP = root +MANMODE = 444 -.include +include config.mk + +all: + +clean: + +lint: + shellcheck -a jotpass.ksh + mandoc -T lint -W warning jotpass.1 + -mandoc -T lint -W all jotpass.1 + +install: + ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} jotpass.ksh ${DESTDIR}${PREFIX}/${BINDIR}/jotpass + ${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} jotpass.1 ${DESTDIR}${PREFIX}/${MANDIR}1/jotpass.1 + +uninstall: + rm -f ${DESTDIR}${PREFIX}/${BINDIR}/jotpass + rm -f ${DESTDIR}${PREFIX}/${MANDIR}1/jotpass.1 diff --git a/README.md b/README.md index 866beac..70341df 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Jotpass -Jotpass is a BSD utility that facilitates generating random passwords suitable -for handwriting. See [this][intro] blog post for an introduction. +The `jotpass` utility facilitates generating random passwords suitable for +handwriting. See [this][intro] blog post for an introduction. [intro]: https://www.skreutz.com/posts/readable-random-passwords-with-jot/ @@ -14,6 +14,21 @@ Print a random password: See the manual page for details. +## Dependencies + +The `jotpass` utility depends on `ksh(1)`, `jot(1)`, and some base utilities +like `sed(1)`. + +On OpenBSD these are included in the default base installation. + +On Void Linux you can install the dependencies using `xbps-install(1)`: +follows: + + $ sudo xbps-install -S oksh outils coreutils bc sed + ## Installation -Run `make install` as root to install the `jotpass` utility and man page. + $ ./configure + $ make + $ sudo make install + diff --git a/configure b/configure new file mode 100755 index 0000000..9a1e936 --- /dev/null +++ b/configure @@ -0,0 +1,18 @@ +#! /bin/sh + +set -o errexit +set -o nounset + +exec 3>config.mk + +case "$( uname )" in + OpenBSD) + echo 'BINGRP = bin' 1>&3 + echo 'MANGRP = bin' 1>&3 + ;; + Linux) + echo 'BINMODE = 755' 1>&3 + echo 'MANMODE = 644' 1>&3 + echo 'MANDIR = share/man/man' 1>&3 + ;; +esac -- cgit v1.2.3