summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2022-03-22 19:34:57 +0100
committertv <tv@krebsco.de>2022-03-22 19:35:33 +0100
commit1fc622cd0835882d4d565f216af72e2881815b7b (patch)
tree095857ef887bea380e4e009f8bfb3ef0e5a6bd09 /krebs/5pkgs/simple
parent44ec31fe02c282660be239f3a7899b62f56ab4d3 (diff)
qrscan: use new one shot scanning mode
Diffstat (limited to 'krebs/5pkgs/simple')
-rw-r--r--krebs/5pkgs/simple/qrscan.nix26
1 files changed, 3 insertions, 23 deletions
diff --git a/krebs/5pkgs/simple/qrscan.nix b/krebs/5pkgs/simple/qrscan.nix
index 7d99dcee7..df9a98053 100644
--- a/krebs/5pkgs/simple/qrscan.nix
+++ b/krebs/5pkgs/simple/qrscan.nix
@@ -1,27 +1,7 @@
-{ coreutils, gnused, writeDashBin, zbar }:
+{ pkgs }:
-writeDashBin "qrscan" ''
+pkgs.writeDashBin "qrscan" ''
set -efu
- tmpdir=$(${coreutils}/bin/mktemp --tmpdir -d qrscan.XXXXXXXX)
- codefile=$tmpdir/code
-
- cleanup() {
- ${coreutils}/bin/rm "$codefile"
- ${coreutils}/bin/rmdir "$tmpdir"
- }
-
- ${coreutils}/bin/mkfifo "$codefile"
-
- ${zbar}/bin/zbarcam > "$codefile" &
- zbarcampid=$!
-
- exec < "$codefile"
- while read -r code; do
- code=$(printf %s "$code" | ${gnused}/bin/sed -n 's/^QR-Code://p')
- if test -n "$code"; then
- ${coreutils}/bin/kill "$zbarcampid"
- echo "$code"
- fi
- done
+ ${pkgs.zbar}/bin/zbarcam -1 | ${pkgs.gnused}/bin/sed -n 's/^QR-Code://p'
''