aboutsummaryrefslogtreecommitdiff
path: root/subsonic-installer-rpm
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2012-07-02 21:24:02 -0700
committerScott Jackson <daneren2005@gmail.com>2012-07-02 21:24:02 -0700
commita1a18f77a50804e0127dfa4b0f5240c49c541184 (patch)
tree19a38880afe505beddb5590379a8134d7730a277 /subsonic-installer-rpm
parentb61d787706979e7e20f4c3c4f93c1f129d92273f (diff)
downloaddsub-a1a18f77a50804e0127dfa4b0f5240c49c541184.tar.gz
dsub-a1a18f77a50804e0127dfa4b0f5240c49c541184.tar.bz2
dsub-a1a18f77a50804e0127dfa4b0f5240c49c541184.zip
Initial Commit
Diffstat (limited to 'subsonic-installer-rpm')
-rw-r--r--subsonic-installer-rpm/pom.xml120
-rw-r--r--subsonic-installer-rpm/src/etc/init.d/subsonic104
-rw-r--r--subsonic-installer-rpm/src/etc/sysconfig/subsonic25
-rw-r--r--subsonic-installer-rpm/src/subsonic.spec72
4 files changed, 321 insertions, 0 deletions
diff --git a/subsonic-installer-rpm/pom.xml b/subsonic-installer-rpm/pom.xml
new file mode 100644
index 00000000..de019f8c
--- /dev/null
+++ b/subsonic-installer-rpm/pom.xml
@@ -0,0 +1,120 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>net.sourceforge.subsonic</groupId>
+ <artifactId>subsonic-installer-rpm</artifactId>
+ <packaging>pom</packaging>
+ <name>Subsonic Installer for RPM</name>
+
+ <parent>
+ <groupId>net.sourceforge.subsonic</groupId>
+ <artifactId>subsonic</artifactId>
+ <version>4.7.beta2</version>
+ </parent>
+
+ <profiles>
+
+ <profile>
+ <id>linux</id>
+ <activation>
+ <os>
+ <family>linux</family>
+ </os>
+ </activation>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <doCheck>false</doCheck>
+ <doUpdate>false</doUpdate>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>rpm</id>
+ <phase>compile</phase>
+ <configuration>
+ <target>
+ <echo>Creating RPM package...</echo>
+
+ <copy file="${basedir}/src/subsonic.spec"
+ todir="${project.build.directory}/rpm/SPECS">
+ <filterset>
+ <filter token="VERSION" value="${project.version}"/>
+ <filter token="BUILD_NUMBER" value="${buildNumber}"/>
+ </filterset>
+ </copy>
+
+ <!--Remove ".beta" suffix from version tag.-->
+ <replace file="${project.build.directory}/rpm/SPECS/subsonic.spec">
+ <replacetoken>.beta1</replacetoken>
+ <replacetoken>.beta2</replacetoken>
+ <replacetoken>.beta3</replacetoken>
+ <replacetoken>.beta4</replacetoken>
+ </replace>
+
+ <copy file="${basedir}/src/etc/init.d/subsonic"
+ todir="${project.build.directory}/rpm/buildroot/etc/init.d"/>
+ <copy file="${basedir}/src/etc/sysconfig/subsonic"
+ todir="${project.build.directory}/rpm/buildroot/etc/sysconfig"/>
+ <copy file="../subsonic-booter/src/main/script/subsonic.sh"
+ todir="${project.build.directory}/rpm/buildroot/usr/share/subsonic"/>
+ <copy file="../subsonic-booter/target/subsonic-booter-jar-with-dependencies.jar"
+ todir="${project.build.directory}/rpm/buildroot/usr/share/subsonic"/>
+ <copy file="../subsonic-main/target/subsonic.war"
+ todir="${project.build.directory}/rpm/buildroot/usr/share/subsonic"/>
+ <copy file="../subsonic-transcode/linux/ffmpeg"
+ todir="${project.build.directory}/rpm/buildroot/var/subsonic/transcode"/>
+ <copy file="../subsonic-transcode/linux/lame"
+ todir="${project.build.directory}/rpm/buildroot/var/subsonic/transcode"/>
+
+ <exec executable="rpmbuild">
+ <arg value="-bb"/>
+ <arg value="--buildroot"/>
+ <arg value="${project.build.directory}/rpm/buildroot"/>
+ <arg value="--define"/>
+ <arg value="_topdir ${project.build.directory}/rpm"/>
+ <arg value="--target"/>
+ <arg value="i386"/>
+ <arg value="${project.build.directory}/rpm/SPECS/subsonic.spec"/>
+ </exec>
+
+ <copy tofile="${project.build.directory}/subsonic-${project.version}.rpm">
+ <fileset dir="${project.build.directory}/rpm/RPMS/i386">
+ <include name="*.rpm"/>
+ </fileset>
+ </copy>
+
+ <exec executable="rpmlint">
+ <arg value="${project.build.directory}/subsonic-${project.version}.rpm"/>
+ </exec>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/subsonic-installer-rpm/src/etc/init.d/subsonic b/subsonic-installer-rpm/src/etc/init.d/subsonic
new file mode 100644
index 00000000..8c17ea44
--- /dev/null
+++ b/subsonic-installer-rpm/src/etc/init.d/subsonic
@@ -0,0 +1,104 @@
+#!/bin/bash
+#
+# subsonic This shell script takes care of starting and stopping Subsonic
+#
+# chkconfig: - 80 20
+#
+### BEGIN INIT INFO
+# Provides: subsonic
+# Required-Start: $network $syslog
+# Required-Stop: $network $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Subsonic daemon
+# Description: Starts the Subsonic daemon. Subsonic is a web-based
+# music streamer, jukebox and Podcast receiver.
+# See http://subsonic.org for more details.
+### END INIT INFO
+
+# Author: Sindre Mehus <sindre@activeobjects.no>
+
+# To change the startup parameters of Subsonic, modify the service
+# configuration file /etc/sysconfig/subsonic rather than this file.
+[ -r /etc/sysconfig/subsonic ] && . /etc/sysconfig/subsonic
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="Subsonic Daemon"
+NAME=subsonic
+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/subsonic ] && chown -R $SUBSONIC_USER /var/subsonic
+ [ -e /tmp/subsonic ] && chown -R $SUBSONIC_USER /tmp/subsonic
+
+ 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
+
+:
diff --git a/subsonic-installer-rpm/src/etc/sysconfig/subsonic b/subsonic-installer-rpm/src/etc/sysconfig/subsonic
new file mode 100644
index 00000000..b082bd6a
--- /dev/null
+++ b/subsonic-installer-rpm/src/etc/sysconfig/subsonic
@@ -0,0 +1,25 @@
+#
+# This is the configuration file for the Subsonic service
+# (/etc/init.d/subsonic)
+#
+# To change the startup parameters of Subsonic, modify
+# the SUBSONIC_ARGS variable below.
+#
+# Type "subsonic --help" on the command line to read an
+# explanation of the different options.
+#
+# For example, to specify that Subsonic 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 Subsonic 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
diff --git a/subsonic-installer-rpm/src/subsonic.spec b/subsonic-installer-rpm/src/subsonic.spec
new file mode 100644
index 00000000..c8e0c9dd
--- /dev/null
+++ b/subsonic-installer-rpm/src/subsonic.spec
@@ -0,0 +1,72 @@
+Name: subsonic
+Version: @VERSION@
+Release: @BUILD_NUMBER@
+Summary: A web-based music streamer, jukebox and Podcast receiver
+
+Group: Applications/Multimedia
+License: GPLv3
+URL: http://subsonic.org
+
+%description
+Subsonic 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 Subsonic.
+
+Subsonic can be found at http://subsonic.org
+
+%files
+%defattr(644,root,root,755)
+/usr/share/subsonic/subsonic-booter-jar-with-dependencies.jar
+/usr/share/subsonic/subsonic.war
+%attr(755,root,root) /usr/share/subsonic/subsonic.sh
+%attr(755,root,root) /etc/init.d/subsonic
+%attr(755,root,root) /var/subsonic/transcode/ffmpeg
+%attr(755,root,root) /var/subsonic/transcode/lame
+%config(noreplace) /etc/sysconfig/subsonic
+
+%pre
+# Stop Subsonic service.
+if [ -e /etc/init.d/subsonic ]; then
+ service subsonic stop
+fi
+
+exit 0
+
+%post
+ln -sf /usr/share/subsonic/subsonic.sh /usr/bin/subsonic
+chmod 750 /var/subsonic
+
+# Clear jetty cache.
+rm -rf /var/subsonic/jetty
+
+# For SELinux: Set security context
+chcon -t java_exec_t /etc/init.d/subsonic 2>/dev/null
+
+# Configure and start Subsonic service.
+chkconfig --add subsonic
+service subsonic start
+
+exit 0
+
+%preun
+# Only do it if uninstalling, not upgrading.
+if [ $1 = 0 ] ; then
+
+ # Stop the service.
+ [ -e /etc/init.d/subsonic ] && service subsonic stop
+
+ # Remove symlink.
+ rm -f /usr/bin/subsonic
+
+ # Remove startup scripts.
+ chkconfig --del subsonic
+
+fi
+
+exit 0
+