From 861d67c2d370864b4375b3b1fb6bc683aa35b75b Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Sat, 16 Feb 2019 09:48:24 +0000 Subject: [PATCH] Many fixes to the packaging --- debian/.gitignore | 1 + debian/compat | 2 +- debian/control | 5 +-- debian/rules | 5 +++ debian/sapphire-remote.docs | 1 + debian/sapphire-remote.install | 7 ++++ debian/sapphire-remote.postinst | 59 +++++++++++++++++++++++++++++++++ debian/sapphire-remote.service | 2 ++ 8 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 debian/sapphire-remote.docs create mode 100644 debian/sapphire-remote.install create mode 100644 debian/sapphire-remote.postinst diff --git a/debian/.gitignore b/debian/.gitignore index 033aa4a..c577787 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -1,4 +1,5 @@ *.log *.substvars +*.debhelper sapphire-remote-dkms/ sapphire-remote/ diff --git a/debian/compat b/debian/compat index 7f8f011..ec63514 100755 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +9 diff --git a/debian/control b/debian/control index ac8ac30..83afb51 100755 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: sapphire-remote-dkms Section: misc Priority: optional Maintainer: Dynamic Kernel Modules Support Team -Build-Depends: debhelper (>= 7), dkms, gawk +Build-Depends: debhelper (>= 7), dkms, gawk, dh-exec Standards-Version: 3.8.1 Package: sapphire-remote-dkms @@ -12,5 +12,6 @@ Description: sapphire-remote driver in DKMS format. Package: sapphire-remote Architecture: all -Depends: sapphire-remote-dkms, ${misc:Depends} +Pre-Depends: sapphire-remote-dkms +Depends: gawk, ${misc:Depends} Description: sapphire-remote tools diff --git a/debian/rules b/debian/rules index 82e59b2..f4639f4 100755 --- a/debian/rules +++ b/debian/rules @@ -33,6 +33,11 @@ install: build dh_testroot dh_prep dh_installdirs + dh_install + dh_installinit + dh_systemd_enable + dh_installdocs + dh_installchangelogs $(MAKE) DESTDIR=$(CURDIR)/debian/$(DEB_NAME)-dkms NAME=$(NAME) VERSION=$(VERSION) install binary-arch: build install diff --git a/debian/sapphire-remote.docs b/debian/sapphire-remote.docs new file mode 100644 index 0000000..5586e4f --- /dev/null +++ b/debian/sapphire-remote.docs @@ -0,0 +1 @@ +sapphire-remote-7.1/README.txt diff --git a/debian/sapphire-remote.install b/debian/sapphire-remote.install new file mode 100644 index 0000000..b7c1799 --- /dev/null +++ b/debian/sapphire-remote.install @@ -0,0 +1,7 @@ +#!/usr/bin/dh-exec +sapphire-remote-7.1/extract_keydefs.sh => /usr/lib/sapphire-remote +sapphire-remote-7.1/sapphire_keymap.sh.part1 => /usr/lib/sapphire-remote +sapphire-remote-7.1/sapphire_keymap.sh.part3 => /usr/lib/sapphire-remote +sapphire-remote-7.1/sapphire_startup.sh => /usr/lib/sapphire-remote +sapphire-remote-7.1/keymap.default => /etc/sapphire.keymap + diff --git a/debian/sapphire-remote.postinst b/debian/sapphire-remote.postinst new file mode 100644 index 0000000..d133f03 --- /dev/null +++ b/debian/sapphire-remote.postinst @@ -0,0 +1,59 @@ +#!/bin/sh +# postinst script for sapphire-remote +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +NAME=sapphire-remote +PACKAGE_NAME=$NAME +DEB_NAME=$(echo $PACKAGE_NAME | sed 's,_,-,') +MODNAME=/usr/src/${NAME}-7.1/sapphire +KEYMAP_SCRIPT=/usr/lib/${NAME}/sapphire_keymap.sh +EXTRACT_KEYDEFS=extract_keydefs.sh + +pkg_configure () { + if [ -e /usr/include/linux/input-event-codes.h ] + then + INPUT_H=/usr/include/linux/input-event-codes.h + else + INPUT_H=/usr/include/linux/input.h + fi + + /usr/lib/${NAME}/${EXTRACT_KEYDEFS} ${INPUT_H} ${MODNAME}.h | cat ${KEYMAP_SCRIPT}.part1 - ${KEYMAP_SCRIPT}.part3 > ${KEYMAP_SCRIPT} + chmod 0755 ${KEYMAP_SCRIPT} +} + + +case "$1" in + configure) + pkg_configure + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/sapphire-remote.service b/debian/sapphire-remote.service index b528d7b..ed48ae0 100644 --- a/debian/sapphire-remote.service +++ b/debian/sapphire-remote.service @@ -2,7 +2,9 @@ Description=Sapphire HID driver [Service] +Type=oneshot ExecStartPre=/usr/lib/sapphire-remote/sapphire_keymap.sh +ExecStart=/usr/lib/sapphire-remote/sapphire_startup.sh [Install] WantedBy=multi-user.target -- 2.30.2