mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
use lib.getExe and lib.getExe' in packaged scripts
Replace all ${pkg}/bin/name patterns with:
- lib.getExe pkg (for main executables: curl, jq, gnused, ffmpeg, etc.)
- lib.getExe' pkg "name" (for specific binaries: coreutils, util-linux, etc.)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# Split a PDF into chunks of N pages
|
||||
{
|
||||
lib,
|
||||
writers,
|
||||
pdftk,
|
||||
gnugrep,
|
||||
@@ -16,15 +17,15 @@ writers.writeDashBin "chunk-pdf" ''
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TOTAL_PAGES="$(${pdftk}/bin/pdftk "$INPUT_FILE" dump_data | ${gnugrep}/bin/grep NumberOfPages | ${coreutils}/bin/cut -f2 -d' ')"
|
||||
TOTAL_PAGES="$(${lib.getExe pdftk} "$INPUT_FILE" dump_data | ${lib.getExe gnugrep} NumberOfPages | ${lib.getExe' coreutils "cut"} -f2 -d' ')"
|
||||
|
||||
RUNS=$((TOTAL_PAGES/PAGES_PER_REPORT))
|
||||
|
||||
for run in $(${coreutils}/bin/seq 0 "$((RUNS-1))"); do
|
||||
for run in $(${lib.getExe' coreutils "seq"} 0 "$((RUNS-1))"); do
|
||||
start_page=$((run*PAGES_PER_REPORT+1))
|
||||
end_page=$(((run+1)*PAGES_PER_REPORT))
|
||||
output_file="chunk_$((run+1)).pdf"
|
||||
echo "splitting $INPUT_FILE from $start_page to $end_page into $output_file"
|
||||
${pdftk}/bin/pdftk "$INPUT_FILE" cat "$start_page-$end_page" output "$output_file"
|
||||
${lib.getExe pdftk} "$INPUT_FILE" cat "$start_page-$end_page" output "$output_file"
|
||||
done
|
||||
''
|
||||
|
||||
Reference in New Issue
Block a user