forked from codeship/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqpdf.sh
33 lines (28 loc) · 1.01 KB
/
qpdf.sh
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
32
33
#!/bin/bash
# Install a custom QPDF version - http://qpdf.sourceforge.net
#
# To run this script on Codeship, add the following
# command to your project's setup commands:
# \curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/packages/qpdf.sh | bash -s
#
# Add the following environment variable to your project configuration
# (otherwise the default below will be used).
# * QPDF_VERSION
#
QPDF_VERSION=${QPDF_VERSION:="8.3.0"}
QPDF_DIR=${QPDF_DIR:=$HOME/cache/qpdf-$QPDF_VERSION}
set -e
if [ ! -d "${QPDF_DIR}" ]; then
CACHED_DOWNLOAD="${HOME}/cache/qpdf-${QPDF_VERSION}.tar.gz"
mkdir -p "${HOME}/qpdf"
wget --continue --output-document "${CACHED_DOWNLOAD}" "https://github.com/qpdf/qpdf/archive/release-qpdf-${QPDF_VERSION}.tar.gz"
tar -xaf "${CACHED_DOWNLOAD}" --strip-components=1 --directory "${HOME}/qpdf"
(
cd "${HOME}/qpdf" || exit 1
./configure --prefix="${QPDF_DIR}"
make
make install
)
fi
ln -s "${QPDF_DIR}/bin/"* "${HOME}/bin"
qpdf --version | grep "${QPDF_VERSION}"