#!/bin/sh # $Id$ # Copyright (c) 2006 Eric Hameleers # Distributed under the terms of the GNU General Public License, Version 2 # --------------------------------------------------------------------------- # Slackware SlackBuild script # =========================== # By: Eric Hameleers # For: IceS # URL: http://www.icecast.org/ # Summary: An mp3 source client for the icecast streaming media server # Needs: libvorbis, libogg, libxml2, libshout2, lame, perl, python # Changelog: # 0.4-1: 20/oct/2004 by Eric Hameleers # Initial build. # 0.4-2: 11/mar/2006 by Eric Hameleers # Added logrotate script. # # -------------------------------------------------------------------------- # # Set initial variables: CWD=`pwd` if [ "$TMP" = "" ]; then TMP=/tmp fi PRGNAM=ices VERSION=0.4 ARCH=i486 BUILD=2 PKG=$TMP/package-$PRGNAM if [ ! -d $TMP/tmp-$PRGNAM ]; then mkdir -p $TMP/tmp-$PRGNAM # location to build the source fi if [ ! -d $PKG ]; then mkdir -p $PKG # place for the package to be built fi # --- PACKAGE BUILDING --- echo "+==============+" echo "| $PRGNAM-$VERSION |" echo "+==============+" iceuser=icecast icegroup=icecast rm -rf $PKG/* # Explode the package framework: cd $PKG if [ -f $CWD/_$PRGNAM.tar.gz ]; then explodepkg $CWD/_$PRGNAM.tar.gz fi cd $TMP/tmp-$PRGNAM # Extract tar ball in TEMP dir echo Building $PRGNAM... tar -zxvpf $CWD/$PRGNAM-$VERSION.tar.gz cd $PRGNAM-$VERSION ./configure --prefix=/usr --localstatedir=/var \ --sysconfdir=/usr/share/icecast/etc \ --with-moddir=/usr/share/icecast/etc/modules \ --with-perl --with-python \ --with-lame --with-vorbis \ 2>&1 | tee $CWD/configure-${PRGNAM}.log make | tee $CWD/make-${PRGNAM}.log # Install all the needed stuff to the package dir # Use installwatch if available: which installwatch > /dev/null 2>&1 if [ $? == 0 ]; then installwatch -o $CWD/install-${PRGNAM}.log \ make prefix=$PKG/usr \ localstatedir=$PKG/var \ sysconfdir=$PKG/usr/share/icecast/etc \ moddir=$PKG/usr/share/icecast/etc/modules \ install else make prefix=$PKG/usr \ localstatedir=$PKG/var \ sysconfdir=$PKG/usr/share/icecast/etc \ moddir=$PKG/usr/share/icecast/etc/modules \ install \ 2>&1 | tee $CWD/install-${PRGNAM}.log fi mkdir -p $PKG/var/state/ices (cd $PKG/usr/share/icecast/etc && patch < $CWD/ices_conf.patch) # (cd $PKG/usr && ln -s /usr/share/icecast ices) # --- DOCUMENTATION --- # Compress the man page gzip -9 $PKG/usr/man/*/* # Copy the documentation mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION mv $PKG/usr/doc/ices/icesmanual.html $PKG/usr/doc/$PRGNAM-$VERSION/ rm -r $PKG/usr/doc/ices chmod -R -w $PKG/usr/doc/$PRGNAM-$VERSION # --- POST-INSTALL SCRIPT --- # --- Fabricate the 'doinst.sh' script: ------ mkdir -p $PKG/install cat < $PKG/install/doinst.sh # Handle the incoming configuration files: config() { for infile in \$1; do NEW="\$infile" OLD="\`dirname \$NEW\`/\`basename \$NEW .new\`" # If there's no config file by that name, mv it over: if [ ! -r \$OLD ]; then mv \$NEW \$OLD elif [ "\`cat \$OLD | md5sum\`" = "\`cat \$NEW | md5sum\`" ]; then # toss the redundant copy rm \$NEW fi # Otherwise, we leave the .new copy for the admin to consider... done } # Take care of the logrotate script config etc/logrotate.d/ices.new #Add the '${icegroup}' group if it doesn't exist already groupadd ${icegroup} 2> /dev/null #Add the '${iceuser}' user if it doesn't exist already useradd -c "Icecast" -d /usr/share/icecast \\ -g ${icegroup} -s "/bin/false" ${iceuser} 2> /dev/null # Configure the home directory # (Will exist already, if icecast package is installed previously). mkdir -p usr/share/icecast chown -R ${iceuser}:${icegroup} usr/share/icecast chmod 750 usr/share/icecast # Configure the state directory mkdir -p var/state/ices chown -R ${iceuser}:${icegroup} var/state/ices chmod 755 var/state/ices EOINS # --- End of 'doinst.sh' script ----------- # --- OWNERSHIP, RIGHTS --- chown -R root.root $PKG # --- PACKAGE DESCRIPTION --- mkdir -p $PKG/install cat $CWD/ices.slack-desc > $PKG/install/slack-desc # --- BUILDING --- # Build the package and compute its md5 checksum: cd $PKG makepkg --linkadd y --chown n $TMP/$PRGNAM-$VERSION-$ARCH-$BUILD.tgz (cd $TMP && md5sum $PRGNAM-$VERSION-$ARCH-$BUILD.tgz > $PRGNAM-$VERSION-$ARCH-$BUILD.tgz.md5) cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $TMP/$PRGNAM-$VERSION-$ARCH-$BUILD.txt # --- CLEANUP --- # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf $TMP/tmp-$PRGNAM rm -rf $PKG else echo You can check the 'installwatch' log file: $CWD/install-${PRGNAM}.log fi # # EOF #