Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP : Provide rule to set a debian package #13

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
shrinkpdf (1.1.0) stable; urgency=low
Changes since v1.0:
Add an optional argument to output a grayscale PDF.
#3: Check for equal input and output files to avoid truncation.
#4: Update README.md.
#5: Replace optional positional arguments with option flags.
-- Alfred Klomp <[email protected]> Sat, 11 Jun 2022 01:08:12 +0200

shrinkpdf (1.0.0) stable; urgency=low
The shrinkpdf script has been available for a long time on its project website. It has gone through a number of iterations, but was never properly versioned.
The script is quite battle-tested by now, so let's create a first official release.
-- Alfred Klomp <[email protected]> Mon, 23 May 2022 22:18:29 +0200
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
23 changes: 23 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Source: shrinkpdf
Section: admin
Priority: optional
Maintainer: Camille Lafitte <[email protected]>
Build-Depends: debhelper (>= 9),
devscripts,
git
Standards-Version: 3.9.8

Package: shrinkpdf
Architecture: all
Depends: ghostscript,
, awk
, ${misc:Depends}
Description: Wrapper to shrink PDFs around Ghostscript
A simple wrapper around Ghostscript to shrink PDFs (as in reduce
filesize) under Linux. Inspired by some code I found in an
OpenOffice Python script (I think).
The script feeds a PDF through Ghostscript, which performs lossy
recompression by such methods as downsampling the images to 72dpi.
.
The result should be (but not always is) a much smaller file.
Homepage: https://github.com/aklomp/shrinkpdf
30 changes: 30 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: shrinkpdf
Source: https://github.com/aklomp/shrinkpdf.git

Files: *
Copyright: Copyright (c) 2014-2022, Alfred Klomp
License: 3-clause BSD license
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
5 changes: 5 additions & 0 deletions debian/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Set default option values.
grayscale=""
ofile="-"
res="72"

1 change: 1 addition & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shrinkpdf.sh /usr/bin/
32 changes: 32 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# This file is public domain software, originally written by Joey Hess.
#
# This version is for a multibinary package. It also allows you to build any
# of the binary packages independantly, via binary-<package> targets.

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

#Define version packaging
#Exclude nighly version
VERSION=$(shell git tag -l --points-at HEAD |grep -v 'nightly')
ifeq ($(strip $(VERSION)),)
VERSION=$(shell git tag | sort -V |grep -v nightly|tail -1)
ifeq ($(strip $(VERSION)),)
export VERSION="0.0.0"
endif
VERSION:=$(VERSION)+$(shell date +'%y%m%d%H%M%S')
IS_NIGHTLY=1
endif

clean:
dh clean
rm -f debian/files
(git rev-parse --git-dir > /dev/null 2>&1 && git checkout debian/changelog) || true
ifeq ($(strip $(IS_NIGHTLY)),1)
(git rev-parse --git-dir > /dev/null 2>&1 && dch -m -b -v $(VERSION) autobuild) || true
endif
%:
dh $@

11 changes: 8 additions & 3 deletions shrinkpdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,14 @@ usage ()
}

# Set default option values.
grayscale=""
ofile="-"
res="72"
# shellcheck source=debian/default
if [ -f "/etc/default/shrinkpdf" ];then
. /etc/default/shrinkpdf
else
grayscale=""
ofile="-"
res="72"
fi

# Parse command line options.
while getopts ':hgo:r:' flag; do
Expand Down