Subsonic-->Libresonic regex
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# libresonic This shell script takes care of starting and stopping Libresonic
|
||||
#
|
||||
# chkconfig: - 80 20
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: libresonic
|
||||
# Required-Start: $network $syslog
|
||||
# Required-Stop: $network $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Libresonic daemon
|
||||
# Description: Starts the Libresonic daemon. Libresonic is a web-based
|
||||
# music streamer, jukebox and Podcast receiver.
|
||||
# See http://libresonic.org for more details.
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Sindre Mehus <sindre@activeobjects.no>
|
||||
|
||||
# To change the startup parameters of Libresonic, modify the service
|
||||
# configuration file /etc/sysconfig/libresonic rather than this file.
|
||||
[ -r /etc/sysconfig/libresonic ] && . /etc/sysconfig/libresonic
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="Libresonic Daemon"
|
||||
NAME=libresonic
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
LOCKFILE=/var/lock/subsys/$NAME
|
||||
DAEMON=/usr/bin/$NAME
|
||||
DAEMON_ARGS="--pidfile=$PIDFILE $SUBSONIC_ARGS"
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
# Exit if the package is not installed.
|
||||
[ -x "$DAEMON" ] || exit 0
|
||||
|
||||
# Run as root if SUBSONIC_USER is not set.
|
||||
[ "$SUBSONIC_USER" = "" ] && SUBSONIC_USER=root
|
||||
|
||||
# Source function library.
|
||||
. /etc/init.d/functions
|
||||
|
||||
#
|
||||
# Function that starts the daemon/service
|
||||
#
|
||||
do_start()
|
||||
{
|
||||
# Check if daemon is already running.
|
||||
if [ -e $PIDFILE ]
|
||||
then
|
||||
ps -p $(cat $PIDFILE) > /dev/null
|
||||
[ "$?" = 0 ] && return 1
|
||||
fi
|
||||
|
||||
touch $PIDFILE
|
||||
chown $SUBSONIC_USER $PIDFILE
|
||||
[ -e /var/libresonic ] && chown -R $SUBSONIC_USER /var/libresonic
|
||||
[ -e /tmp/libresonic ] && chown -R $SUBSONIC_USER /tmp/libresonic
|
||||
|
||||
echo $"Starting $NAME ..."
|
||||
su -c "$DAEMON $DAEMON_ARGS" $SUBSONIC_USER
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch $LOCKFILE
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service
|
||||
#
|
||||
do_stop()
|
||||
{
|
||||
# Check if pidfile exists
|
||||
[ ! -e $PIDFILE ] && return 1
|
||||
|
||||
echo -n $"Stopping $NAME ..."
|
||||
killproc -p $PIDFILE $DAEMON
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
do_start
|
||||
;;
|
||||
stop)
|
||||
do_stop
|
||||
;;
|
||||
status)
|
||||
status -p $PIDFILE "$NAME"
|
||||
;;
|
||||
restart|force-reload)
|
||||
do_stop
|
||||
do_start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
:
|
||||
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# This is the configuration file for the Libresonic service
|
||||
# (/etc/init.d/libresonic)
|
||||
#
|
||||
# To change the startup parameters of Libresonic, modify
|
||||
# the SUBSONIC_ARGS variable below.
|
||||
#
|
||||
# Type "/usr/share/libresonic/libresonic.sh --help" on the command line to read an
|
||||
# explanation of the different options.
|
||||
#
|
||||
# For example, to specify that Libresonic should use port 80 (for http)
|
||||
# and 443 (for https), and use a Java memory heap size of 200 MB, use
|
||||
# the following:
|
||||
#
|
||||
# SUBSONIC_ARGS="--port=80 --https-port=443 --max-memory=200"
|
||||
|
||||
SUBSONIC_ARGS="--max-memory=150"
|
||||
|
||||
|
||||
# The user which should run the Libresonic process. Default "root".
|
||||
# Note that non-root users are by default not allowed to use ports
|
||||
# below 1024. Also make sure to grant the user write permissions in
|
||||
# the music directories, otherwise changing album art and tags will fail.
|
||||
|
||||
SUBSONIC_USER=root
|
||||
@@ -0,0 +1,78 @@
|
||||
Name: libresonic
|
||||
Version: @VERSION@
|
||||
Release: @BUILD_NUMBER@
|
||||
Summary: A web-based music streamer, jukebox and Podcast receiver
|
||||
|
||||
Group: Applications/Multimedia
|
||||
License: GPLv3
|
||||
URL: http://libresonic.org
|
||||
|
||||
%description
|
||||
Libresonic is a web-based music streamer, jukebox and Podcast receiver,
|
||||
providing access to your music collection wherever you are. Use it
|
||||
to share your music with friends, or to listen to your music while away
|
||||
from home.
|
||||
|
||||
Apps for Android, iPhone and Windows Phone are also available.
|
||||
|
||||
Java 1.6 or higher is required to run Libresonic.
|
||||
|
||||
Libresonic can be found at http://libresonic.org
|
||||
|
||||
%files
|
||||
%defattr(644,root,root,755)
|
||||
/usr/share/libresonic/libresonic-booter-jar-with-dependencies.jar
|
||||
/usr/share/libresonic/libresonic.war
|
||||
%attr(755,root,root) /usr/share/libresonic/libresonic.sh
|
||||
%attr(755,root,root) /etc/init.d/libresonic
|
||||
%attr(755,root,root) /var/libresonic/transcode/ffmpeg
|
||||
%attr(755,root,root) /var/libresonic/transcode/lame
|
||||
%config(noreplace) /etc/sysconfig/libresonic
|
||||
|
||||
%pre
|
||||
# Stop Libresonic service.
|
||||
if [ -e /etc/init.d/libresonic ]; then
|
||||
service libresonic stop
|
||||
fi
|
||||
|
||||
# Backup database.
|
||||
if [ -e /var/libresonic/db ]; then
|
||||
rm -rf /var/libresonic/db.backup
|
||||
cp -R /var/libresonic/db /var/libresonic/db.backup
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
%post
|
||||
ln -sf /usr/share/libresonic/libresonic.sh /usr/bin/libresonic
|
||||
chmod 750 /var/libresonic
|
||||
|
||||
# Clear jetty cache.
|
||||
rm -rf /var/libresonic/jetty
|
||||
|
||||
# For SELinux: Set security context
|
||||
chcon -t java_exec_t /etc/init.d/libresonic 2>/dev/null
|
||||
|
||||
# Configure and start Libresonic service.
|
||||
chkconfig --add libresonic
|
||||
service libresonic start
|
||||
|
||||
exit 0
|
||||
|
||||
%preun
|
||||
# Only do it if uninstalling, not upgrading.
|
||||
if [ $1 = 0 ] ; then
|
||||
|
||||
# Stop the service.
|
||||
[ -e /etc/init.d/libresonic ] && service libresonic stop
|
||||
|
||||
# Remove symlink.
|
||||
rm -f /usr/bin/libresonic
|
||||
|
||||
# Remove startup scripts.
|
||||
chkconfig --del libresonic
|
||||
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user