Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 3 of 3
  1. #1
    Senior Member gharris999's Avatar
    Join Date
    Apr 2005
    Location
    Santa Fe, NM
    Posts
    3,509

    Running 7.4 from svn code..

    In honor of the imminent release of Squeezebox Server 7.4, here is a script that will download and configure the 7.4 svn code to run as a service. This script is meant for Fedora and like distros. It will need to be tweaked for debian/ubuntu. The script requires a working installation of SBS 7.4 (installed via yum or rpm) to serve as a "template."
    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'
    
    
    # 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_svn'
    
    # 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"
    
    
    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!'

  2. #2
    Junior Member
    Join Date
    Oct 2009
    Posts
    5

    Wink in plain...

    Hi. That looks interesting, since I installed SBS 7.4 on fedora 10 and I'm not seeing my controller in mysqueezebox.com/players neither my local music.

    I'm quite a noob with those could you explain in a non technical way what do I achieve with the script?
    With this one can I fix my issues? by the way how can I see the SBS 7.4 interface?

    thanks in advance
    Last edited by pluscool; 2009-10-01 at 06:54. Reason: more info

  3. #3
    Senior Member gharris999's Avatar
    Join Date
    Apr 2005
    Location
    Santa Fe, NM
    Posts
    3,509
    Sorry, no, this script won't fix any ailments that you might have with SBS. The reason why I use scripts of this sort is so that, as a developer, I can have parallel installs of 7.5 & 7.4 & 7.3.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •