new installation procedure

This commit is contained in:
Tilman Kranz 2023-12-10 14:00:07 +01:00
parent 5d7c97c22e
commit cad9979d7b
2 changed files with 33 additions and 6 deletions

24
Makefile Normal file
View File

@ -0,0 +1,24 @@
NAME=photos2pdf
DESTDIR=
PREFIX=/usr
INSTALL=install
BINDIR=$(PREFIX)/bin
LIBDIR=/var/lib/$(NAME)
TEMPLATEDIR=$(LIBDIR)/template
.PHONY: all install-bin install-template install
all:
@echo "Use \"sudo $(MAKE) install\" to install $(NAME)"
install-bin:
$(INSTALL) -d -m 0755 "$(BINDIR)"
$(INSTALL) -m 0755 "$(NAME)" "$(BINDIR)/$(NAME)"
install-template:
$(INSTALL) -d -m 0755 "$(DESTDIR)$(LIBDIR)"
$(INSTALL) -d -m 0755 "$(DESTDIR)$(TEMPLATEDIR)"
tar cf - -C template . | (cd "$(DESTDIR)$(TEMPLATEDIR)" && tar xf -)
install: install-bin install-template

View File

@ -41,6 +41,9 @@ offset="1cm 3cm"
# Factor to scale image by before placing in page # Factor to scale image by before placing in page
scale=0.75 scale=0.75
# PDF backdrop template directory
templatedir=/var/lib/photos2pdf/templates
# Filename of complete result PDF # Filename of complete result PDF
result="pdf/result.pdf" result="pdf/result.pdf"
@ -77,7 +80,7 @@ if [[ -z $dir ]] ; then
error "Usage: $0 DIR" error "Usage: $0 DIR"
fi fi
origdir=$(dirname "$(readlink -f "$dir")") origdir=$(readlink -f "$dir")
if [[ ! -d $origdir ]] ; then if [[ ! -d $origdir ]] ; then
error "Directory not found: $dir ($origdir)" error "Directory not found: $dir ($origdir)"
@ -286,17 +289,17 @@ for png in "out/"*.png ; do
rv=1 rv=1
continue continue
elif [[ $width -gt $height ]] ; then elif [[ $width -gt $height ]] ; then
backdrop=template/a4paper/landscape.pdf backdrop="$templatedir/a4paper/landscape.pdf"
jam_landscape=--landscape jam_landscape=--landscape
else else
backdrop=template/a4paper/portrait.pdf backdrop="$templatedir/a4paper/portrait.pdf"
jam_landscape=--no-landscape jam_landscape=--no-landscape
fi fi
base=$(basename "$png" .png) base=$(basename "$png" .png)
pdf=tmp/$base.pdf pdf="$tmpdir/$base.pdf"
jammed=tmp/$base-pdfjam.pdf jammed="$tmpdir/$base-pdfjam.pdf"
backdropped=tmp/$base.backdropped.pdf backdropped="$tmpdir/$base.backdropped.pdf"
if ! convert "$png" "$pdf" ; then if ! convert "$png" "$pdf" ; then
warning "Could not convert \"$png\" to PDF; skipped." warning "Could not convert \"$png\" to PDF; skipped."