summaryrefslogtreecommitdiffstats
path: root/icecast/build/ices.SlackBuild
blob: 6098368d48505d994fe46b933fb5014fe297ed30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/bin/sh
# $Id$
# Copyright (c) 2006 Eric Hameleers <alien@slackware.com>
# Distributed under the terms of the GNU General Public License, Version 2
# ---------------------------------------------------------------------------
# Slackware SlackBuild script
# ===========================
# By:        Eric Hameleers <alien@slackware.com>
# 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 <<EOINS > $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
#