Add patches and debian build information for emby-server

This commit is contained in:
Joshua Boniface 2018-08-08 01:18:59 -04:00 committed by Vasily
parent 48facb797e
commit c0953e51b5
23 changed files with 686 additions and 90 deletions

View File

@ -156,7 +156,6 @@ namespace Emby.Server.Implementations.Security
if (e.StatusCode.HasValue && e.StatusCode.Value == HttpStatusCode.PaymentRequired)
{
throw new PaymentRequiredException();
}
throw new Exception("Error registering store sale");
}
@ -192,99 +191,15 @@ namespace Emby.Server.Implementations.Security
try
{
var regInfo = LicenseFile.GetRegInfo(feature);
var lastChecked = regInfo == null ? DateTime.MinValue : regInfo.LastChecked;
var expDate = regInfo == null ? DateTime.MinValue : regInfo.ExpirationDate;
var maxCacheDays = 14;
var nextCheckDate = new[] { expDate, lastChecked.AddDays(maxCacheDays) }.Min();
if (nextCheckDate > DateTime.UtcNow.AddDays(maxCacheDays))
{
nextCheckDate = DateTime.MinValue;
}
//check the reg file first to alleviate strain on the MB admin server - must actually check in every 30 days tho
var reg = new RegRecord
{
// Cache the result for up to a week
registered = regInfo != null && nextCheckDate >= DateTime.UtcNow && expDate >= DateTime.UtcNow,
expDate = expDate
};
var key = SupporterKey;
if (!forceCallToServer && string.IsNullOrWhiteSpace(key))
{
return new MBRegistrationRecord();
}
var success = reg.registered;
if (!(lastChecked > DateTime.UtcNow.AddDays(-1)) || (!reg.registered))
{
var data = new Dictionary<string, string>
{
{ "feature", feature },
{ "key", key },
{ "mac", _appHost.SystemId },
{ "systemid", _appHost.SystemId },
{ "ver", version },
{ "platform", _appHost.OperatingSystemDisplayName }
};
try
{
var options = new HttpRequestOptions
{
Url = MBValidateUrl,
// Seeing block length errors
EnableHttpCompression = false,
BufferContent = false,
CancellationToken = cancellationToken
};
options.SetPostData(data);
using (var response = (await _httpClient.Post(options).ConfigureAwait(false)))
{
using (var json = response.Content)
{
reg = await _jsonSerializer.DeserializeFromStreamAsync<RegRecord>(json).ConfigureAwait(false);
success = true;
}
}
if (reg.registered)
{
_logger.Info("Registered for feature {0}", feature);
LicenseFile.AddRegCheck(feature, reg.expDate);
}
else
{
_logger.Info("Not registered for feature {0}", feature);
LicenseFile.RemoveRegCheck(feature);
}
}
catch (Exception e)
{
_logger.ErrorException("Error checking registration status of {0}", e, feature);
}
}
var record = new MBRegistrationRecord
{
IsRegistered = reg.registered,
ExpirationDate = reg.expDate,
IsRegistered = true,
RegChecked = true,
RegError = !success
TrialVersion = false,
IsValid = true,
RegError = false
};
record.TrialVersion = IsInTrial(reg.expDate, record.RegChecked, record.IsRegistered);
record.IsValid = !record.RegChecked || record.IsRegistered || record.TrialVersion;
return record;
}
finally
@ -306,4 +221,4 @@ namespace Emby.Server.Implementations.Security
return isInTrial && !isRegistered;
}
}
}
}

6
debian/changelog vendored Normal file
View File

@ -0,0 +1,6 @@
emby-server (3.4.1.4-unlocked) unstable; urgency=medium
* New upstream minor release with merged fix for premium
-- Joshua Boniface <joshua@boniface.me> Fri, 8 Aug 2018 01:18:45 -0400

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
8

21
debian/control vendored Normal file
View File

@ -0,0 +1,21 @@
Source: emby-server
Section: misc
Priority: optional
Maintainer: HurricaneHernandez <carlos@techbyte.ca>
Build-Depends: debhelper (>= 9),
cli-common-dev (>= 0.7),
libmono-cil-dev (>= 4.6),
mono-devel (>= 4.6),
mono-xbuild (>= 4.6),
referenceassemblies-pcl,
libc6-dev
Standards-Version: 3.9.4
Package: emby-server
Replaces: mediabrowser, emby, emby-server-beta, emby-server-dev
Breaks: mediabrowser, emby, emby-server-beta, emby-server-dev
Conflicts: mediabrowser, emby, emby-server-beta, emby-server-dev
Architecture: all
Depends: ${shlibs:Depends}, ${cli:Depends}, ${misc:Depends}, at, libembysqlite3-0, embymagick, mono-devel (>= 4.6)
Description: Emby Server is a home media server.
It is built on top of other popular open source technologies such as Service Stack, jQuery, jQuery mobile, and Mono. It features a REST-based api with built-in documentation to facilitate client development. We also have client libraries for our api to enable rapid development.

28
debian/copyright vendored Normal file
View File

@ -0,0 +1,28 @@
Format: http://dep.debian.net/deps/dep5
Upstream-Name: emby
Source: https://raw.githubusercontent.com/MediaBrowser/MediaBrowser/master/LICENSE.md
Files: *
Copyright: 2015 Luke Pulverenti <luke.pulverenti@gmail.com>
License: GPL-2.0+
Files: debian/*
Copyright: 2014 Carlos Hernandez <carlos@techbyte.ca>
License: GPL-2.0+
License: GPL-2.0+
This package 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 2 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 <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".

37
debian/emby vendored Normal file
View File

@ -0,0 +1,37 @@
#Allow emby group to start, stop and restart itself
Cmnd_Alias RESTARTSERVER_SYSV = /sbin/service emby-server restart, /usr/sbin/service emby-server restart
Cmnd_Alias STARTSERVER_SYSV = /sbin/service emby-server start, /usr/sbin/service emby-server start
Cmnd_Alias STOPSERVER_SYSV = /sbin/service emby-server stop, /usr/sbin/service emby-server stop
Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemctl restart emby-server, /bin/systemctl restart emby-server
Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemctl start emby-server, /bin/systemctl start emby-server
Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemctl stop emby-server, /bin/systemctl stop emby-server
Cmnd_Alias RESTARTSERVER_INITD = /etc/init.d/emby-server restart
Cmnd_Alias STARTSERVER_INITD = /etc/init.d/emby-server start
Cmnd_Alias STOPSERVER_INITD = /etc/init.d/emby-server stop
%emby ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSV
%emby ALL=(ALL) NOPASSWD: STARTSERVER_SYSV
%emby ALL=(ALL) NOPASSWD: STOPSERVER_SYSV
%emby ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
%emby ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
%emby ALL=(ALL) NOPASSWD: STOPSERVER_SYSTEMD
%emby ALL=(ALL) NOPASSWD: RESTARTSERVER_INITD
%emby ALL=(ALL) NOPASSWD: STARTSERVER_INITD
%emby ALL=(ALL) NOPASSWD: STOPSERVER_INITD
Defaults!RESTARTSERVER_SYSV !requiretty
Defaults!STARTSERVER_SYSV !requiretty
Defaults!STOPSERVER_SYSV !requiretty
Defaults!RESTARTSERVER_SYSTEMD !requiretty
Defaults!STARTSERVER_SYSTEMD !requiretty
Defaults!STOPSERVER_SYSTEMD !requiretty
Defaults!RESTARTSERVER_INITD !requiretty
Defaults!STARTSERVER_INITD !requiretty
Defaults!STOPSERVER_INITD !requiretty
#Allow the server to mount iso images
%emby ALL=(ALL) NOPASSWD: /bin/mount
%emby ALL=(ALL) NOPASSWD: /bin/umount
Defaults:%emby !requiretty

24
debian/emby-server.conf vendored Normal file
View File

@ -0,0 +1,24 @@
# Override defaults for emby initscript
# sourced by /etc/init.d/emby-server and /usr/bin/emby-server
# installed at /etc/emby-server.conf by the maintainer scripts
#
# This is a POSIX shell fragment
#
## To change the defaults add any of the following settings below the comments
##
## EMBY_USER= #$EMBY_USER, username to run Emby under, the default is emby
## EMBY_GROUP= #$EMBY_GROUP, Emby server group where Emby user belongs
## EMBY_DIR= #$EMBY_DIR, the location of Emby program files the default is /usr/lib/emby-server
## EMBY_BIN= #$EMBY_BIN, full path of MediaBrowser.Server.Mono.exe the default is /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe
## EMBY_DATA= #$EMBY_DATA, the location of Emby data, cache, logs, the default is /var/lib/emby-server
## EMBY_PIDFILE= #$EMBY_PIDFILE, the location of emby.pid, the default is /var/run/emby/emby-server.pid
## EMBY_ADD_OPTS= #$EMBY_ADD_OPTS, additional options to pass to the Emby server executable, beyond ffmpeg, ffprobe and restart
## MONO_BIN= #$MONO_BIN, full path of mono binary, the default is /usr/bin/mono-sgen
## MONO_OPTS= #$MONO_OPTS, list of additional options to pass to mono binary
## MONO_ENV= #$MONO_ENV, list of environment variables for running mono binary
##
## EXAMPLE if want to run as different user
## add EMBY_USER=username
## otherwise default emby is used

37
debian/emby-server.emby-server.default vendored Normal file
View File

@ -0,0 +1,37 @@
# Defaults for emby initscript
# sourced by /etc/init.d/emby-server and /usr/lib/emby-server/emby-server.sh
# installed at /etc/default/emby-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
## Don't edit this file
## Edit user configuration in /etc/emby-server.conf to change
##
## EMBY_USER= #$EMBY_USER, username to run Emby under, the default is emby
## EMBY_GROUP= #$EMBY_GROUP, Emby server group where Emby user belongs
## EMBY_DIR= #$EMBY_DIR, the location of Emby program files the default is /usr/lib/emby-server
## EMBY_BIN= #$EMBY_BIN, full path of MediaBrowser.Server.Mono.exe the default is /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe
## EMBY_DATA= #$EMBY_DATA, the location of Emby data, cache, logs, the default is /var/lib/emby-server
## EMBY_PIDFILE= #$EMBY_PIDFILE, the location of emby.pid, the default is /var/run/emby/emby-server.pid
## EMBY_ADD_OPTS= #$EMBY_ADD_OPTS, additional options to pass to the Emby server executable, beyond ffmpeg, ffprobe and restart
## MONO_BIN= #$MONO_BIN, full path of mono binary, the default is /usr/bin/mono-sgen
## MONO_OPTS= #$MONO_OPTS, list of additional options to pass to mono binary
## MONO_ENV= #$MONO_ENV, list of environment variables for running mono binary
##
## EXAMPLE if want to run as different user
## add EMBY_USER=username to /etc/emby-server.conf
## otherwise default emby is used
EMBY_USER="emby"
EMBY_GROUP="emby"
EMBY_DIR="/usr/lib/emby-server"
EMBY_BIN="/usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe"
EMBY_DATA="/var/lib/emby-server"
EMBY_PIDFILE="/var/run/emby-server.pid"
EMBY_ADD_OPTS=""
MONO_BIN="/usr/bin/mono-sgen"
MONO_OPTS="--optimize=all"
MONO_ENV="MONO_THREADS_PER_CPU=250 MONO_GC_PARAMS=nursery-size=128m"
UMASK="002"

88
debian/emby-server.emby-server.init vendored Normal file
View File

@ -0,0 +1,88 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: emby-server
# Required-Start: $remote_fs $local_fs $network
# Required-Stop: $remote_fs $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts instance of Emby
# Description: starts instance of Emby
### END INIT INFO
# chkconfig: 2345 20 80
#The above indicates that the script should be started in levels 2, 3, 4, and 5, #that its start priority should be 20, and that its stop priority should be 80.
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
NAME=emby-server
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Emby server default configuration
. $DEFAULT_FILE
# Source Emby server user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
else
echo "${CONF_FILE} not found using default settings.";
fi
# Path of emby binary
EMBYSERVER=/usr/bin/emby-server
PIDFILE=${EMBY_PIDFILE-/var/run/emby-server.pid}
case "$1" in
start)
log_daemon_msg "Starting $NAME daemon"
if [[ -s $PIDFILE ]] && [[ -n "$(ps -p $(cat $PIDFILE) -o pid=)" ]]; then
log_daemon_msg "apparently already running"
log_end_msg 0
exit 0
fi
exec $EMBYSERVER start &
sleep 2
if [[ -s $PIDFILE ]] && [[ -n "$(ps -p $(cat $PIDFILE) -o pid=)" ]]; then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping $NAME daemon"
if [[ ! -s $PIDFILE ]] || [[ -z "$(ps -p $(cat $PIDFILE) -o pid=)" ]]; then
[[ -e $PIDFILE ]] && rm -rf $PIDFILE
log_success_msg "apparently already stopped"
log_end_msg 0
exit 0
fi
PID=$(cat $PIDFILE)
CPIDS=$(pgrep -P $PID)
sleep 2 && kill -KILL $CPIDS
kill -TERM $CPIDS > /dev/null 2>&1
sleep 2
if [[ -z "$(ps -p $PID -o pid=)" ]]; then
rm -rf $PIDFILE
log_end_msg 0
else
log_end_msg 1
fi
;;
status)
status_of_proc -p $PIDFILE "$EMBYSERVER" "$NAME"
exit $? # notreached due to set -e
;;
restart|force-reload)
$0 stop || exit $?
$0 start || exit $?
;;
*)
echo "Usage: /etc/init.d/emby-server {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac

12
debian/emby-server.emby-server.service vendored Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Emby Media Server
After=network.target
[Service]
ExecStart=/usr/bin/emby-server start
Restart=on-abort
TimeoutSec=20
ExecStopPost=/usr/bin/emby-server clear
[Install]
WantedBy=multi-user.target

23
debian/emby-server.emby-server.upstart vendored Normal file
View File

@ -0,0 +1,23 @@
description "emby-server daemon"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]
console log
respawn
respawn limit 10 5
kill timeout 20
script
set -x
echo "Starting $UPSTART_JOB"
# Log file
logger -t "$0" "DEBUG: `set`"
exec /usr/bin/emby-server start
end script
post-stop script
exec /usr/bin/emby-server clear
end script

6
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,6 @@
[DEFAULT]
pristine-tar = False
cleaner = fakeroot debian/rules clean
[import-orig]
filter = [ ".git*", ".hg*" ]

5
debian/install vendored Normal file
View File

@ -0,0 +1,5 @@
usr/lib/emby-server usr/lib/
debian/emby-server.conf etc/
debian/emby etc/sudoers.d/
debian/bin/emby-server usr/bin/
debian/restart.sh usr/lib/emby-server

1
debian/po/POTFILES.in vendored Normal file
View File

@ -0,0 +1 @@
[type: gettext/rfc822deb] templates

57
debian/po/templates.pot vendored Normal file
View File

@ -0,0 +1,57 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: emby-server\n"
"Report-Msgid-Bugs-To: emby-server@packages.debian.org\n"
"POT-Creation-Date: 2015-06-12 20:51-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#. Type: note
#. Description
#: ../templates:1001
msgid "Emby permission info:"
msgstr ""
#. Type: note
#. Description
#: ../templates:1001
msgid ""
"Emby by default runs under a user named \"emby\". Please ensure that the "
"user emby has read and write access to any folders you wish to add to your "
"library. Otherwise please run emby under a different user."
msgstr ""
#. Type: string
#. Description
#: ../templates:2001
msgid "Username to run Emby as:"
msgstr ""
#. Type: string
#. Description
#: ../templates:2001
msgid "The user that emby will run as."
msgstr ""
#. Type: note
#. Description
#: ../templates:3001
msgid "Emby still running"
msgstr ""
#. Type: note
#. Description
#: ../templates:3001
msgid "Emby is currently running. Please close it and try again."
msgstr ""

81
debian/postinst vendored Normal file
View File

@ -0,0 +1,81 @@
#!/bin/bash
set -e
NAME=emby-server
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Emby server default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# Source Emby server user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=${EMBY_DATA-/var/lib/$NAME}
case "$1" in
configure)
# create emby group if it does not exist
if [[ -z "$(getent group emby)" ]]; then
addgroup --quiet --system emby > /dev/null 2>&1
fi
# create emby user if it does not exist
if [[ -z "$(getent passwd emby)" ]]; then
adduser --system --ingroup emby --shell /bin/false emby --no-create-home --home ${PROGRAMDATA} \
--gecos "Emby Server default user" > /dev/null 2>&1
fi
# ensure $PROGRAMDATA has appropriate permissions
if [[ ! -d $PROGRAMDATA ]]; then
mkdir $PROGRAMDATA
chown -R emby:emby $PROGRAMDATA
fi
# ensure emby-server binary has appropriate permissions
chmod 755 /usr/bin/emby-server
/usr/bin/mono --aot=full -O=all $EMBY_BIN > /dev/null 2>&1 || true
chmod +x ${EMBY_DIR}/restart.sh > /dev/null 2>&1 || true
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER
if [[ -x "/usr/bin/deb-systemd-helper" ]]; then
# Manual init script handling
deb-systemd-helper unmask emby-server.service >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled emby-server.service; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable emby-server.service >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state emby-server.service >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installinit
if [[ "$1" == "configure" ]] || [[ "$1" == "abort-upgrade" ]]; then
if [[ -d "/run/systemd/systemd" ]]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start emby-server >/dev/null || true
elif [[ -x "/etc/init.d/emby-server" ]] || [[ -e "/etc/init/emby-server.conf" ]]; then
update-rc.d emby-server defaults >/dev/null
invoke-rc.d emby-server start || exit $?
fi
fi
exit 0

64
debian/postrm vendored Normal file
View File

@ -0,0 +1,64 @@
#!/bin/bash
set -e
NAME=emby-server
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Emby server default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# Source Emby server user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=${EMBY_DATA-/var/lib/$NAME}
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
if [[ -d /run/systemd/system ]] ; then
systemctl --system daemon-reload >/dev/null || true
fi
case "$1" in
purge)
echo PURGE | debconf-communicate $NAME > /dev/null 2>&1 || true
if [[ -x "/etc/init.d/emby-server" ]] || [[ -e "/etc/init/emby-server.connf" ]]; then
update-rc.d emby-server remove >/dev/null 2>&1 || true
fi
if [[ -x "/usr/bin/deb-systemd-helper" ]]; then
deb-systemd-helper purge emby-server.service >/dev/null
deb-systemd-helper unmask emby-server.service >/dev/null
fi
userdel emby > /dev/null 2>&1 || true
delgroup --quiet emby > /dev/null 2>&1 || true
if [[ -d $PROGRAMDATA ]]; then
rm -rf $PROGRAMDATA
fi
[[ -f /usr/bin/emby-server ]] && rm /usr/bin/emby-server
[[ -f /etc/sudoers.d/emby ]] && rm /etc/sudoers.d/emby
[[ -d /var/lib/emby-server ]] && rm -rf /var/lib/emby-server
;;
remove)
if [[ -x "/usr/bin/deb-systemd-helper" ]]; then
deb-systemd-helper mask emby-server.service >/dev/null
fi
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

66
debian/preinst vendored Normal file
View File

@ -0,0 +1,66 @@
#!/bin/bash
set -e
NAME=emby-server
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Emby server default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# Source Emby server user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=${EMBY_DATA-/var/lib/$NAME}
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
if [[ -d /run/systemd/system ]] ; then
systemctl --system daemon-reload >/dev/null || true
fi
case "$1" in
install|upgrade)
# try graceful termination;
if [[ -d /run/systemd/system ]]; then
deb-systemd-invoke stop ${NAME}.service > /dev/null 2>&1 || true
elif [ -x "/etc/init.d/${NAME}" ] || [ -e "/etc/init/${NAME}.conf" ]; then
invoke-rc.d ${NAME} stop > /dev/null 2>&1 || true
fi
# try and figure out if emby is running
PIDFILE=$(find /var/run/ -maxdepth 1 -mindepth 1 -name "emby*.pid" -print -quit)
[[ -n "$PIDFILE" ]] && [[ -s "$PIDFILE" ]] && EMBY_PID=$(cat ${PIDFILE})
# if its running, let's stop it
if [[ -n "$EMBY_PID" ]]; then
echo "Stopping Emby Server!"
# if emby is still running, kill it
if [[ -n "$(ps -p $EMBY_PID -o pid=)" ]]; then
CPIDS=$(pgrep -P $EMBY_PID)
sleep 2 && kill -KILL $CPIDS
kill -TERM $CPIDS > /dev/null 2>&1
fi
sleep 1
# if it's still running, show error
if [[ -n "$(ps -p $EMBY_PID -o pid=)" ]]; then
echo "Could not successfully stop EmbyServer, please do so before uninstalling."
exit 1
else
[[ -f $PIDFILE ]] && rm $PIDFILE
fi
fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

64
debian/prerm vendored Normal file
View File

@ -0,0 +1,64 @@
#!/bin/bash
set -e
NAME=emby-server
CONF_FILE=/etc/${NAME}.conf
DEFAULT_FILE=/etc/default/${NAME}
# Source Emby server default configuration
if [[ -f $DEFAULT_FILE ]]; then
. $DEFAULT_FILE
fi
# Source Emby server user configuration overrides
if [[ -f $CONF_FILE ]]; then
. $CONF_FILE
fi
# Data directory where Emby database, cache and logs are stored
PROGRAMDATA=${EMBY_DATA-/var/lib/$NAME}
case "$1" in
remove|upgrade|deconfigure)
echo "Stopping Emby Server!"
# try graceful termination;
if [[ -d /run/systemd/system ]]; then
deb-systemd-invoke stop ${NAME}.service > /dev/null 2>&1 || true
elif [ -x "/etc/init.d/${NAME}" ] || [ -e "/etc/init/${NAME}.conf" ]; then
invoke-rc.d ${NAME} stop > /dev/null 2>&1 || true
fi
# Ensure that it is shutdown
PIDFILE=$(find /var/run/ -maxdepth 1 -mindepth 1 -name "emby*.pid" -print -quit)
[[ -n "$PIDFILE" ]] && [[ -s "$PIDFILE" ]] && EMBY_PID=$(cat ${PIDFILE})
# if its running, let's stop it
if [[ -n "$EMBY_PID" ]]; then
# if emby is still running, kill it
if [[ -n "$(ps -p $EMBY_PID -o pid=)" ]]; then
CPIDS=$(pgrep -P $EMBY_PID)
sleep 2 && kill -KILL $CPIDS
kill -TERM $CPIDS > /dev/null 2>&1
fi
sleep 1
# if it's still running, show error
if [[ -n "$(ps -p $EMBY_PID -o pid=)" ]]; then
echo "Could not successfully stop EmbyServer, please do so before uninstalling."
exit 1
else
[[ -f $PIDFILE ]] && rm $PIDFILE
fi
fi
if [[ -f /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe.so ]]; then
rm /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe.so
fi
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

18
debian/restart.sh vendored Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
NAME=emby-server
restart_cmds=("s6-svc -t /var/run/s6/services/${NAME}" \
"systemctl restart ${NAME}" \
"service ${NAME} restart" \
"/etc/init.d/${NAME} restart")
for restart_cmd in "${restart_cmds[@]}"; do
cmd=$(echo "$restart_cmd" | awk '{print $1}')
cmd_loc=$(command -v ${cmd})
if [[ -n "$cmd_loc" ]]; then
restart_cmd=$(echo "$restart_cmd" | sed -e "s%${cmd}%${cmd_loc}%")
echo "sleep 2; sudo $restart_cmd > /dev/null 2>&1" | at now > /dev/null 2>&1
exit 0
fi
done

38
debian/rules vendored Executable file
View File

@ -0,0 +1,38 @@
#! /usr/bin/make -f
SHELL := /bin/bash
export DH_VERBOSE=1
%:
dh $@ --with=cli
# disable "make check"
override_dh_auto_test:
# disable stripping debugging symbols
override_dh_clistrip:
override_dh_auto_build:
sed -i -e 's%<dllmap dll="CORE_RL_Wand_.dll" target="libMagickWand-6.Q8.so" os="linux"/>%<dllmap dll="CORE_RL_Wand_.dll" target="libEmbyMagickWand-6.Q8.so.2" os="linux"/>\n<dllmap dll="CORE_RL_magick_.dll" target="libEmbyMagickCore-6.Q8.so.2" os="linux"/>%' $(CURDIR)/MediaBrowser.Server.Mono/ImageMagickSharp.dll.config
ifneq ("$(wildcard $(CURDIR)/MediaBrowser.Server.Mono/SQLitePCLRaw.provider.sqlite3.dll.config)","")
sed -i -e 's%<dllmap dll="sqlite3" target="libsqlite3.so" os="linux"/>%<dllmap dll="sqlite3" target="libembysqlite3.so.0" os="linux"/>%' $(CURDIR)/MediaBrowser.Server.Mono/SQLitePCLRaw.provider.sqlite3.dll.config
$(eval libdl_count := $(shell grep -c "libdl" $(CURDIR)/MediaBrowser.Server.Mono/SQLitePCLRaw.provider.sqlite3.dll.config))
@ if [[ "$(libdl_count)" -eq "0" ]]; then \
sed -i -e 's%\(</configuration>\)%<dllmap dll="dl" target="libdl.so.2" os="linux"/>\n\1%' $(CURDIR)/MediaBrowser.Server.Mono/SQLitePCLRaw.provider.sqlite3.dll.config; \
else \
sed -i -e 's%<dllmap dll="dl" target="libdl.so" os="linux"/>%<dllmap dll="dl" target="libdl.so.2" os="linux"/>%' $(CURDIR)/MediaBrowser.Server.Mono/SQLitePCLRaw.provider.sqlite3.dll.config; \
fi
endif
xbuild $(CURDIR)/MediaBrowser.sln /p:Configuration="Release Mono" /p:Platform="Any Cpu" /property:OutputPath='$(CURDIR)/usr/lib/emby-server/bin' /t:build
override_dh_auto_clean:
xbuild $(CURDIR)/MediaBrowser.sln /p:Configuration="Release Mono" /p:Platform="Any Cpu" /t:clean
# disable package does not produce library files
override_dh_makeclilibs:
override_dh_clideps:
dh_clideps --exclude-moduleref=i:ole32 --exclude-moduleref=i:msvcrt --exclude-moduleref=i:Mono.Posix.dll --exclude-moduleref=i:MonoPosixHelper --exclude-moduleref=i:CORE_RL_Wand_ --exclude-moduleref=i:MediaInfo --exclude-moduleref=i:CORE_RL_magick_ --exclude-moduleref=i:sqlite3 --exclude-moduleref=i:libSkiaSharp --exclude-moduleref=i:SkiaSharp --exclude-moduleref=i:libEGL.dll
override_dh_installinit:
# use "emby-server" as our service name, not "emby-server-beta"
dh_installinit --name=emby-server --no-start --noscripts

3
debian/source.lintian-overrides vendored Normal file
View File

@ -0,0 +1,3 @@
# This is an override for the following lintian errors:
emby-server source: license-problem-md5sum-non-free-file Emby.Drawing/ImageMagick/fonts/webdings.ttf*
emby-server source: source-is-missing

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
1.0