Fixed check_imagemagick_policy and check_pdftoppm for --batch-mode
parent
4567a56fa2
commit
d0710c39f2
20
build.sh
20
build.sh
|
@ -232,8 +232,7 @@ check_pdftoppm() {
|
|||
fi
|
||||
|
||||
echo "Program 'pdftoppm' not found."
|
||||
echo "Be sure to have poppler(-utils) installed!"
|
||||
exit 1
|
||||
# exit 1
|
||||
}
|
||||
|
||||
check_imagemagick_policy() {
|
||||
|
@ -241,12 +240,12 @@ check_imagemagick_policy() {
|
|||
identify -list policy | grep -q "pattern: PDF" || STATUS=0
|
||||
if [ $STATUS = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "Imagemagick allows to convert PDFs. Great!"
|
||||
echo "ImageMagick allows to convert PDFs. Great!"
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "Imagemagick does not allow to convert PDFs."
|
||||
echo "ImageMagick does not allow to convert PDFs."
|
||||
fi
|
||||
|
||||
## check for alternative
|
||||
|
@ -256,7 +255,9 @@ check_imagemagick_policy() {
|
|||
## modify ImageMagick-6/policy.xml
|
||||
if [ $BATCHMODE = 0 ]; then
|
||||
echo ""
|
||||
echo "Do you wish to temporaly remove the policy preventing Imagemagick from converting PDFs?"
|
||||
echo "Be sure to have either poppler(-utils) installed or"
|
||||
echo "an ImageMagick policy which allows for PDF conversion!"
|
||||
echo "Do you wish to temporaly remove the policy preventing ImageMagick from converting PDFs?"
|
||||
echo $n "(y/n) $c"
|
||||
while true; do
|
||||
read -p "" answer
|
||||
|
@ -267,14 +268,17 @@ check_imagemagick_policy() {
|
|||
esac
|
||||
done
|
||||
# else
|
||||
# echo "${RED}Imagemagick policy is preventing converting PDFs to PNGS${COLOR_RESET}"
|
||||
# echo "${RED}and program 'pdftoppm' was not found!${COLOR_RESET}"
|
||||
# echo "${RED}ImageMagick policy is preventing converting PDFs to PNGs and${COLOR_RESET}"
|
||||
# echo "${RED}program 'pdftoppm' was not found!${COLOR_RESET}"
|
||||
# echo "${RED}Be sure to have either poppler(-utils) installed or${COLOR_RESET}"
|
||||
# echo "${RED}an ImageMagick policy which allows for PDF conversion!${COLOR_RESET}"
|
||||
# exit 1
|
||||
fi
|
||||
check_sudo
|
||||
POLICY_PATH=$(identify -list policy | grep "Path" | cut -d " " -f2) # default /etc/ImageMagick-6/policy.xml
|
||||
POLICY_MOD=1
|
||||
$rootrun sed -i".backup" 's/^.*policy.*coder.*none.*PDF.*//' $POLICY_PATH
|
||||
echo "${RED}Modified ${POLICY_PATH}!${COLOR_RESET}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -601,7 +605,7 @@ run_test_cases() {
|
|||
EXIT_CODE=0
|
||||
if [ $PDFTOPPM_CONVERT = 0 ]; then
|
||||
# 'compare' will convert the pdf to png
|
||||
# unless the policy of imagemagick prevents it
|
||||
# unless the policy of ImageMagick prevents it
|
||||
# -> this reasonably fast!
|
||||
compare -metric RMSE -colorspace RGB .tex/${NAME}.pdf ${NAME}_expected.pdf NULL: >> /dev/null 2>&1 || EXIT_CODE=1
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue