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

Adds debian package and install instructions #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion packaging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected] | sudo apt-key add -
Expand Down
46 changes: 46 additions & 0 deletions packaging/debian/stretch/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
33 changes: 33 additions & 0 deletions packaging/debian/stretch/build.bash
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions packaging/debian/stretch/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
openhsr-connect (CONNECT_VERSION) UNRELEASED; urgency=medium

* CONNECT_VERSION Initial release.

-- open\HSR Pool <[email protected]> Thu, 16 Feb 2017 15:55:41 +0100
1 change: 1 addition & 0 deletions packaging/debian/stretch/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7
17 changes: 17 additions & 0 deletions packaging/debian/stretch/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Source: openhsr-connect
Section: utils
Priority: optional
Maintainer: open\HSR Pool <[email protected]>
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 ;)


21 changes: 21 additions & 0 deletions packaging/debian/stretch/debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: openhsr-connect
Upstream-Contact: open\HSR <[email protected]>
Source: https://github.com/openhsr/connect/

Files: *
Copyright: 2016-2017 open\HSR <[email protected]>
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

10 changes: 10 additions & 0 deletions packaging/debian/stretch/debian/postinst
Original file line number Diff line number Diff line change
@@ -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

8 changes: 8 additions & 0 deletions packaging/debian/stretch/debian/postrm
Original file line number Diff line number Diff line change
@@ -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

26 changes: 26 additions & 0 deletions packaging/debian/stretch/debian/rules
Original file line number Diff line number Diff line change
@@ -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}
1 change: 1 addition & 0 deletions packaging/debian/stretch/debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
10 changes: 10 additions & 0 deletions packaging/debian/stretch/distributions
Original file line number Diff line number Diff line change
@@ -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

81 changes: 81 additions & 0 deletions packaging/debian/stretch/gpg.conf
Original file line number Diff line number Diff line change
@@ -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 [email protected]=%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

#################################################################
5 changes: 5 additions & 0 deletions packaging/debian/stretch/pysmb_debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
python3-pysmb (PYSMB_VERSION) UNRELEASED; urgency=medium

* PYSMB_VERSION Initial release.

-- open\HSR Pool <[email protected]> Thu, 16 Feb 2017 15:55:41 +0100
1 change: 1 addition & 0 deletions packaging/debian/stretch/pysmb_debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7
15 changes: 15 additions & 0 deletions packaging/debian/stretch/pysmb_debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Source: python3-pysmb
Section: utils
Priority: optional
Maintainer: Michael Teo <[email protected]>
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
30 changes: 30 additions & 0 deletions packaging/debian/stretch/pysmb_debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: python3-pysmb
Upstream-Contact: Michael Teo <[email protected]>
Source: https://github.com/miketeo/pysmb/

Files: *
Copyright: 2016-2017 Michael Teo <[email protected]>
License: zlib/libpng

License: zlib/libpng
Copyright (C) 2001-2015 Michael Teo <miketeo (a) miketeo.net>

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.

7 changes: 7 additions & 0 deletions packaging/debian/stretch/pysmb_debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/make -f
export PYBUILD_NAME=python3-pysmb
export PYBUILD_DISABLE_python3=test

%:
dh $@ --with python3 --buildsystem=pybuild

1 change: 1 addition & 0 deletions packaging/debian/stretch/pysmb_debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)