From 12e30c5518bca7be189aae2f089678a9628bf463 Mon Sep 17 00:00:00 2001 From: matt Baumann Date: Sat, 29 Apr 2017 22:56:54 +0200 Subject: [PATCH] Adds debian package and install instructions --- packaging/README.md | 2 +- packaging/debian/stretch/Dockerfile | 46 +++++++++++ packaging/debian/stretch/build.bash | 33 ++++++++ packaging/debian/stretch/debian/changelog | 5 ++ packaging/debian/stretch/debian/compat | 1 + packaging/debian/stretch/debian/control | 17 ++++ packaging/debian/stretch/debian/copyright | 21 +++++ packaging/debian/stretch/debian/postinst | 10 +++ packaging/debian/stretch/debian/postrm | 8 ++ packaging/debian/stretch/debian/rules | 26 ++++++ packaging/debian/stretch/debian/source/format | 1 + packaging/debian/stretch/distributions | 10 +++ packaging/debian/stretch/gpg.conf | 81 +++++++++++++++++++ .../debian/stretch/pysmb_debian/changelog | 5 ++ packaging/debian/stretch/pysmb_debian/compat | 1 + packaging/debian/stretch/pysmb_debian/control | 15 ++++ .../debian/stretch/pysmb_debian/copyright | 30 +++++++ packaging/debian/stretch/pysmb_debian/rules | 7 ++ .../debian/stretch/pysmb_debian/source/format | 1 + 19 files changed, 319 insertions(+), 1 deletion(-) create mode 100644 packaging/debian/stretch/Dockerfile create mode 100755 packaging/debian/stretch/build.bash create mode 100644 packaging/debian/stretch/debian/changelog create mode 100644 packaging/debian/stretch/debian/compat create mode 100755 packaging/debian/stretch/debian/control create mode 100644 packaging/debian/stretch/debian/copyright create mode 100755 packaging/debian/stretch/debian/postinst create mode 100755 packaging/debian/stretch/debian/postrm create mode 100644 packaging/debian/stretch/debian/rules create mode 100644 packaging/debian/stretch/debian/source/format create mode 100644 packaging/debian/stretch/distributions create mode 100644 packaging/debian/stretch/gpg.conf create mode 100644 packaging/debian/stretch/pysmb_debian/changelog create mode 100644 packaging/debian/stretch/pysmb_debian/compat create mode 100755 packaging/debian/stretch/pysmb_debian/control create mode 100644 packaging/debian/stretch/pysmb_debian/copyright create mode 100644 packaging/debian/stretch/pysmb_debian/rules create mode 100644 packaging/debian/stretch/pysmb_debian/source/format diff --git a/packaging/README.md b/packaging/README.md index fdcfbe7..c391b49 100644 --- a/packaging/README.md +++ b/packaging/README.md @@ -5,7 +5,7 @@ sudo dnf config-manager --add-repo https://raw.githubusercontent.com/openhsr/con sudo dnf install openhsr-connect ``` -## Ubuntu +## Ubuntu/Debian ```bash curl https://pool.openhsr.ch/pool@openhsr.ch.gpg.key | sudo apt-key add - diff --git a/packaging/debian/stretch/Dockerfile b/packaging/debian/stretch/Dockerfile new file mode 100644 index 0000000..ef122ae --- /dev/null +++ b/packaging/debian/stretch/Dockerfile @@ -0,0 +1,46 @@ +FROM ubuntu:xenial + +# Build time env variables +ARG DOCKER_UID +ARG DOCKER_GID +ARG DISTRIBUTION +ARG VERSION +ARG CONNECT_VERSION +ENV DOCKER_UI $DOCKER_UID +ENV DOCKER_GID $DOCKER_GID +ENV DISTRIBUTION $DISTRIBUTION +ENV RELEASE $RELEASE +ENV VERSION $VERSION + +# Writable subfolders +WORKDIR /build + +# User +RUN groupadd -g ${DOCKER_GID} user && \ + useradd --home /build -u ${DOCKER_UID} -g ${DOCKER_GID} -M user && \ + mkdir -p /source/{dist,build,openhsr_connect.egg-info} /repo /build/.gnupg && \ + chmod 700 /build/.gnupg && \ + chown -R ${DOCKER_UID}:${DOCKER_GID} /build /repo /source + +# Packages +RUN apt-get update + +# Python +RUN apt-get install -y python3 python3-all python3-pip python3-pkg-resources + +# Packaging +RUN apt-get install -y reprepro debhelper devscripts -y + +# Add relevant files for build +ADD packaging/${DISTRIBUTION}/${VERSION}/gpg.conf /build/.gnupg/gpg.conf +# ADD packaging/${DISTRIBUTION}/${VERSION}/build.bash /opt/build.bash + +# Add relevant files for creating packages +ADD ./ /build/openhsr-connect/ +RUN chown -R user:user /build/openhsr-connect/ + + +ADD packaging/${DISTRIBUTION}/${VERSION}/build.bash /opt/build.bash +USER user + +CMD [ "/opt/build.bash" ] diff --git a/packaging/debian/stretch/build.bash b/packaging/debian/stretch/build.bash new file mode 100755 index 0000000..e476176 --- /dev/null +++ b/packaging/debian/stretch/build.bash @@ -0,0 +1,33 @@ +#!/bin/bash +set -e + +# Import GPG signing key +gpg --import <(echo -e "${GPG_KEY}") + +# get pysmb +PYSMB_VERSION=1.1.19 +curl -o /build/pysmb-${PYSMB_VERSION}.tar.gz https://pypi.python.org/packages/f9/e7/1fd7faaa946cc6b43ce85bb7a177b75a4718d9c5e291201fec00112b497c/pysmb-1.1.19.tar.gz +tar -xzf /build/pysmb-${PYSMB_VERSION}.tar.gz -C /build/ +cp -R /build/openhsr-connect/packaging/${DISTRIBUTION}/${VERSION}/pysmb_debian /build/pysmb-${PYSMB_VERSION}/debian/ +cd /build/pysmb-${PYSMB_VERSION}/ +sed -i 's/PYSMB_VERSION/'${PYSMB_VERSION}'/g' debian/changelog +debuild --no-tgz-check + +# Build .deb and sign it... +cd /build/openhsr-connect/ + +# Set current version... +sed -i -e 's/version[\t ]*=[\t ]*"[0-9]*\.[0-9]*\.[0-9]*"/version="'${CONNECT_VERSION}'"/gi' setup.py +sed -i 's/CONNECT_VERSION/'$CONNECT_VERSION'/g' packaging/${DISTRIBUTION}/${VERSION}/debian/changelog + +cp -R packaging/${DISTRIBUTION}/${VERSION}/debian/ debian/ +debuild --no-tgz-check + +# Re-Generate pool +mkdir -p /repo/conf + +cat /build/openhsr-connect/packaging/${DISTRIBUTION}/*/distributions > /repo/conf/distributions + +reprepro -Vb /repo/ export +reprepro -Vb /repo/ includedeb ${VERSION} /build/openhsr-connect_${CONNECT_VERSION}_all.deb +reprepro -Vb /repo/ includedeb ${VERSION} /build/python3-pysmb_${PYSMB_VERSION}_all.deb diff --git a/packaging/debian/stretch/debian/changelog b/packaging/debian/stretch/debian/changelog new file mode 100644 index 0000000..2834f0a --- /dev/null +++ b/packaging/debian/stretch/debian/changelog @@ -0,0 +1,5 @@ +openhsr-connect (CONNECT_VERSION) UNRELEASED; urgency=medium + + * CONNECT_VERSION Initial release. + + -- open\HSR Pool Thu, 16 Feb 2017 15:55:41 +0100 diff --git a/packaging/debian/stretch/debian/compat b/packaging/debian/stretch/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/packaging/debian/stretch/debian/compat @@ -0,0 +1 @@ +7 diff --git a/packaging/debian/stretch/debian/control b/packaging/debian/stretch/debian/control new file mode 100755 index 0000000..3e7a5f5 --- /dev/null +++ b/packaging/debian/stretch/debian/control @@ -0,0 +1,17 @@ +Source: openhsr-connect +Section: utils +Priority: optional +Maintainer: open\HSR Pool +Build-Depends: debhelper (>= 7), + python3-all (>= 3.5) +X-Python-Version: >= 3.5 +Standards-Version: 3.9.6 + +Package: openhsr-connect +Architecture: all +Section: utils +Depends: ${misc:Depends}, ${python3:Depends}, python3-ruamel.yaml, python3-pysmb, cups +Description: Die offene HSR-Mapper alternative! + Besser als der HSR Mapper ;) + + diff --git a/packaging/debian/stretch/debian/copyright b/packaging/debian/stretch/debian/copyright new file mode 100644 index 0000000..3c8b887 --- /dev/null +++ b/packaging/debian/stretch/debian/copyright @@ -0,0 +1,21 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: openhsr-connect +Upstream-Contact: open\HSR +Source: https://github.com/openhsr/connect/ + +Files: * +Copyright: 2016-2017 open\HSR +License: GPL-3 + +License: GPL-3 + This software is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + It can be found in /usr/share/common-licenses/GPL-3 + diff --git a/packaging/debian/stretch/debian/postinst b/packaging/debian/stretch/debian/postinst new file mode 100755 index 0000000..c9d7550 --- /dev/null +++ b/packaging/debian/stretch/debian/postinst @@ -0,0 +1,10 @@ +#!/bin/sh + +# install printer (if not present yet) +if lpstat -a openhsr-connect > /dev/null 2>&1 /dev/null; then + echo "Printer openhsr-connect already installed" +else + echo "Adding printer openhsr-connect..." + lpadmin -p openhsr-connect -E -v openhsr-connect:/tmp -P /usr/share/ppd/openhsr-connect/Generic-PostScript_Printer-Postscript.ppd +fi + diff --git a/packaging/debian/stretch/debian/postrm b/packaging/debian/stretch/debian/postrm new file mode 100755 index 0000000..10f58b5 --- /dev/null +++ b/packaging/debian/stretch/debian/postrm @@ -0,0 +1,8 @@ +#!/bin/sh + +# Remove printer if installed +if lpstat -a openhsr-connect > /dev/null 2>&1 /dev/null; then + echo "Removing printer openhsr-connect..." + lpadmin -x openhsr-connect +fi + diff --git a/packaging/debian/stretch/debian/rules b/packaging/debian/stretch/debian/rules new file mode 100644 index 0000000..b1b7940 --- /dev/null +++ b/packaging/debian/stretch/debian/rules @@ -0,0 +1,26 @@ +#!/usr/bin/make -f +export PYBUILD_NAME=openhsr-connect +export PYBUILD_DISABLE_python3=test +export BACKEND_SCRIPT_DIR=debian/openhsr-connect/usr/lib/cups/backend/ +export BACKEND_SCRIPT=${BACKEND_SCRIPT_DIR}/openhsr-connect +export PPD_FILE_DIR=debian/openhsr-connect/usr/share/ppd/openhsr-connect/ +export PPD_FILE=${PPD_FILE_DIR}/Generic-PostScript_Printer-Postscript.ppd + +%: + dh $@ --with python3 --buildsystem=pybuild +override_dh_auto_install: + dh_auto_install + + # Add backend script + mkdir -p ${BACKEND_SCRIPT_DIR} + cp openhsr_connect/resources/openhsr-connect ${BACKEND_SCRIPT} + + # Add PPD + mkdir -p ${PPD_FILE_DIR} + cp openhsr_connect/resources/Generic-PostScript_Printer-Postscript.ppd ${PPD_FILE} +override_dh_fixperms: + dh_fixperms + + # Set specific permissions for cups backend script + chown root:root ${BACKEND_SCRIPT} + chmod 700 ${BACKEND_SCRIPT} diff --git a/packaging/debian/stretch/debian/source/format b/packaging/debian/stretch/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/packaging/debian/stretch/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/packaging/debian/stretch/distributions b/packaging/debian/stretch/distributions new file mode 100644 index 0000000..f438c7e --- /dev/null +++ b/packaging/debian/stretch/distributions @@ -0,0 +1,10 @@ +Origin: pool.openhsr.ch +Label: openHSR Debian Stretch Pool +Suite: stable +Codename: stretch +Version: 9.0 +Architectures: i386 amd64 source +Components: main +Description: openHSR Debian Stretch Pool +SignWith: 1957D46D + diff --git a/packaging/debian/stretch/gpg.conf b/packaging/debian/stretch/gpg.conf new file mode 100644 index 0000000..2aba022 --- /dev/null +++ b/packaging/debian/stretch/gpg.conf @@ -0,0 +1,81 @@ +################################################################## +## General configuration +################################################################## +## Use a agent to save user key +#use-agent + +################################################################## +## Key creation and signatures +################################################################## +## Don't disclose the version +no-emit-version + +## Don't add additional comments (may leak language, etc) +no-comments + +## include an unambiguous indicator of which key made a signature: +## (see http://thread.gmane.org/gmane.mail.notmuch.general/3721/focus=7234) +sig-notation issuer-fpr@notations.openpgp.fifthhorseman.net=%g + +################################################################## +## Keyserver +################################################################## +## Proxy settings +#keyserver hkps://hkps.pool.sks-keyservers.net hkp://qdigse2yzvuglcix.onion +#keyserver-options auto-key-retrieve + +## When creating a key, individuals may designate a specific keyserver to use to pull their keys from. +## The above option will disregard this designation and use the pool, which is useful because (1) it +## prevents someone from designating an insecure method for pulling their key and (2) if the server +## designated uses hkps, the refresh will fail because the ca-cert will not match, so the keys will +## never be refreshed. +keyserver-options no-honor-keyserver-url + +################################################################## +## Crypto +################################################################## +## list of personal digest preferences. When multiple digests are supported by +## all recipients, choose the strongest one +personal-cipher-preferences AES256 AES192 AES CAST5 +#TODO: We should already add Curve 25519, even if not implemented yet + +## Use SHA512 as digest +cert-digest-algo SHA512 + +## Our preferences if SHA512 is not possible +personal-digest-preferences SHA512 SHA384 SHA256 SHA224 + +## List our Crypto preferences +default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed + +################################################################## +## Display options +################################################################## +## We want to force UTF-8 everywhere +display-charset utf-8 + +## when outputting certificates, view user IDs distinctly from keys: +fixed-list-mode + +## when listing certificates, also list fingerprint. +with-fingerprint + +## long keyids are more collision-resistant than short keyids (it's trivial to make a key with any desired short keyid) +keyid-format 0xlong + +## You should always know at a glance which User IDs gpg thinks are legitimately bound to the keys in your keyring: +verify-options show-uid-validity +list-options show-uid-validity + +################################################################## +## Optional user settings +################################################################## +## Up to you whether you in comment it (remove the single # in front of +## it) or not. Disabled by default, because it causes too much complaints and +## confusion. + +## Don't include keyids that may disclose the sender or any other non-obvious keyids +## This may slow down decryption, as all private keys must be tried. +#throw-keyids + +################################################################# diff --git a/packaging/debian/stretch/pysmb_debian/changelog b/packaging/debian/stretch/pysmb_debian/changelog new file mode 100644 index 0000000..9f4de0e --- /dev/null +++ b/packaging/debian/stretch/pysmb_debian/changelog @@ -0,0 +1,5 @@ +python3-pysmb (PYSMB_VERSION) UNRELEASED; urgency=medium + + * PYSMB_VERSION Initial release. + + -- open\HSR Pool Thu, 16 Feb 2017 15:55:41 +0100 diff --git a/packaging/debian/stretch/pysmb_debian/compat b/packaging/debian/stretch/pysmb_debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/packaging/debian/stretch/pysmb_debian/compat @@ -0,0 +1 @@ +7 diff --git a/packaging/debian/stretch/pysmb_debian/control b/packaging/debian/stretch/pysmb_debian/control new file mode 100755 index 0000000..84aca1c --- /dev/null +++ b/packaging/debian/stretch/pysmb_debian/control @@ -0,0 +1,15 @@ +Source: python3-pysmb +Section: utils +Priority: optional +Maintainer: Michael Teo +Build-Depends: debhelper (>= 7), + python3-all (>= 3.4) +X-Python-Version: >= 3.4 +Standards-Version: 3.9.6 + +Package: python3-pysmb +Architecture: all +Section: python +Depends: ${misc:Depends}, ${python3:Depends} +Description: pysmb is an experimental SMB/CIFS + library written in Python to support file sharing between Windows and Linux machines diff --git a/packaging/debian/stretch/pysmb_debian/copyright b/packaging/debian/stretch/pysmb_debian/copyright new file mode 100644 index 0000000..e8b1757 --- /dev/null +++ b/packaging/debian/stretch/pysmb_debian/copyright @@ -0,0 +1,30 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: python3-pysmb +Upstream-Contact: Michael Teo +Source: https://github.com/miketeo/pysmb/ + +Files: * +Copyright: 2016-2017 Michael Teo +License: zlib/libpng + +License: zlib/libpng + Copyright (C) 2001-2015 Michael Teo + + This software is provided 'as-is', without any express or implied warranty. + In no event will the author be held liable for any damages arising from the + use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice cannot be removed or altered from any source distribution. + diff --git a/packaging/debian/stretch/pysmb_debian/rules b/packaging/debian/stretch/pysmb_debian/rules new file mode 100644 index 0000000..c5d8780 --- /dev/null +++ b/packaging/debian/stretch/pysmb_debian/rules @@ -0,0 +1,7 @@ +#!/usr/bin/make -f +export PYBUILD_NAME=python3-pysmb +export PYBUILD_DISABLE_python3=test + +%: + dh $@ --with python3 --buildsystem=pybuild + diff --git a/packaging/debian/stretch/pysmb_debian/source/format b/packaging/debian/stretch/pysmb_debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/packaging/debian/stretch/pysmb_debian/source/format @@ -0,0 +1 @@ +3.0 (native)