summaryrefslogtreecommitdiffstats
path: root/vnc/build/vnc.SlackBuild
blob: abbd57d329e2f66b06f0f8ed975b53b3df070ac4 (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
#!/bin/sh
# $Id$
# -----------------------------------------------------------------------------
#
# Slackware SlackBuild script 
# ===========================
# By:        Eric Hameleers <alien@slackware.com>
# For:       vnc
# 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.
# 4.1.2-1:   21/nov/2006 by Eric Hameleers
#            * The 4.1.2 is a security fix.
# 4.1.2-2:   08/jan/2007 by Eric Hameleers
#            * Fixed group-writable directories in the package (sendmail would
#              stop working after install of the vnc package).
#
# -----------------------------------------------------------------------------
# 
# 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
SRCVER=4_1_2
VERSION=4.1.2
SUB=x86_linux
ARCH=i486
BUILD=2

PKG=$TMP/package-$PRGNAM

if [ ! -d $TMP/tmp-$PRGNAM ]; then
  mkdir -p $TMP/tmp-$PRGNAM # location to build the source
else
  rm -rf $TMP/tmp-$PRGNAM/*
fi
if [ ! -d $PKG ]; then
  mkdir -p $PKG # place for the package to be built
else
  rm -rf $PKG/*
fi


# --- PACKAGE BUILDING ---


echo "++"
echo "|| $PRGNAM-$VERSION"
echo "++"

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

cd $TMP/tmp-$PRGNAM

#
# Extract the tarball, patch and modify
#
echo "Extracting the program source archive(s)..."
tar -xzvf $CWD/${PRGNAM}-${SRCVER}-${SUB}.tar.gz

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

chown -R root:root *
find . -perm 777 -exec chmod 755 {} \;
find . -perm 666 -exec chmod 644 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;


#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

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

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


# --- DOCUMENTATION ---

mkdir -p $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
find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;

#
# 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 2>&1 \
  | tee $CWD/makepkg.log
(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
fi