summaryrefslogtreecommitdiffstats
path: root/vnc/build/vnc.SlackBuild
blob: c8e24f1bbdf96492b9cc763e064bd354209364c5 (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
#!/bin/sh
# $Id$
# -----------------------------------------------------------------------------
#
# Slackware SlackBuild script 
# ===========================
# By:        Eric Hameleers <alien@sox.homeip.net>
# For:       RealVNC
# URL:       http://www.realvnc.com/
# Needs:     Fairly recent version of X
# Changelog:
# 4.0-1:     16/oct/2004 by Eric Hameleers
# 4_1_1-1:   30/apr/2005 by Eric Hameleers
#            * Unfortunately, there's no updated documentation tarball yet.
# 4_1_1-2:   02/aug/2005 by Eric Hameleers
#            * Forgot to add the vnc extension for X to the package.
# 4_1_1-3:   12/aug/2005 by Eric Hameleers
#            * Somehow the permissions of the package were messed up, so that
#              after installation,. / was group-writable and Sendmail
#              refused to run. Fixed this in _vnc.tar.gz.
#
# -----------------------------------------------------------------------------
# 
# Issue 'sh SlackBuild --cleanup' to build a Slackware package.
# The package (.tgz) plus descriptive .txt file are created in /tmp .
# Install using 'installpkg'. 
#
# -----------------------------------------------------------------------------


# --- INIT ---
# Set initial variables:
CWD=`pwd`
if [ "$TMP" = "" ]; then
  TMP=/tmp
fi

PRGNAM=vnc
VERSION=4_1_1
DOCVER=4.0
SUB=x86_linux
ARCH=i486
BUILD=3

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 "++"

rm -rf $PKG/*

# Explode the package framework:
cd $PKG
explodepkg $CWD/_$PRGNAM.tar.gz

cd $TMP/tmp-$PRGNAM

#
# Extract the tar ball, patch and modify
#
echo "Extracting the program tarball..."
tar -xzvf $CWD/${PRGNAM}-${VERSION}-${SUB}.tar.gz

cd ${PRGNAM}-${VERSION}-${SUB}

chown -R root.root *

#cp -a Xvnc vncconnect vncpasswd vncserver vncviewer $PKG/usr/bin
#chmod 555 $PKG/usr/bin/*
#chgrp bin $PKG/usr/bin/*
./vncinstall $PKG/usr/bin $PKG/usr/man $PKG/usr/X11R6/lib/modules/extensions
chown root:bin $PKG/usr/bin/*

cp -a java/* $PKG/usr/share/vnc/classes/

cp -a $CWD/Vncviewer.ad-$VERSION $PKG/usr/lib/X11/app-defaults/Vncviewer
chmod 444 $PKG/usr/lib/X11/app-defaults/Vncviewer


# --- DOCUMENTATION ---

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION

# Unpack the separate documentation tarball
tar -C $TMP/tmp-$PRGNAM -xzvf $CWD/$PRGNAM-$DOCVER-documentation.tar.gz
mv $TMP/tmp-$PRGNAM/$PRGNAM-$DOCVER-documentation/* $PKG/usr/doc/$PRGNAM-$VERSION/
cp -a LICENCE.txt README $PKG/usr/doc/$PRGNAM-$VERSION
mv $PKG/install/README.1st $PKG/usr/doc/$PRGNAM-$VERSION
chown -R root.root $PKG/usr/doc/$PRGNAM-$VERSION/*
chmod -R a-ws $PKG/usr/doc/$PRGNAM-$VERSION/*

# Compress the man pages
gzip -9f $PKG/usr/man/*/*

#
# Patch vncserver :
# alternate default xstartup & enable rgb and font paths
#
sed -i \
  -e 's?^\( *"\)\(xterm -geometry 80x24+10+10 -ls -title \\"\\\$VNCDESKTOP Desktop\\" &\\n"\.\)$?\1#\2?' \
  -e "s#^\(.*\)\(\"twm &\\\n\");\)\$#\1\"xterm -geometry 124x24\+30\+30 -title \\\\\"VNC Startup Tip\\\\\" -e less /usr/doc/vnc-$VERSION/README\.1st \&\\\n\"\.\\
\1\2#" \
  -e 's?# *\(\$cmd \.= " -fp /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/";\)?\1?' \
  -e 's?# *\(\$cmd \.= " -co /usr/lib/X11/rgb";\)?\1?' \
  $PKG/usr/bin/vncserver


# --- OWNERSHIP, RIGHTS ---

chmod -R o-w $PKG


# --- PACKAGE DESCRIPTION ---

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc


# --- BUILDING ---

# Build the package:
cd $PKG
makepkg --linkadd y --chown n $TMP/$PRGNAM-$VERSION-$ARCH-$BUILD.tgz \
  | tee $CWD/makepkg.log
(cd $TMP && \
  md5sum $PRGNAM-$VERSION-$ARCH-$BUILD.tgz > \
  $PRGNAM-$VERSION-$ARCH-$BUILD.tgz.md5
)
cat $CWD/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
fi