Implemented connection type "tcp" (GCT_TCP), use <hostname>:<port> as "port"
[gnokii.git] / packaging / Slackware / SlackBuild.in
1 #!/bin/sh
2
3 #
4 # Script for building GNOKII package
5 # Written by Pawe³ Kot <pkot@linuxnews.pl>
6 #
7
8 PN=@PACKAGE@
9 PV=@VERSION@
10
11 ARCH="i386"
12 BUILD=1
13
14 DOCS1="Docs/*"
15 DOCS2="Docs/protocol Docs/sample"
16 CONF="Docs/sample/gnokiirc"
17
18 CWD=`pwd`
19
20 # There will be the sources placed
21 if [ "$TMP" = "" ]; then
22         TMP=/tmp
23 fi
24 if [ ! -d $TMP ]; then
25         mkdir -p $TMP
26 fi
27
28 # The package will be built there
29 PKG=$TMP/package-$PN-$PV
30 if [ ! -d $PKG ]; then
31         mkdir -p $PKG
32 fi
33
34 # Untar the sources
35 cd $TMP
36 tar xzvf $CWD/$PN-$PV.tar.gz
37 cd $PN-$PV
38
39 # Configure and make package
40 ./configure --prefix=/usr --with-xgnokiidir=/usr/X11R6 i386-slackware-linux
41 make
42 make prefix=$PKG/usr xgnokii_libdir=$PKG/usr/X11R6 install
43
44 # Copy the docs
45 mkdir -p $PKG/usr/doc/$PN-$PV
46 cp $DOCS1 $PKG/usr/doc/$PN-$PV
47 cp -r $DOCS2 $PKG/usr/doc/$PN-$PV
48
49 # and the configuration
50 mkdir -p $PKG/etc
51 sed "s|/usr/local/sbin|/usr/sbin|" < $CONF > $PKG/etc/gnokiirc.new
52
53 # Now, add gnokii group, set the permissions
54 GROUPADD=`which groupadd`
55 cd $PKG
56 mkdir install
57 cat > install/doinst.sh <<EOF
58 #!/bin/sh
59
60 $GROUPADD gnokii >/dev/null 2>&1
61 chown root.gnokii /usr/bin/gnokii
62 chmod 750 /usr/bin/gnokii
63 chown root.gnokii /usr/sbin/gnokiid
64 chmod 750 /usr/sbin/gnokiid
65 chown root.gnokii /usr/sbin/mgnokiidev
66 chmod 4750 /usr/sbin/mgnokiidev
67
68 if [ -f /etc/gnokiirc ]; then
69         rm -f /etc/gnokiirc.new
70 else
71         mv /etc/gnokiirc.new /etc/gnokiirc
72 fi
73 EOF
74
75 # and build the package answering "yes" twice
76 echo "y
77 y" | makepkg $TMP/$PN-$PV-$ARCH-$BUILD.tgz
78
79 # Cleanup
80 rm -rf $TMP/$PN-$PV
81 rm -rf $PKG