m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/platform
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-01-01 21:03:38 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2017-01-01 21:03:38 +0100
commit77f1384a6321eef06265ea5e5b11eabdc53ab720 (patch)
treebb99edb1d431b67aa03609f95f2230521a94302f /src/platform
parentbb717d68c5ba07516a6d0a156851792984367b53 (diff)
show,generate: support qrcodes
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/darwin.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh
index 7b028f3..86eb325 100644
--- a/src/platform/darwin.sh
+++ b/src/platform/darwin.sh
@@ -31,5 +31,17 @@ tmpdir() {
mount -t hfs -o noatime -o nobrowse "$DARWIN_RAMDISK_DEV" "$SECURE_TMPDIR" || die "Error: could not mount filesystem on ramdisk."
}
+qrcode() {
+ if type imgcat >/dev/null 2>&1; then
+ echo -n "$1" | qrencode --size 10 -o - | imgcat
+ elif type gm >/dev/null 2>&1; then
+ echo -n "$1" | qrencode --size 10 -o - | gm display -title "pass: $2" -geometry +200+200 -
+ elif type display >/dev/null 2>&1; then
+ echo -n "$1" | qrencode --size 10 -o - | display -title "pass: $2" -geometry +200+200 -
+ else
+ echo -n "$1" | qrencode -t utf8
+ fi
+}
+
GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || { which port &>/dev/null && echo /opt/local; } || echo /usr/local)/bin/getopt"
SHRED="srm -f -z"