Add debian packaging

This commit is contained in:
Sam Morris 2016-02-22 20:45:55 +00:00
parent 6bea261d68
commit 56713c8875
16 changed files with 263 additions and 1 deletions

View file

@ -4,7 +4,7 @@ mumbledj: main.go commands.go parseconfig.go strings.go service.go youtube_dl.go
go get github.com/karmakaze/goop go get github.com/karmakaze/goop
rm -rf Goopfile.lock rm -rf Goopfile.lock
goop install goop install
goop go build goop go build -o mumbledj
clean: clean:
rm -f mumbledj* rm -f mumbledj*

2
debian/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/changelog
/*.debhelper.log

21
debian/README.Debian vendored Normal file
View file

@ -0,0 +1,21 @@
mumbledj
========
You must configure your YouTube and/or SoundCloud API keys by editing
/etc/mumbledj.gcfg, as described in /usr/share/doc/mumbledj/README.md.gz.
If you want to launch mumbledj with any command line arguments, the easiest
way is to create
/etc/systemd/system/mumbledj.service.d/local.conf containing the following:
[Service]
ExecStart=
ExecStart=/usr/sbin/mumbledj -server=mumble.example.com -password=secret "-channel=The Lounge" -username=mumbledj
#Environment=PATH=/var/lib/mumbledj/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
And then run `systemctl daemon-reload` before starting the mumbledj service.
See systemd.unit(5) for more information on such “drop-in” configuration files.
If you prefer to install youtube-dl from pip, rather than from the Debian
repositories, then you can run `sudo -u mumbledj pip install youtube-dl
--user`, and then uncomment the definition of PATH above.

14
debian/README.source vendored Normal file
View file

@ -0,0 +1,14 @@
Debian packing of mumbledj
==========================
To build the package, first install the packages listed in the Build-Depends
field of the `debian/control` file; then run `debian/rules clean`; finally run
`dpkg-buildpackage`. `mumbledj_${version}_${arch}.deb` will then be created in
the parent directory.
After installing the deb, see the README.Debian file for information about
configuring mumbledj's launch arguments, API keys, etc.
Note that network access is required during the package build in order to
download dependencies; if building with pbuilder, you will have to set
USENETWORK=yes to prevent pbuilder from blocking network access.

1
debian/compat vendored Normal file
View file

@ -0,0 +1 @@
9

29
debian/control vendored Normal file
View file

@ -0,0 +1,29 @@
Source: mumbledj
Maintainer: Sam Morris <sam@robots.org.uk>
Section: sound
Priority: optional
Build-Depends:
ca-certificates,
debhelper (>= 9),
devscripts,
dh-systemd,
ffmpeg,
golang (>= 2:1.4),
git,
libopus-dev,
pkg-config,
Standards-Version: 3.9.7
Homepage: https://github.com/matthieugrieger/mumbledj/
Package: mumbledj
Architecture: any
Depends:
adduser,
${misc:Depends},
${shlibs:Depends},
Recommends:
youtube-dl,
Description: Mumble bot that plays music fetched from YouTube/SoundCloud
Note: this package is not intended for Debian upstream; it is suitable only
for end users who want to manage their mumbledj instance via the system package
manager.

27
debian/copyright vendored Normal file
View file

@ -0,0 +1,27 @@
The Debian packaging of mumbledj was prepared by Sam Morris <sam@robots.org.uk>.
Upstream sources were prepared as described by the 'get-orig-source' target in
debian/rules. It is licensed under the same terms as mumbledj itself, below.
The following statement was taken from the LICENSE file:
The MIT License (MIT)
Copyright (c) 2014, 2015 Matthieu Grieger
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

5
debian/dirs vendored Normal file
View file

@ -0,0 +1,5 @@
/etc
/usr/sbin
/var/cache/mumbledj/songs
/var/cache/mumbledj/youtube-dl
/var/lib/mumbledj

1
debian/docs vendored Normal file
View file

@ -0,0 +1 @@
README.md

1
debian/install vendored Normal file
View file

@ -0,0 +1 @@
mumbledj /usr/sbin

2
debian/links vendored Normal file
View file

@ -0,0 +1,2 @@
/etc/mumbledj.gcfg /var/lib/mumbledj/.mumbledj/config/mumbledj.gcfg
/var/cache/mumbledj/songs /var/lib/mumbledj/.mumbledj/songs

1
debian/manpages vendored Normal file
View file

@ -0,0 +1 @@
debian/mumbledj.1

76
debian/mumbledj.1 vendored Normal file
View file

@ -0,0 +1,76 @@
.TH MUMBLEDJ 1 2016-02-23
.SH NAME
mumbledj \- a Mumble bot that plays music fetched from YouTube videos and SoundCloud tracks
.SH SYNOPSIS
.SY mumbledj
.OP \-server address
.OP \-port port
.OP \-username username
.OP \-password password
.OP \-channel channel
.OP \-cert pemCert
.OP \-key pemKey
.OP \-accesstokens accesstokens
.OP \-insecure
.SY
.SY mumbledj
.OP \-help
.YS
.SY mumbledj
.OP \-version
.YS
.SH OPTIONS
.TP
.BI \-server \ address
.TQ
.BI \-port \ port
Address and port number for Mumble server; default to
.B localhost
and
.BR 64738 ,
respectively.
.TP
.B \-username
.I username
Defaults to
.B MumbleDJ
.TP
.B \-password
.I password
The password for the Mumble server. Defaults to no password.
.TP
.B \-channel
.I channel
Channel joined by the bot. Defaults to the root channel.
.TP
.B \-cert
.I pemCert
.TQ
.B \-key
.I pemKey
Paths to files containing a client certificate and key in PEM format.
If unspecified, no client certificate will be presented.
.TP
.B \-accesstokens
.I accesstokens
List of access tokens for channel authentication.
Separated by spaces--take care to use correct quoting when launching
.B mumbledj
from a shell.
.TP
.B \-insecure
Causes the bot to not check the server certificate.
Try using this if you have having connection issues.
.TP
.B \-help
Prints a summary of options and then exits.
.TP
.B \-version
Prints the version number and then exits.
.SH SEE ALSO
Full documentation can be found at
.UR https://github.com/matthieugrieger/mumbledj
.UE ,
a copy of which can be found at /usr/share/doc/mumbledj/README.md.gz.
The file README.Debian in the same directory contains notes about how to configure systemd to pass the options above when running
.BR mumbledj .

13
debian/mumbledj.service vendored Normal file
View file

@ -0,0 +1,13 @@
[Unit]
Documentation=man:mumbledj(1) file:/usr/share/doc/mumbledj/README.Debian file:/usr/share/doc/mumbledj/README.md.gz https://github.com/matthieugrieger/mumbledj
After=mumble-server.service
[Service]
Type=simple
Restart=always
ExecStart=/usr/sbin/mumbledj
User=mumbledj
Environment=XDG_CACHE_HOME=/var/cache/mumbledj
[Install]
WantedBy=multi-user.target

44
debian/postinst vendored Normal file
View file

@ -0,0 +1,44 @@
#!/bin/sh
# postinst script for mumbledj
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
adduser --system --quiet --home /var/lib/mumbledj --group mumbledj
chown -R mumbledj:mumbledj /var/lib/mumbledj /var/cache/mumbledj
chgrp mumbledj /etc/mumbledj.gcfg
;;
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
# vim: ts=4 sts=4 sw=4 et

25
debian/rules vendored Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/make -f
GOPATH := $(abspath $(CURDIR)/.go)
%:
dh $@ --with systemd
clean:
rm -f debian/changelog
EDITOR=true VISUAL=true dch --create --package=mumbledj --newversion=$$(git describe --tags) 'Auto-generated changelog entry; do not commit'
dh clean --with systemd
override_dh_auto_clean:
dh_auto_clean
rm -rf '$(GOPATH)' .vendor
override_dh_auto_build:
GOPATH='$(GOPATH)' PATH="$(GOPATH)/bin:$$PATH" make
override_dh_auto_install:
:
override_dh_install:
dh_install
install -m 0640 -T config.gcfg debian/mumbledj/etc/mumbledj.gcfg