44 lines
894 B
Bash
44 lines
894 B
Bash
#! /bin/sh
|
|
|
|
set -o pipefail
|
|
set -e
|
|
set -u
|
|
|
|
cd src
|
|
|
|
echo PRINTING PDF
|
|
echo ...which google
|
|
bin=google-chrome-stable
|
|
if ! which $bin; then
|
|
bin=chromium
|
|
fi
|
|
which $bin
|
|
if ! which miniserve; then
|
|
wget -O $GOPATH/bin/miniserve https://github.com/svenstaro/miniserve/releases/download/v0.24.0/miniserve-0.24.0-x86_64-unknown-linux-musl
|
|
chmod +x $GOPATH/bin/miniserve
|
|
fi
|
|
which miniserve
|
|
miniserve -p 58080 ./homebrew/ &
|
|
pid=${!}
|
|
until curl localhost:58080; do sleep 5; done
|
|
$bin \
|
|
--no-sandbox \
|
|
--headless \
|
|
--disable-gpu \
|
|
--print-to-pdf=./homebrew/homebrew.pdf \
|
|
--run-all-compositor-stages-before-draw \
|
|
--no-pdf-header-footer \
|
|
http://localhost:58080/homebrew.html
|
|
get_state() {
|
|
cksum ./homebrew/homebrew.pdf | awk '{print $1}'
|
|
}
|
|
state=$(get_state)
|
|
while true; do
|
|
sleep 5
|
|
if [ "$state" == "$(get_state)" ]; then
|
|
break
|
|
fi
|
|
done
|
|
kill $pid || true
|
|
echo
|