summaryrefslogtreecommitdiffstats
path: root/vncinstall
blob: e5ab0172482170091d277ad03db0ebf4074ef50e (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
#!/bin/sh
#
#  Copyright (C) 2002-2003 RealVNC Ltd.
#
#  This is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This software is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this software; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
#  USA.
#

#
# vncinstall - copy the VNC programs to an installation directory.
# Also tries to install the manual pages somewhere sensible.
#

if [ $# -lt 1 -o $# -gt 3 -o ! -d "$1" ]; then 
  echo "usage: $0 <installation-directory> [<man-page-directory>] [<module-directory>]"
  echo "e.g.   $0 /usr/local/bin"
  exit 1
fi

dst=$1
shift
if [ $# -gt 0 ]; then
  mandst="$1/man1"
  shift
  if [ $# -gt 0 ]; then
    moduledst=$1
    shift
  else
    moduledst=/usr/X11R6/lib/modules/extensions
  fi
else
  if [ "`basename $dst`" = bin ]; then
    mandst="`dirname $dst`/man/man1"
    if [ ! -d "$mandst" -a "$dst" = /usr/bin ]; then
      mandst=/usr/share/man/man1
    fi
  fi
fi

if [ "$mandst" != "" ]; then
  if [ ! -d "$mandst" -o ! -w "$mandst" ]; then
    echo "Can't install manual pages to $mandst"
    mandst=""
  fi
fi

for f in xc/programs/Xserver/Xvnc vncviewer/vncviewer vncpasswd/vncpasswd \
	 vncconfig/vncconfig vncserver x0vncserver/x0vncserver; do

  if [ ! -f $f ]; then
    echo "Couldn't find $f"
  else
    if cmp -s $f $dst/`basename $f`; then
      echo "`basename $f` hasn't changed"
    else
      echo "Copying $f to $dst"
      cp -pf $f $dst
      chmod 0555 $dst/`basename $f`
    fi


    if [ -f $f.man ]; then
      if [ "$mandst" != "" -a -d "$mandst" ]; then
        if cmp -s $f.man $mandst/`basename $f.1`; then
          echo "`basename $f.man` hasn't changed"
        else
          echo "Copying $f.man to $mandst/`basename $f.1`"
          cp -pf $f.man $mandst/`basename $f.1`
          chmod 0444 $mandst/`basename $f.1`
        fi
      fi
    fi
  fi

done

vncModule=xc/programs/Xserver/vnc/module/vnc.so
if [ -f "$vncModule" -a -d "$moduledst" ]; then
  if cmp -s $vncModule $moduledst/`basename $vncModule`; then
    echo "`basename $vncModule` hasn't changed"
  else
    echo "Copying $vncModule to $moduledst"
    cp -pf $vncModule $moduledst
    chmod 0555 $moduledst/`basename $vncModule`
  fi
fi