From abee27880cb70cbc755a1bba0f5f0721159bfff8 Mon Sep 17 00:00:00 2001 From: Rudolf J Streif Date: Fri, 19 Feb 2016 19:00:24 +0000 Subject: Added template for Raspbian build and packaging Added raspbian_template directory which contains the Debian build and packaging for Raspbian. Added raspbian_package target to makefile. Signed-off-by: Rudolf J Streif --- Makefile | 25 +++++++++++ raspbian_template/README.Debian | 10 +++++ raspbian_template/README.source | 6 +++ raspbian_template/changelog | 5 +++ raspbian_template/compat | 1 + raspbian_template/control | 13 ++++++ raspbian_template/copyright | 11 +++++ raspbian_template/docs | 0 raspbian_template/rules | 21 +++++++++ raspbian_template/rvi.init | 70 ++++++++++++++++++++++++++++++ raspbian_template/rvi.lintian-overrides | 3 ++ raspbian_template/rvi.postinst | 45 +++++++++++++++++++ raspbian_template/rvi.postrm | 40 +++++++++++++++++ raspbian_template/rvi.service | 18 ++++++++ raspbian_template/source/format | 1 + raspbian_template/source/lintian-overrides | 1 + 16 files changed, 270 insertions(+) create mode 100644 raspbian_template/README.Debian create mode 100644 raspbian_template/README.source create mode 100644 raspbian_template/changelog create mode 100644 raspbian_template/compat create mode 100644 raspbian_template/control create mode 100644 raspbian_template/copyright create mode 100644 raspbian_template/docs create mode 100755 raspbian_template/rules create mode 100755 raspbian_template/rvi.init create mode 100644 raspbian_template/rvi.lintian-overrides create mode 100644 raspbian_template/rvi.postinst create mode 100644 raspbian_template/rvi.postrm create mode 100644 raspbian_template/rvi.service create mode 100644 raspbian_template/source/format create mode 100644 raspbian_template/source/lintian-overrides diff --git a/Makefile b/Makefile index 1c594cc..72bbb4b 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,9 @@ ubuntu_clean: debian_clean: rm -rf ./debian_build +raspbian_clean: + rm -rf ./raspbian_build + rpm_clean: rm -rf ./rpm/BUILD/* \ ./rpm/BUILDROOT/* \ @@ -137,6 +140,28 @@ debian_package: clean debian_clean escript (cd ./debian_build/rvi-$(VERSION); debuild -uc -us) +# Create a raspbian package +raspbian_package: clean raspbian_clean escript + install --mode=0755 -d ./raspbian_build + +# Pack up all relevant files, and debian/, necessary for a build. +# Add rvi-$(VERSION) at the beginning of each file so +# that they get packed up into a correctly named subdirectory +# + tar czf ./raspbian_build/rvi_$(VERSION).orig.tar.gz \ + --exclude-vcs --transform="s|^|./rvi-$(VERSION)/|" \ + $(SRC_LIST) \ + raspbian_template + rm -rf raspbian/missing-sources +# Unpack the created tar file + (cd ./raspbian_build; tar xf rvi_$(VERSION).orig.tar.gz) +# Move the debian template to be the debian package + mv ./raspbian_build/rvi-$(VERSION)/raspbian_template ./raspbian_build/rvi-$(VERSION)/debian + install -d -m 0755 ./raspbian_build/rvi-$(VERSION)/debian/missing-sources +# Descend into the unpacked directory and build. + (cd ./raspbian_build/rvi-$(VERSION); debuild --prepend-path /usr/local/bin -uc -us) + + rpm: rpmclean rpm_tarball rpmbuild --define "_topdir $$PWD/rpm" -ba rpm/SPECS/rvi-$(VERSION).spec diff --git a/raspbian_template/README.Debian b/raspbian_template/README.Debian new file mode 100644 index 0000000..f80c683 --- /dev/null +++ b/raspbian_template/README.Debian @@ -0,0 +1,10 @@ +rvi for Debian +-------------- + +Will rely on existing Erlang installation to work. + +We will copy out the Erlang VM BEAM files to /opt/rvi and the configuration files to /etc/opt/rvi + +/opt/rvi/rvi.sh is the main control program. + + -- Magnus Feuer Fri, 27 Nov 2015 15:34:39 -0800 diff --git a/raspbian_template/README.source b/raspbian_template/README.source new file mode 100644 index 0000000..9e3c927 --- /dev/null +++ b/raspbian_template/README.source @@ -0,0 +1,6 @@ +rvi for Debian +-------------- + + + -- Magnus Feuer Fri, 27 Nov 2015 15:34:39 -0800 + diff --git a/raspbian_template/changelog b/raspbian_template/changelog new file mode 100644 index 0000000..3d774a4 --- /dev/null +++ b/raspbian_template/changelog @@ -0,0 +1,5 @@ +rvi (0.5.0-1) jessie; urgency=low + + * Initial release + + -- Magnus Feuer Fri, 27 Nov 2015 15:34:39 -0800 diff --git a/raspbian_template/compat b/raspbian_template/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/raspbian_template/compat @@ -0,0 +1 @@ +9 diff --git a/raspbian_template/control b/raspbian_template/control new file mode 100644 index 0000000..0fb7b83 --- /dev/null +++ b/raspbian_template/control @@ -0,0 +1,13 @@ +Source: rvi +Section: net +Priority: optional +Maintainer: Magnus Feuer +Build-Depends: debhelper (>= 9), libbluetooth-dev +Standards-Version: 3.9.6 +Homepage: https://github.com/PDXostc/rvi_core + +Package: rvi +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, bluez, erlang (>= 1:18.2), python-jsonrpclib (>= 0.1.3-1), python (>= 2.7.9-1) +Description: Remote Vehicle Interaction + GENIVI Remote Vehicle Interaction Core diff --git a/raspbian_template/copyright b/raspbian_template/copyright new file mode 100644 index 0000000..89597cf --- /dev/null +++ b/raspbian_template/copyright @@ -0,0 +1,11 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: rvi +Source: http://github.com/PDXostc/rvi_core + +Files: * +Copyright: Copyright 2014,2015,2016 Jaguar Land Rover +License: MPL-2.0 + This program is licensed under the terms and conditions of the + Mozilla Public License, version 2.0. The full text of the + Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ + diff --git a/raspbian_template/docs b/raspbian_template/docs new file mode 100644 index 0000000..e69de29 diff --git a/raspbian_template/rules b/raspbian_template/rules new file mode 100755 index 0000000..b6b8c0a --- /dev/null +++ b/raspbian_template/rules @@ -0,0 +1,21 @@ +#!/usr/bin/make -f +# -*- makefile --* + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +%: + dh $@ + +override_dh_auto_install: + ./scripts/rvi_install \ + -s ./debian/rvi \ + -k priv/keys/insecure_device_key.pem \ + -r priv/certificates/insecure_root_cert.crt \ + -d priv/certificates/insecure_device_cert.crt \ + -c priv/credentials/insecure_credential.jwt \ + -l ./debian/rvi/var/log/rvi ./debian/rvi/usr/lib/rvi_core +# Copy out rvi_ctl to /usr/bin + install -D -m 0755 ./debian/rvi/usr/lib/rvi_core/rvi_ctl ./debian/rvi/usr/bin/rvi_ctl +# Install default config + install -D -m 0644 ./priv/config/rvi_ubuntu.config ./debian/rvi/etc/rvi/rvi.config diff --git a/raspbian_template/rvi.init b/raspbian_template/rvi.init new file mode 100755 index 0000000..9cd4e59 --- /dev/null +++ b/raspbian_template/rvi.init @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Copyright (C) 2014, Jaguar Land Rover +# +# This program is licensed under the terms and conditions of the +# Mozilla Public License, version 2.0. The full text of the +# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ +# +# +# Init.d script to start and stop an RVI system installed +# through an RPM. +# +### BEGIN INIT INFO +# Provides: rvi +# Required-Start: $network $syslog $remote_fs +# Required-Stop: $network $syslog $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start/Stop RVI node at boot time +# Description: Manage Remote Vehicle Interaction Node run state. +### END INIT INFO + +export PATH="/bin/:/usr/bin:/sbin:/usr/sbin" +export HOME=/usr/lib/rvi_core +. /lib/lsb/init-functions + +set -e + +case "$1" in + start) + log_daemon_msg "Starting Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl -c /etc/rvi/rvi.config start; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl stop; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + restart) + log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl restart; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + force-reload) + log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl restart; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + *) + log_action_msg "Usage: /etc/init.d/rvi {start|stop|restart}" + exit 1 +esac + +exit 0 + diff --git a/raspbian_template/rvi.lintian-overrides b/raspbian_template/rvi.lintian-overrides new file mode 100644 index 0000000..c307106 --- /dev/null +++ b/raspbian_template/rvi.lintian-overrides @@ -0,0 +1,3 @@ +executable-not-elf-or-script +missing-dep-for-interpreter +binary-without-manpage \ No newline at end of file diff --git a/raspbian_template/rvi.postinst b/raspbian_template/rvi.postinst new file mode 100644 index 0000000..10c11fe --- /dev/null +++ b/raspbian_template/rvi.postinst @@ -0,0 +1,45 @@ +#!/bin/sh +# postinst script for rvi +# +# 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 http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +# source debconf library +. /usr/share/debconf/confmodule + +case "$1" in + + configure) + # Set up our config + cat /proc/sys/kernel/random/uuid > /etc/rvi/device_id + echo "RVI Device ID set to $(cat /etc/rvi/device_id) in /etc/rvi/device_id" + #DEBHELPER# + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + exit 0 + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; + +esac + +db_stop + +exit 0 diff --git a/raspbian_template/rvi.postrm b/raspbian_template/rvi.postrm new file mode 100644 index 0000000..a0c5d5b --- /dev/null +++ b/raspbian_template/rvi.postrm @@ -0,0 +1,40 @@ +#!/bin/sh +# postrm script for rvi +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +# source debconf library +. /usr/share/debconf/confmodule + +case "$1" in + + remove|purge|upgrde|disappear) + rm -f /etc/init.d/rvi + #DEBHELPER# + ;; + + *) + exit 0 + ;; + + +esac + +db_stop + +exit 0 diff --git a/raspbian_template/rvi.service b/raspbian_template/rvi.service new file mode 100644 index 0000000..d9ae979 --- /dev/null +++ b/raspbian_template/rvi.service @@ -0,0 +1,18 @@ +# systemd(8) setup for Debian + +[Unit] +Description=Remote Vehicle Interaction Service +Wants=network-online.target + +[Service] +Environment="HOME=/usr/lib/rvi_core" +Type=forking +StandardOutput=journal +StandardError=journal +ExecStart=/usr/bin/rvi_ctl -c /etc/rvi/rvi.config start +ExecStop=/usr/bin/rvi_ctl stop +GuessMainPID=yes +RemainAfterExit=yes + +[Install] +WantedBy=graphical.target multi-user.target diff --git a/raspbian_template/source/format b/raspbian_template/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/raspbian_template/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/raspbian_template/source/lintian-overrides b/raspbian_template/source/lintian-overrides new file mode 100644 index 0000000..463abe9 --- /dev/null +++ b/raspbian_template/source/lintian-overrides @@ -0,0 +1 @@ +source-is-missing -- cgit v1.2.1