# - Some settings
# -
os_codename=buster
version_wkhtmltox=0.12.5-1


# - Determin major/minor version and major patch level'
# -
wkhtmltox_main_version="$(echo $version_wkhtmltox | cut -d '.' -f1,2)"
wkhtmltox_major_version="$(echo $version_wkhtmltox | cut -d '.' -f1)"
wkhtmltox_minor_version="$(echo $version_wkhtmltox | cut -d '.' -f2)"
wkhtmltox_major_patch_level="$(echo $version_wkhtmltox | cut -d '.' -f3 | cut -d '-' -f1)"

#echo ""
#echo "$wkhtmltox_main_version"
#echo ""
#echo "$wkhtmltox_major_version"
#echo "$wkhtmltox_minor_version"
#echo "$wkhtmltox_major_patch_level"
#echo ""

# - Download Debian package from:
# -    https://wkhtmltopdf.org/downloads.html
# -
mkdir -p /usr/local/src/wkhtmltox
cd /usr/local/src/wkhtmltox
wget -O /usr/local/src/wkhtmltox/wkhtmltox_${version_wkhtmltox}.${os_codename}_amd64.deb \
   https://downloads.wkhtmltopdf.org/${wkhtmltox_main_version}/${wkhtmltox_main_version}.${wkhtmltox_major_patch_level}/wkhtmltox_${version_wkhtmltox}.${os_codename}_amd64.deb


# - Install dependency package
# -
apt install ca-certificates fontconfig libc6 libfreetype6 libjpeg62-turbo libpng16-16 libssl1.1 libstdc++6 libx11-6 libxcb1 libxext6 libxrender1 xfonts-75dpi xfonts-base zlib1g

# - Install wkhtmltopdf wkhtmltox
# -
dpkg -i /usr/local/src/wkhtmltox/wkhtmltox_${version_wkhtmltox}.${os_codename}_amd64.deb

