new installation procedure
This commit is contained in:
parent
5d7c97c22e
commit
cad9979d7b
24
Makefile
Normal file
24
Makefile
Normal 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
|
@ -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."
|
Loading…
Reference in New Issue
Block a user