Skip to content

Commit f2833d5

Browse files
committed
fix commands
1 parent 2399338 commit f2833d5

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

modules/printhost/cups.nix

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,16 @@ let
2424
# of the backend, which inherits CUPS's restricted PATH.
2525
enforcerPc = pkgs.writeShellScript "enforcer-pc" ''
2626
set -euo pipefail
27-
(${pkgs.coreutils}/bin/head -n20; ${pkgs.coreutils}/bin/tail -n20) < "$1" \
28-
| ${pkgs.gawk}/bin/awk '/^%%Pages: [0-9]+$/ {print $2}'
27+
${pkgs.gawk}/bin/awk '/^%%Pages: [0-9]+$/ {print $2; exit}' "$1"
2928
'';
3029

3130
# enforcer-size: reads %%DocumentMedia:/%%PageMedia: from PostScript spool file.
3231
enforcerSize = pkgs.writeShellScript "enforcer-size" ''
3332
set -euo pipefail
34-
(${pkgs.coreutils}/bin/head -n20; ${pkgs.coreutils}/bin/tail -n20) < "$1" \
35-
| ${pkgs.gawk}/bin/awk '
36-
/^%%PageMedia:/ {print $2}
37-
/^%%DocumentMedia:/ {print $2}
38-
' \
39-
| ${pkgs.coreutils}/bin/head -n1
33+
${pkgs.gawk}/bin/awk '
34+
/^%%PageMedia:/ {print $2; exit}
35+
/^%%DocumentMedia:/ {print $2; exit}
36+
' "$1"
4037
'';
4138

4239
# enforcer.py with @enforcer_pc@ and @enforcer_size@ paths substituted

0 commit comments

Comments
 (0)