blob: ad5dd8382cc81f0a243bc1226ad1a3b8d4034010 [file] [log] [blame]
Adam Tkacfded0782008-03-22 11:20:54 +00001#!/bin/sh
2#
3# Copyright (C) 2002-2005 RealVNC Ltd.
4#
5# This is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This software is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this software; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18# USA.
19#
20
21#
22# vncinstall - copy the VNC programs to an installation directory.
23# Also tries to install the manual pages somewhere sensible.
24#
25
26if [ $# -lt 1 -o $# -gt 3 -o ! -d "$1" ]; then
27 echo "usage: $0 <installation-directory> [<man-page-directory>] [<module-directory>]"
28 echo "e.g. $0 /usr/local/bin"
29 exit 1
30fi
31
32dst=$1
33shift
34if [ $# -gt 0 ]; then
35 mandst="$1/man1"
36 shift
37 if [ $# -gt 0 ]; then
38 moduledst=$1
39 shift
40 else
41 moduledst=/usr/X11R6/lib/modules/extensions
42 fi
43else
44 if [ "`basename $dst`" = bin ]; then
45 mandst="`dirname $dst`/man/man1"
46 if [ ! -d "$mandst" -a "$dst" = /usr/bin ]; then
47 mandst=/usr/share/man/man1
48 fi
49 fi
50fi
51
52if [ "$mandst" != "" ]; then
53 if [ ! -d "$mandst" -o ! -w "$mandst" ]; then
54 echo "Can't install manual pages to $mandst"
55 mandst=""
56 fi
57fi
58
59for f in xc/programs/Xserver/Xvnc vncviewer/vncviewer vncpasswd/vncpasswd \
60 vncconfig/vncconfig vncserver x0vncserver/x0vncserver; do
61 if [ ! -f $f ]; then
62 echo "Couldn't find $f"
63 else
64 if cmp -s $f $dst/`basename $f`; then
65 echo "`basename $f` hasn't changed"
66 else
67 echo "Copying $f to $dst"
68 cp -pf $f $dst
69 chmod 0555 $dst/`basename $f`
70 fi
71
72
73 if [ -f $f.man ]; then
74 if [ "$mandst" != "" -a -d "$mandst" ]; then
75 if cmp -s $f.man $mandst/`basename $f.1`; then
76 echo "`basename $f.man` hasn't changed"
77 else
78 echo "Copying $f.man to $mandst/`basename $f.1`"
79 cp -pf $f.man $mandst/`basename $f.1`
80 chmod 0444 $mandst/`basename $f.1`
81 fi
82 fi
83 fi
84 fi
85
86done
87
88vncModule=xc/programs/Xserver/vnc/module/vnc.so
89if [ -f "$vncModule" -a -d "$moduledst" ]; then
90 if cmp -s $vncModule $moduledst/`basename $vncModule`; then
91 echo "`basename $vncModule` hasn't changed"
92 else
93 echo "Copying $vncModule to $moduledst"
94 cp -pf $vncModule $moduledst
95 chmod 0555 $moduledst/`basename $vncModule`
96 fi
97fi