From 05667e53765583fc40eb2f9eedf32511fd528f8a Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Thu, 9 Feb 2017 22:19:01 -0800 Subject: Add debian packaging --- debian/changelog | 5 +++++ debian/compat | 1 + debian/control | 20 ++++++++++++++++++++ debian/copyright | 28 ++++++++++++++++++++++++++++ debian/mavigator-bin.manpages | 1 + debian/mavigator.1 | 29 +++++++++++++++++++++++++++++ debian/mavigator.postinst | 41 +++++++++++++++++++++++++++++++++++++++++ debian/mavigator.service | 11 +++++++++++ debian/rules | 43 +++++++++++++++++++++++++++++++++++++++++++ debian/run | 3 +++ debian/source/format | 1 + mavigator-server/build.sbt | 9 +++++++++ project/plugins.sbt | 2 ++ 13 files changed, 194 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/mavigator-bin.manpages create mode 100644 debian/mavigator.1 create mode 100644 debian/mavigator.postinst create mode 100644 debian/mavigator.service create mode 100755 debian/rules create mode 100755 debian/run create mode 100644 debian/source/format diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..f78231e --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +mavigator (0.0.1-3) unstable; urgency=medium + + * Initial release + + -- Jakob Odersky Thu, 09 Feb 2017 16:21:34 -0800 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..34d1a30 --- /dev/null +++ b/debian/control @@ -0,0 +1,20 @@ +Source: mavigator +Section: java +Priority: optional +Maintainer: Jakob Odersky +Build-Depends: debhelper (>= 9), dh-systemd, openjdk-8-jdk-headless | jdk8, sbt +Standards-Version: 3.9.8 +Vcs-Git: https://github.com/project-condor/mavigator.git +Vcs-Browser: https://github.com/project-condor/mavigator.git + +Package: mavigator-bin +Architecture: all +Depends: ${misc:Depends}, openjdk-8-jre-headless | java8-runtime-headless +Description: Virtual cockpit for a UAV + View telemetry from a drone in a modern web interface. + +Package: mavigator +Architecture: all +Depends: ${misc:Depends}, mavigator-bin, adduser +Description: Virtual cockpit for a UAV (with systemd init scripts) + View telemetry from a drone in a modern web interface. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..065fa79 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,28 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: mavigator +Source: https://github.com/project-condor/mavigator + +Files: * +Copyright: 2017 Jakob Odersky +License: GPL-3.0+ + +Files: debian/* +Copyright: 2017 Jakob Odersky +License: GPL-3.0+ + +License: GPL-3.0+ + This program 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 package 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. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". \ No newline at end of file diff --git a/debian/mavigator-bin.manpages b/debian/mavigator-bin.manpages new file mode 100644 index 0000000..c18a6d1 --- /dev/null +++ b/debian/mavigator-bin.manpages @@ -0,0 +1 @@ +debian/mavigator.1 \ No newline at end of file diff --git a/debian/mavigator.1 b/debian/mavigator.1 new file mode 100644 index 0000000..1279cb0 --- /dev/null +++ b/debian/mavigator.1 @@ -0,0 +1,29 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" (C) Copyright 2017 Jakob Odersky , +.\" +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH mavigator 1 "February 9 2017" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +mavigator \- virtual cockpit for drones +.SH SYNOPSIS +.B mavigator +.SH DESCRIPTION +Start a webserver for visualizing telemetry data from drones speaking the MAVLink protocol. +.PP +.SH FILES +.B /etc/mavigator/application.conf +Configuration file. diff --git a/debian/mavigator.postinst b/debian/mavigator.postinst new file mode 100644 index 0000000..12708d9 --- /dev/null +++ b/debian/mavigator.postinst @@ -0,0 +1,41 @@ +#!/bin/sh +# postinst script for mavigator +# +# 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 + + +case "$1" in + configure) + adduser --system --disabled-password --disabled-login --home /var/empty \ + --no-create-home --quiet --force-badname --group mavigator + ;; + + 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/mavigator.service b/debian/mavigator.service new file mode 100644 index 0000000..e2c99b9 --- /dev/null +++ b/debian/mavigator.service @@ -0,0 +1,11 @@ +[Unit] +Description=mavigator daemon + +[Service] +ExecStart=/usr/bin/mavigator +Restart=on-failure +User=mavigator +Group=mavigator + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..8d27048 --- /dev/null +++ b/debian/rules @@ -0,0 +1,43 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + +override_dh_auto_build: + dh_auto_build + sbt mavigator-server/assembly + +override_dh_auto_install: + dh_auto_install + mkdir -p debian/mavigator-bin/usr/share/mavigator/lib + cp mavigator-server/target/scala-2.12/mavigator.jar debian/mavigator-bin/usr/share/mavigator/lib/ + + mkdir -p debian/mavigator-bin/etc/mavigator + cp mavigator-server/src/main/resources/reference.conf debian/mavigator-bin/etc/mavigator/application.conf + + mkdir -p debian/mavigator-bin/usr/bin + cp debian/run debian/mavigator-bin/usr/bin/mavigator + chmod 0755 debian/mavigator-bin/usr/bin/mavigator + +override_dh_installinit: + dh_systemd_enable -pmavigator --name=mavigator mavigator.service + dh_installinit -pmavigator --no-start --noscripts + +%: + dh $@ --with=systemd + +# dh_make generated override targets +# This is example for Cmake (See https://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) + diff --git a/debian/run b/debian/run new file mode 100755 index 0000000..b178bd9 --- /dev/null +++ b/debian/run @@ -0,0 +1,3 @@ +#!/bin/sh + +exec java -cp /usr/share/mavigator/lib/mavigator.jar:/etc/mavigator/application.conf mavigator.Main diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/mavigator-server/build.sbt b/mavigator-server/build.sbt index ee3ffd8..d8826c0 100644 --- a/mavigator-server/build.sbt +++ b/mavigator-server/build.sbt @@ -17,6 +17,15 @@ fork in run := true connectInput in run := true cancelable in Global := true +import sbtassembly.AssemblyPlugin.defaultShellScript +//assemblyOption in assembly := (assemblyOption in assembly).value.copy(prependShellScript = Some(defaultShellScript)) +assemblyJarName in assembly := "mavigator.jar" + +assemblyMergeStrategy in assembly := { + case "JS_DEPENDENCIES" => MergeStrategy.discard + case other => (assemblyMergeStrategy in assembly).value(other) +} + /* * Deployment configuration diff --git a/project/plugins.sbt b/project/plugins.sbt index 6b0ac7c..581c6bf 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -32,3 +32,5 @@ addSbtPlugin("com.github.jodersky" % "sbt-mavlink" % "0.8.0") //addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.3.3") addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.4.0") + +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3") -- cgit v1.2.3