Philosophical questions as to the installation layout on linux distros
ought to be directed to fletch, who, I believe, has changed his user
profile name to Mark Markis now that he's a logitech employee:
http://forums.slimdevices.com/member.php?userid=529
That said, I run a couple of different svn versions on my Fedora 12
box. The svn code is installed to, e.g.:
sbs7.5 embedded: /usr/share/squeezeboxserver_trunk/server
I keep the cache & prefs in:
/var/lib/squeezeboxserver_trunk
I keep the logs in:
/var/log/squeezeboxserver_trunk
For startup scripts, I install the "released version" and then copy the
/etc/init.d/squeezeboxserver startup script to
/etc/init.d/squeezeboxserver_trunk. I then modify that file so as to
reference slimserver.pl.
I also copy the /etc/sysconfig/squeezeboxserver file to
/etc/sysconfig/squeezeboxserver_trunk and modify it to point to the
correct paths.
Eventually, I automated this whole process of setting up a new svn
instance into a setup script. This script is for fedora, so you'd need
to tweak some of this for Ubuntu.
Code:
--------------------
#!/bin/sh
# Script to install the Squeezebox Server svn code to run as a service on
Fedora and other RH like distros.
#
# Prerequsite: squeezeboxserver must first be installed via yum or from a rpm.
#
# After running this script, you can (if you want or need to) safely
uninstall squeezeboxserver: 'yum erase squeezeboxserver' or 'rpm -e
squeezeboxserer'
user=`whoami`
if [ "$user" != "root" ]
then
echo 'Error: This script needs to be run with root cridentials,'
echo "either via # sudo $0"
echo 'or under su.'
exit
fi
# Uncomment the desired branch:
# Release (source of official 7.4 release)
#SOURCEREPO='http://svn.slimdevices.com/repos/slim/7.4/branches/7.4.0/server'
# Testing (a.k.a 7.4.x, source of nightly releases after official 7.4
release?)
#SOURCEREPO='http://svn.slimdevices.com/repos/slim/7.4/trunk/server'
# Unstable (source for future touch release?)
#SOURCEREPO='http://svn.slimdevices.com/repos/slim/7.5/trunk/server'
SOURCEREPO='http://svn.slimdevices.com/repos/slim/7.5/branches/embedded/server'
# Installation name: This will be the name of the installed service and
determines the names of many folders.
# You can change this to anything that strikes you as more descriptive.
E.g.: 'sbs75_trunk' or whathaveyou.
INSTNAME='squeezeboxserver_trunk'
# Destination. This is where the code gets downloaded to..
DESTREPO="/usr/share/$INSTNAME/server/"
function pause(){
read -p "$*"
}
if [ -e "/usr/share/$INSTNAME/server" ]
then
echo "$INSTNAME is already installed!"
echo "Updating $INSTNAME code.."
if [ ! -e "/var/log/$INSTNAME" ]
then
mkdir "/var/log/$INSTNAME"
fi
svn up "/usr/share/$INSTNAME" >> "/var/log/$INSTNAME/svn.log"
#exit 1
fi
echo ' '
echo "This script installs the Squeezebox Server svn code as the $INSTNAME
service."
echo ' '
echo "The source for the svn checkout will be $SOURCEREPO"
echo ' '
echo "The destination for the svn code will be $DESTREPO"
echo ' '
echo ' '
echo 'For this script to work, this machine MUST already have a working copy
of'
echo 'squeezeboxserver that was previously installed via yum or rpm.'
echo ' '
pause 'Press Enter to continue, or ctrl-c to abort..'
if [ ! -e '/usr/share/squeezeboxserver' ]
then
echo 'Error: squeezeboxserver v7.4 or greater must be installed via yum or
rpm first!'
pause 'Press Enter to exit.'
exit 1
fi
szSCStatus=`/sbin/service squeezeboxserver status`
if (( $(echo $szSCStatus | egrep -c "running...") >= 1 ))
then
/sbin/service squeezeboxserver stop
fi
echo "Creating directory for $INSTNAME.."
mkdir "/usr/share/$INSTNAME"
echo 'Preparing the log dir..'
mkdir "/var/log/$INSTNAME"
echo 'Downloading SqueezeboxServer svn code..'
echo 'This can take a LONG time...30 minutes or more.'
echo 'Please be patient. The script will continue when the svn checkout is
complete.'
echo ' '
echo "You can the monitor progress of the checkout by viewing the
/var/log/$INSTNAME/svn.log file.."
echo ' '
echo 'Downloading svn code now..'
/bin/date > "/var/log/$INSTNAME/svn.log"
#svn co "$SOURCEREPO" "$DESTREPO" >> "/var/log/$INSTNAME/svn.log"
svn up "/usr/share/$INSTNAME" >> "/var/log/$INSTNAME/svn.log"
echo "Preparing /etc/sysconfig/$INSTNAME.."
echo "# Edit this to suit your setup
SQUEEZEBOX_USER=\"squeezeboxserver\"
SQUEEZEBOX_HOME=\"/usr/share/$INSTNAME/server\"
SQUEEZEBOX_CFG_DIR=\"/var/lib/$INSTNAME/prefs\"
SQUEEZEBOX_LOG_DIR=\"/var/log/$INSTNAME\"
SQUEEZEBOX_CACHE_DIR=\"/var/lib/$INSTNAME/cache\"
SQUEEZEBOX_CHARSET=\"utf8\"
SQUEEZEBOX_ARGS=\"--daemon --prefsdir=\$SQUEEZEBOX_CFG_DIR
--logdir=\$SQUEEZEBOX_LOG_DIR --cachedir=\$SQUEEZEBOX_CACHE_DIR
--charset=\$SQUEEZEBOX_CHARSET\"" > "/etc/sysconfig/$INSTNAME"
echo "Preparing new $INSTNAME service.."
cp -f /etc/rc.d/init.d/squeezeboxserver "/etc/rc.d/init.d/$INSTNAME"
# Use sed to change the details of our svn service startup script
sed -i -e "s/# squeezeboxserver\s*Startup script for the Squeezebox Server$/#
$INSTNAME\t\Startup script for the Squeezebox server svn code/"
/etc/rc.d/init.d/$INSTNAME
sed -i -e "s/Squeezebox server powers the Squeezebox/$INSTNAME powers the
Squeezebox/" /etc/rc.d/init.d/$INSTNAME
sed -i -e "s/# processname:\s*squeezeboxserver$/# processname:\t$INSTNAME/"
/etc/rc.d/init.d/$INSTNAME
sed -i -e "s/# config:\s*\/etc\/squeezeboxserver\/squeezeboxserver.conf$/#
config:\t\t\/etc\/$INSTNAME\/squeezeboxserver.conf/" /etc/rc.d/init.d/$INSTNAME
sed -i -e "s/# config:\s*\/etc\/sysconfig\/squeezeboxserver$/#
config:\t\t\/etc\/sysconfig\/$INSTNAME/" /etc/rc.d/init.d/$INSTNAME
sed -i -e "s/# Provides:\s*squeezeboxserver$/# Provides:\t\t$INSTNAME/"
/etc/rc.d/init.d/$INSTNAME
sed -i -e 's/# Short-Description:\s*Startup script for the Squeezebox
Server$/# Short-Description:\tStartup script for the Squeezebox Server svn
code/' /etc/rc.d/init.d/$INSTNAME
sed -i -e
"s/\s*SQUEEZEBOX_CONFIG=\/etc\/sysconfig\/squeezeboxserver$/\tSQUEEZEBOX_CONFIG=\/etc\/sysconfig\/$INSTNAME/"
/etc/rc.d/init.d/$INSTNAME
sed -i -e
's/\s*SQUEEZEBOX_BIN=\"\$SQUEEZEBOX_HOME\/squeezeboxserver\"$/\tSQUEEZEBOX_BIN=\"\$SQUEEZEBOX_HOME\/slimserver.pl\"/'
/etc/rc.d/init.d/$INSTNAME
sed -i -e
"s/\s*LOCKFILE=\"\/var\/lock\/subsys\/squeezeboxserver\"/\tLOCKFILE=\"\/var\/lock\/subsys\/$INSTNAME\"/"
/etc/rc.d/init.d/$INSTNAME
sed -i -e "s/\s*echo -n \"Starting Squeezebox Server:\s*\"$/\t\techo -n
\"Starting $INSTNAME: \"/" /etc/rc.d/init.d/$INSTNAME
sed -i -e "s/\s*echo -n \"Stopping Squeezebox Server:\s*\"$/\t\techo -n
\"Stopping $INSTNAME: \"/" /etc/rc.d/init.d/$INSTNAME
sed -i -e 's/\s*killall squeezeboxserver$/ killall
slimserver.pl/' /etc/rc.d/init.d/$INSTNAME
#Create services on run levels 3 and 5
cd /etc/rc.d/rc3.d
ln -s ../init.d/$INSTNAME ./S80$INSTNAME
cd /etc/rc.d/rc5.d
ln -s ../init.d/$INSTNAME ./S80$INSTNAME
echo 'Preparing the data dir..'
cp -R /var/lib/squeezeboxserver/ /var/lib/$INSTNAME/
sed -i -e
"s/\/usr\/share\/squeezeboxserver\//\/usr\/share\/$INSTNAME\/server\//"
/var/lib/$INSTNAME/prefs/server.prefs
sed -i -e "s/\/var\/lib\/squeezeboxserver\//\/var\/lib\/$INSTNAME\//"
/var/lib/$INSTNAME/prefs/server.prefs
# Important for proper svn updating..
cp -R /usr/share/$INSTNAME/server/Plugins/ /var/lib/$INSTNAME/
rm -rf /usr/share/$INSTNAME/server/Plugins
ln -s /var/lib/$INSTNAME/Plugins /usr/share/$INSTNAME/server/Plugins
chown -h squeezeboxserver:squeezeboxserver /usr/share/$INSTNAME/server/Plugins
echo 'Preparing the config dir..'
cp -R /etc/squeezeboxserver /etc/$INSTNAME
rm -f /etc/$INSTNAME/server.conf
ln -s /var/lib/$INSTNAME/prefs/server.prefs /etc/$INSTNAME/server.conf
echo 'Configuring logrotate..'
cp -f /etc/logrotate.d/squeezeboxserver /etc/logrotate.d/$INSTNAME
sed -i -e "s/\/var\/log\/squeezeboxserver\//\/var\/log\/$INSTNAME\//"
/etc/logrotate.d/$INSTNAME
echo 'Fixing file permissions..'
chown -R squeezeboxserver:squeezeboxserver /etc/$INSTNAME
chown -R squeezeboxserver:squeezeboxserver /usr/share/$INSTNAME
chown -R squeezeboxserver:squeezeboxserver /var/lib/$INSTNAME
chown -R squeezeboxserver:squeezeboxserver /var/log/$INSTNAME
echo "Setting up the $INSTNAME service to autorun.."
chkconfig squeezeboxserver off
chkconfig --level 35 "$INSTNAME" on
echo "Done! The Squeezebox Server svn code is ready to run as a service
(daemon)."
echo "Run the command \"service $INSTNAME start\" to start the service."
echo ' '
echo "Run the command \"svn up $DESTREPO\" to update $INSTNAME."
echo ' '
echo 'Enjoy!'
--------------------
--
gharris999
------------------------------------------------------------------------
gharris999's Profile: http://forums.slimdevices.com/member.php?userid=115
View this thread: http://forums.slimdevices.com/showthread.php?t=73689
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix