Well, you wouldn't want to try 33022 because it's broken. 

Here's what I do:

1) Grab the tarball (obviously) and stop SBS if it's running.
2) cd /usr/local and unpack the tarball. It'll give you
squeezeboxserver-7.6.1-NNNNN-FreeBSD.

Code:
--------------------
    
  su
  cd /usr/local
  tar zxvf /your/path/to/tarball/squeezeboxserver-7.6.1-NNNNN-FreeBSD.tgz
  
--------------------


3) Link /usr/local/squeezeboxserver to the unpacked directory.


Code:
--------------------
    
  rm -f squeezeboxserver
  ln -s ./squeezeboxserver-7.6.1-NNNNN-FreeBSD ./squeezeboxserver
  
--------------------


Alternatively, just rename the directory you just created to
"squeezeboxserver". I prefer to keep old versions around just in case.

4) cd /usr/local/squeezeboxserver and set up your logs dir, cache dir
and prefs. I try to keep mine in the same place as the ports version. 

Code:
--------------------
    
  cd /usr/local/squeezeboxserver
  rm -f Cache; ln -s /var/db/squeezeboxserver ./Cache
  rm -f prefs; ln -s /var/db/squeezeboxserver/prefs ./prefs
  rm -f Logs; ln -s /var/log/squeezeboxserver ./Logs
  
--------------------

5) Set the ownership (assuming you have both user and group
"slimserv").


Code:
--------------------
    
  chown -R slimserv:slimserv /usr/local/squeezeboxserver*
  
--------------------

6) You're done. 

Code:
--------------------
    
  sh /usr/local/etc/rc.d/squeezeboxserver start
  
--------------------


I'm far too lazy to do that every time I want to play with a new
version, so once you already have it set up like that, just do steps
(1) and (2), then run this script (I call it "setupsqueeze"):


Code:
--------------------
    
  #!/bin/sh
  
  set -e
  
  LOGDIR=/var/log/squeezeboxserver
  DATADIR=/var/db/squeezeboxserver
  
  if [ `id -u` != 0 ]; then
  echo "root, please."; exit 1;
  fi
  
  if [ -d /sbs ]; then
  DATADIR=/sbs
  fi
  
  if [ ! -d $DATADIR ]; then
  echo "no data directory (/var/db/squeezeboxserver or /sbs)"; exit 1
  fi
  
  cd /usr/local
  newver=`ls -1dtr squeezeboxserver* | fgrep -v .tgz | tail -1`
  curver=`ls -ld squeezeboxserver | awk '{print $11}' | sed -e 's@/$@@'`
  if [ $newver = $curver ]; then
  echo "no update found ($newver)."; exit 0;
  fi
  cd $curver
  if [ ! -e prefs ]; then
  echo "$curver/prefs: not found"; exit 1;
  fi
  cd ..
  cd $newver
  if [ -e Cache ]; then
  echo "$newver/Cache: already exists"; exit 1;
  fi
  if [ -e Logs ]; then
  echo "$newver/Logs: already exists"; exit 1;
  fi
  if [ -e prefs ]; then
  echo "$newver/prefs: already exists"; exit 1;
  fi
  
  ln -s $DATADIR/cache ./Cache
  ln -s $DATADIR/prefs ./prefs
  ln -s $LOGDIR ./Logs
  
  cd ..
  chown -Rh slimserv:slimserv $newver
  rm squeezeboxserver
  ln -s ./$newver ./squeezeboxserver
  echo "$curver -> $newver"
  
--------------------


Finally, if you don't have a copy of the startup script (which usually
lives at /usr/local/etc/rc.d/squeezeboxserver), here's one:

Code:
--------------------
    
  #!/bin/sh
  #
  # $FreeBSD: ports/audio/squeezeboxserver/files/squeezeboxserver.sh.in,v 1.3 
2010/03/27 00:12:43 dougb Exp $
  #
  
  # PROVIDE: squeezeboxserver
  # REQUIRE: LOGIN
  # KEYWORD: shutdown
  
  #
  # Add the following lines to /etc/rc.conf to enable squeezeboxserver:
  #
  #squeezeboxserver_enable="YES"
  #
  
  . /etc/rc.subr
  
  name=squeezeboxserver
  start_precmd="squeezeboxserver_start_precmd"
  stop_postcmd="squeezeboxserver_stop_postcmd"
  rcvar=`set_rcvar`
  
  command=/usr/local/squeezeboxserver/slimserver.pl
  command_interpreter=/usr/bin/perl
  pidfile=/var/run/${name}/${name}.pid
  logdir=/var/log/${name}
  statedir=/var/db/squeezeboxserver
  cachedir=${statedir}/cache
  prefsdir=${statedir}/prefs
  playlistdir=${statedir}/playlists
  u=slimserv
  g=slimserv
  command_args="--daemon --pidfile=${pidfile}"
  squeezeboxserver_user=${u}
  squeezeboxserver_group=${g}
  
  squeezeboxserver_start_precmd()
  {
  # This is stuff is here and not in pkg-install because
  # /var/run may be destroyed at any time and we've had issues
  # with permissions on the various directories under /var getting
  # screwed up in the past.
  
  mkdir -p /var/run/${name}
  chown -RH ${u}:${g} /var/run/${name}
  
  mkdir -p ${logdir}
  chown -RH ${u}:${g} ${logdir}
  
  mkdir -p ${statedir}
  mkdir -p ${cachedir}
  mkdir -p ${prefsdir}
  mkdir -p ${playlistdir}
  chown -RH ${u}:${g} ${statedir}
  }
  
  squeezeboxserver_stop_postcmd()
  {
  pids=`pgrep -u $u`
  if [ -n "${pids}" ]; then
  sleep 1
  kill $pids > /dev/null 2>&1
  fi
  pids=`pgrep -u $u`
  if [ -n "${pids}" ]; then
  wait_for_pids $pids
  fi
  }
  
  load_rc_config ${name}
  
  squeezeboxserver_enable=${squeezeboxserver_enable:-"NO"}
  squeezeboxserver_flags=${squeezeboxserver_flags:-""}
  
  run_rc_command "$1"
  
--------------------


I guess this all looks pretty scary if you're not used to it. It's
actually pretty smooth once it's set up for the first time. :)


-- 
pallfreeman

Please vote for bug #17411.
------------------------------------------------------------------------
pallfreeman's Profile: http://forums.slimdevices.com/member.php?userid=37667
View this thread: http://forums.slimdevices.com/showthread.php?t=88765

_______________________________________________
unix mailing list
unix@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to