forked from TurboVNC/turbovnc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makedpkg.in
97 lines (83 loc) · 1.78 KB
/
makedpkg.in
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
#!/bin/sh
set -u
set -e
trap onexit INT
trap onexit TERM
trap onexit EXIT
TMPDIR=
SUDO=
onexit()
{
if [ ! "$TMPDIR" = "" ]; then
$SUDO rm -rf $TMPDIR
fi
}
uid()
{
id | cut -f2 -d = | cut -f1 -d \(;
}
safedirmove ()
{
if [ "$1" = "$2" ]; then
return 0
fi
if [ "$1" = "" -o ! -d "$1" ]; then
echo safedirmove: source dir $1 is not valid
return 1
fi
if [ "$2" = "" -o -e "$2" ]; then
echo safedirmove: dest dir $2 is not valid
return 1
fi
if [ "$3" = "" -o -e "$3" ]; then
echo safedirmove: tmp dir $3 is not valid
return 1
fi
mkdir -p $3
mv $1/* $3/
rmdir $1
mkdir -p $2
mv $3/* $2/
rmdir $3
return 0
}
PACKAGE_NAME=@CMAKE_PROJECT_NAME_LC@
VERSION=@VERSION@
BUILD=@BUILD@
DEBARCH=@DEBARCH@
SRCDIR=@CMAKE_SOURCE_DIR@
BINDIR=@TVNC_BINDIR@
DOCDIR=@TVNC_DOCDIR@
CONFDIR=@TVNC_CONFDIR@
BUILDSERVER=@TVNC_BUILDSERVER@
if [ ! `uid` -eq 0 ]; then
SUDO=sudo
fi
umask 022
rm -f $PACKAGE_NAME\_$DEBARCH.deb
TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
mkdir $TMPDIR/DEBIAN
make install DESTDIR=$TMPDIR
if [ ! "$DOCDIR" = "/usr/share/doc/$PACKAGE_NAME-$VERSION" ]; then
safedirmove $TMPDIR/$DOCDIR $TMPDIR/usr/share/doc/$PACKAGE_NAME-$VERSION $TMPDIR/__tmpdoc
fi
if [ "$BUILDSERVER" = "1" ]; then
if [ ! "$CONFDIR" = "/etc" ]; then
safedirmove $TMPDIR/$CONFDIR $TMPDIR/etc $TMPDIR/__tmpconf
fi
fi
mkdir -p $TMPDIR/usr/share/applications
cat > $TMPDIR/usr/share/applications/tvncviewer.desktop <<EOF
[Desktop Entry]
Name=TurboVNC Viewer
Comment=TurboVNC client application
Exec=$BINDIR/vncviewer
Terminal=0
Type=Application
Categories=Application;Utility;X-Red-Hat-Extra;
EOF
SIZE=`du -s $TMPDIR | cut -f1`
cat pkgscripts/deb-control | sed s/{__SIZE}/$SIZE/g > $TMPDIR/DEBIAN/control
$SUDO chown -Rh root:root $TMPDIR/*
dpkg -b $TMPDIR $PACKAGE_NAME\_$VERSION\_$DEBARCH.deb
exit