summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--README.md21
-rwxr-xr-xconfigure5
-rwxr-xr-xjotpass.ksh10
4 files changed, 31 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 8f06eeb..2032192 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# Portable makefile supporting OpenBSD and GNU/Linux.
+# Portable makefile supporting OpenBSD, FreeBSD, and GNU/Linux.
PREFIX = /usr/local
INSTALL = install
diff --git a/README.md b/README.md
index 70341df..98950b2 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,10 @@
The `jotpass` utility facilitates generating random passwords suitable for
handwriting. See [this][intro] blog post for an introduction.
+The original source code is hosted [here][repo].
+
[intro]: https://www.skreutz.com/posts/readable-random-passwords-with-jot/
+[repo]: https://git.skreutz.com/jotpass.git/
## Usage
@@ -16,13 +19,23 @@ See the manual page for details.
## Dependencies
-The `jotpass` utility depends on `ksh(1)`, `jot(1)`, and some base utilities
-like `sed(1)`.
+The `jotpass` utility depends on
+
+* [OpenBSD][]'s public domain Korn shell, specifically, the portable version
+ [oksh][]
+* `jot(1)`
+
+and several standard utilities such as `sed(1)`.
+
+On OpenBSD these are included in the default base installation:
+
+ $ doas ln -s /bin/ksh /usr/local/bin/oksh
+
+On FreeBSD you can install the dependencies using `pkg-install(8)`:
-On OpenBSD these are included in the default base installation.
+ $ sudo pkg install oksh
On Void Linux you can install the dependencies using `xbps-install(1)`:
-follows:
$ sudo xbps-install -S oksh outils coreutils bc sed
diff --git a/configure b/configure
index 9a1e936..c9b0f50 100755
--- a/configure
+++ b/configure
@@ -10,6 +10,11 @@ case "$( uname )" in
echo 'BINGRP = bin' 1>&3
echo 'MANGRP = bin' 1>&3
;;
+ FreeBSD)
+ echo 'BINGRP = wheel' 1>&3
+ echo 'MANDIR = share/man/man' 1>&3
+ echo 'MANGRP = wheel' 1>&3
+ ;;
Linux)
echo 'BINMODE = 755' 1>&3
echo 'MANMODE = 644' 1>&3
diff --git a/jotpass.ksh b/jotpass.ksh
index c1b14aa..4f3efe4 100755
--- a/jotpass.ksh
+++ b/jotpass.ksh
@@ -1,6 +1,7 @@
-#! /bin/ksh
+#! /usr/bin/env oksh
+# shellcheck shell=ksh
-# Copyright (c) 2021 Stefan Kreutz <mail@skreutz.com>
+# Copyright (c) 2021, 2024 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
@@ -49,6 +50,11 @@ jot -r $((groups*width)) 0 $((symbols-1)) |
fold -w "$width" |
paste -s -d "$separator" -
+if [ "$( uname )" == "FreeBSD" ] ; then
+ # FreeBSD's paste(1) swallows the final newline.
+ printf '\n'
+fi
+
if [ $verbosity -gt 0 ]; then
entropy="$( printf 'e = (%d * %d * l(%d))/l(2); scale = 0; e/1\n' "$groups" "$width" "$symbols" | bc -l )"
print -u2 -- "The generated password has an entropy of ${entropy} bits."
Generated by cgit. See skreutz.com for my tech blog and contact information.