update makebook to version 2.2

This commit is contained in:
Sebastian Hugentobler 2022-04-18 13:54:56 +02:00
parent f53f7b1324
commit d0e659cd3e
Signed by: shu
GPG Key ID: BB32CF3CA052C2F0

View File

@ -6,10 +6,10 @@
# #
#**********************************************************# #**********************************************************#
# makebook # # makebook #
# written by Donald P. Goodman III # # written by Donald P. Goodman III #
# Copyright (C) 2011 # # Copyright (C) 2011 #
# # # #
# Impose pdf pages for binding # # Impose pdf pages for binding #
#**********************************************************# #**********************************************************#
# #
# This program is free software: you can redistribute it # This program is free software: you can redistribute it
@ -34,7 +34,7 @@
PATH=/bin:/usr/bin:/usr/local/bin ; export PATH PATH=/bin:/usr/bin:/usr/local/bin ; export PATH
umask 033 umask 033
# define our revision number variable for rcs # define our revision number variable for rcs
REVISION="2.1" REVISION="2.2"
# define error codes # define error codes
E_WRONG_ARGS=64 # too many or few args E_WRONG_ARGS=64 # too many or few args
E_BAD_SIG_TYPE=65 # invalid type of signature E_BAD_SIG_TYPE=65 # invalid type of signature
@ -88,8 +88,7 @@ command -v bc >/dev/null 2>&1 ||
# print the version information and exit successfully # print the version information and exit successfully
versionfunc () versionfunc ()
{ {
echo "makebook v${REVISION}. Copyright (C) 2011, Donald P." echo "makebook v${REVISION}. Copyright (C) 2011, Donald P Goodman III."
echo "Goodman III."
echo "This program comes with ABSOLUTELY NO WARRANTY." echo "This program comes with ABSOLUTELY NO WARRANTY."
echo "This is free software, and you are welcome to " echo "This is free software, and you are welcome to "
echo "redistribute it under certain conditions; see " echo "redistribute it under certain conditions; see "
@ -263,6 +262,9 @@ then
cp "$FILE_NAME" "$NEW_FILE_NAME" cp "$FILE_NAME" "$NEW_FILE_NAME"
else else
FILE_NAME="book.pdf" FILE_NAME="book.pdf"
if [ $VERBOSE -eq 1 ]; then
echo "makebook: No input file named; using stdin..."
fi
cat /dev/stdin > "$NEW_FILE_NAME" cat /dev/stdin > "$NEW_FILE_NAME"
fi fi
# declare holder variable for pdftk # declare holder variable for pdftk
@ -287,8 +289,8 @@ fi
# get some information about our source document # get some information about our source document
NUM_PAGES=`pdfinfo "$NEW_FILE_NAME" | awk '/Pages:/ {print $2}'`; NUM_PAGES=`pdfinfo "$NEW_FILE_NAME" | awk '/Pages:/ {print $2}'`;
SRC_PAGE_WIDTH=`pdfinfo "$NEW_FILE_NAME" | awk '/Page\ size:/ {print $3}'`; SRC_PAGE_WIDTH=`pdfinfo "$NEW_FILE_NAME" | awk '/Page size:/ {print $3}'`;
SRC_PAGE_HEIGHT=`pdfinfo "$NEW_FILE_NAME" | awk '/Page\ size:/ {print $5}'`; SRC_PAGE_HEIGHT=`pdfinfo "$NEW_FILE_NAME" | awk '/Page size:/ {print $5}'`;
# find the number of pages we'll have per signature # find the number of pages we'll have per signature
PAGES_PER_SIG=$(dc -e "$PAGES_PER_SIG $SECT_TYPE * p") PAGES_PER_SIG=$(dc -e "$PAGES_PER_SIG $SECT_TYPE * p")
# determine if extra pages will be necessary # determine if extra pages will be necessary