File: install-pdfchecker.sh

package info (click to toggle)
fpdf2 2.8.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 53,828 kB
  • sloc: python: 39,486; sh: 133; makefile: 12
file content (31 lines) | stat: -rwxr-xr-x 942 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

# Install Datalogics PDF Checker on a Linux system

# USAGE: ./install-pdfchecker.sh [$install_dir_path]

set -o pipefail -o errexit -o nounset -o xtrace

BASE_URL=https://cdn.datalogics.com/evals
DOWNLOADED_FILENAME=PDF-Optimizer-Checker-Linux64.bsx
INSTALL_DIR_PATH=${1:-$PWD/PDF_Checker}
export TMPDIR=$(mktemp -d /tmp/pdfchecker.XXXXXX)

wget --quiet $BASE_URL/$DOWNLOADED_FILENAME

bsx_extract() {
    local bsx_filepath=${1?'Missing arg'}
    local archive=$(awk '/^__ARCHIVE_BELOW__/ {print NR + 1; exit 0; }' $bsx_filepath)
    tail -q -n+$archive $bsx_filepath | tar xzv -C $TMPDIR
    rm $bsx_filepath
}

# Reproducing the first lines of the .bsx "Self Extracting Installer" script:
bsx_extract $(ls *.bsx)
bsx_extract $TMPDIR/PDF_Checker.bsx

# Reproducing $TMPDIR/installer script behaviour:
mkdir -p "$INSTALL_DIR_PATH"
tar -xf $TMPDIR/PDFChecker.tar -C "$INSTALL_DIR_PATH"
rm -rf $TMPDIR
rm $INSTALL_DIR_PATH/*.pdf