# $Id: smeserver-teamspeak-server.spec,v 1.3 2008/05/14 13:49:54 slords Exp $ # Authority: cool34000 # Name: Sylvain Gomez %define name smeserver-teamspeak-server %define version 2.0.24.1 %define release 2 %define rpmver 4.0.4 Summary: Teamspeak is a VOIP server for on-line gaming Name: %{name} Version: %{version} Release: %{release}%{?dist} License: Freeware Group: VOIP Source: %{name}-%{version}.tar.gz URL: http://www.goteamspeak.com/ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot BuildArchitectures: noarch BuildRequires: e-smith-devtools Requires: e-smith-base, e-smith-release >= 7 %description This RPM is an unofficial addon for the SME Server 7.x. TeamSpeak is a software for quality voice communication via the Internet. After installation open your webbrowser at http://your_e-smith-server_name:14534 %changelog * Mon May 12 2008 Sylvain Gomez [2.0.24.1-2] Website added - New php website added (tsweb) * Sun Nov 11 2007 Sylvain Gomez [2.0.24.1-1] New version - Based on latest version + updated server_linux - RPM structure fix - Uninstall sections fixed * Sun Jun 17 2007 Sylvain Gomez [2.0.20.1-2] Fixing bugs - Added teamspeak UserPassword - Removed useless lines - Few fix to teamspeak service file - Now deleting temporary files * Wed Jun 6 2007 Sylvain Gomez [2.0.20.1-1] Original version %prep %setup %build # Default DB parameters DEFAULTS1=root/etc/e-smith/db/configuration/defaults/teamspeak DEFAULTS2=root/etc/e-smith/db/accounts/defaults/teamspeak DEFAULTS3=root/etc/e-smith/db/configuration/defaults/tsweb DEFAULTS4=root/etc/e-smith/db/accounts/defaults/tsweb mkdir -p $DEFAULTS1 mkdir -p $DEFAULTS2 mkdir -p $DEFAULTS3 mkdir -p $DEFAULTS4 echo "public" > $DEFAULTS1/access echo "enabled" > $DEFAULTS1/status echo "service" > $DEFAULTS1/type echo "8767" > $DEFAULTS1/UDPPort echo "reserved" > $DEFAULTS2/type echo "url" > $DEFAULTS3/type echo "reserved" > $DEFAULTS4/type %install rm -rf $RPM_BUILD_ROOT (cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) rm -f %{name}-%{version}-filelist /sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist %clean rm -rf $RPM_BUILD_ROOT %pre %post # Adding teamspeak to SME's db /etc/e-smith/events/actions/initialize-default-databases echo " " # Variables SRVNAME=$(/sbin/e-smith/db configuration get SystemName) DOMAINNAME=$(/sbin/e-smith/db configuration get DomainName) TSPASS=$(/sbin/e-smith/db configuration getprop teamspeak UserPassword) echo "Decompressing files..." tar -xjf /usr/share/doc/teamspeak-server-2.0.24.1/Sources/ts2_server_rc2_202319.tar.bz2 -C /opt mv -f /opt/tss2_rc2 /opt/teamspeak cp -f /usr/share/doc/teamspeak-server-2.0.24.1/Sources/server_linux /opt/teamspeak/ rm -f /opt/teamspeak/teamspeak2-server_startscript echo "Creating user teamspeak..." useradd -M -c 'TeamSpeak Server' -d /opt/teamspeak teamspeak -s /bin/bash -p '$TSPASS' chown -R root:teamspeak /opt/teamspeak chmod 770 /opt/teamspeak chmod 750 /opt/teamspeak/server_linux chmod 750 /opt/teamspeak/sqlite_sql echo "Creating service..." ln -f -s /etc/rc.d/init.d/e-smith-service /etc/rc7.d/S98teamspeak ln -f -s /etc/rc.d/init.d/e-smith-service /etc/rc6.d/K98teamspeak /sbin/e-smith/signal-event remoteaccess-update echo "Restarting Apache..." /sbin/e-smith/expand-template /opt/tsweb/config.php /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf /etc/rc7.d/S86httpd-e-smith sigusr1 echo "Starting the daemon..." /etc/rc7.d/S98teamspeak start echo " " echo "-------------------------------------------------------------------------------" echo "TeamSpeak Server installation finished." echo "You can access to the configuration page at: http://$SRVNAME:14534" /etc/rc7.d/S98teamspeak passwords echo " " echo "The web page for teamspeak webusers: http://$DOMAINNAME/tsweb" echo " " /sbin/e-smith/config show teamspeak echo "-------------------------------------------------------------------------------" %preun if [ $1 = 0 ] ; then DIR=/opt/teamspeak # Stopping TS service if needed... if [ -e $DIR/tsserver2.pid ]; then echo -n "Stopping the TeamSpeak Voice server..." if ( kill -TERM `cat $DIR/tsserver2.pid` ); then for c in $(seq 1 300); do if [ -e $DIR/tsserver2.pid ]; then echo -n "." sleep 1 fi done fi if [ -e $DIR/tsserver2.pid ]; then echo "server does not shutdown cleanly - killing" kill -KILL `cat $DIR/tsserver2.pid` rm $DIR/tsserver2.pid sleep 5 else echo "done" fi fi fi %postun if [ $1 = 0 ] ; then echo "Unregistering and deleting service..." rm -f /etc/rc.d/rc7.d/S98teamspeak rm -f /etc/rc.d/rc6.d/K98teamspeak /sbin/e-smith/config delete teamspeak /sbin/e-smith/config delete tsweb /sbin/e-smith/signal-event remoteaccess-update echo "Restarting Apache..." /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf /etc/rc7.d/S86httpd-e-smith sigusr1 echo "Deleting user teamspeak..." userdel teamspeak echo "Deleting install directories..." rm -rf /opt/teamspeak rm -rf /opt/tsweb fi %files -f %{name}-%{version}-filelist %defattr(-,root,root)