This repository has been archived by the owner on Aug 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·813 lines (695 loc) · 23.6 KB
/
install
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
#!/bin/bash
#
# Modified easyinstall script. All interactivity is commented out.
# After the software is build and installed we are done.
# Citadel-setup and Webcit-setup are not started.
# So the script only builds and installs the software.
# The standard ./configure, make, make install commands.
#
# Automatic script to install Citadel on a target system.
# Copyright (C) 2004 Michael Hampton <[email protected]>
# Copyright (C) 2004-2018 Art Cancro <[email protected]>
#
# This program is open source software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# This program 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.
#
# Reading this script? Here's some helpful hints:
#
# If you're seeing this in your browser, it's probably not what you want.
# You can either save it to disk and run it, or do it the easy way:
#
# curl http://easyinstall.citadel.org/install | bash
#
# Note that this script installs software on your system and so it requires
# root privileges. Feel free to inspect the script to make sure we didn't
# do anything stupid...
#
# We have provided you the source code according to the terms of the respective
# software licenses included in the source code packages, even if you choose
# not to keep the source code around. You can always download it again later.
###############################################################################
#
# This is the general stuff we're going to do, in order:
#
# 1. Gather information about the target system
# 2. Present the installation steps (from 1 above) to the user
# 3. Present any pre-install customizations to the user
# 4. Do the installation
# A. Download any source code files packages required
# B. If we build our own, compile and install prerequisites then Citadel
# 5. Do post-installation setup
#
# Then call it a day.
#
###############################################################################
# Begin user customization area
#
# These two directories specify where Citadel and its private support
# libraries will be installed. This keeps them safely tucked away from
# the rest of your system. The defaults should be fine for most people.
SUPPORT=/usr/local/ctdlsupport
CITADEL=/usr/local/citadel
WEBCIT=/usr/local/webcit
WORKDIR=/tmp
BUILD=$WORKDIR/citadel-build.$$
export SUPPORT CITADEL WEBCIT
unset LANG
MAKEOPTS=""
# End user customization area
# We're now exporting a bunch of environment variables, and here's a list:
# CITADEL_INSTALLER Set to "web" to indicate this script
# CITADEL Directory where Citadel is installed
# WEBCIT Directory where WebCit is installed
# SUPPORT Directory where support programs are installed
# DISTRO_MAJOR Linux distribution name, if applicable
# DISTRO_MINOR Linux distribution name, if applicable
# DISTRO_VERSION Linux distribution version (major digit) if applicable
# CC C compiler being used
# MAKE Make program being used
# CMAKE CMake program being used
# CFLAGS C compiler flags
# LDFLAGS Linker flags
# IS_UPGRADE Set to "yes" if upgrading an existing Citadel
# CTDL_DIALOG Where (if at all) the "whiptail" or "dialog" program may be found
# Let Citadel setup recognize the Citadel installer
CITADEL_INSTALLER=web
export CITADEL_INSTALLER
SETUP="Citadel Easy Install"
DOWNLOAD_SITE=http://easyinstall.citadel.org
# Original source code packages.
DB_SOURCE=db-6.2.32.NC.tar.gz
LIBICAL_SOURCE=libical-3.0.3.tar.gz
LIBSIEVE_SOURCE=libsieve-2.2.7-ctdl2.tar.gz
EXPAT_SOURCE=expat-2.0.1.tar.gz
LIBCURL_SOURCE=curl-7.26.0.tar.gz
LIBCITADEL_SOURCE=libcitadel-easyinstall.tar.gz
CITADEL_SOURCE=citadel-easyinstall.tar.gz
WEBCIT_SOURCE=webcit-easyinstall.tar.gz
TEXTCLIENT_SOURCE=textclient-easyinstall.tar.gz
INCADD=
LDADD=
case `uname -s` in
*BSD)
LDADD="-L/usr/local/lib"
INCADD="-I/usr/local/include"
;;
esac
########################################################################
# Utility functions used throughout the rest of the script
########################################################################
show_info() {
echo '[32m' ${*} '[0m'
}
show_alert() {
echo '[31m' ${*} '[0m'
}
show_prompt() {
echo -n '[33m' ${*} '[0m'
}
GetVersionFromFile() {
VERSION=`cat $1 | tr "\n" ' ' | sed s/.*VERSION.*=\ // `
}
die() {
show_alert $SETUP is aborting.
show_alert The last few lines above this message may indicate what went wrong.
show_alert $OSSTR
cd ~
rm -fr $BUILD
exit 1
}
download_this() {
WGET=`which wget 2>/dev/null`
CURL=`which curl 2>/dev/null`
if [ -n "${WGET}" -a -x "${WGET}" ]; then
$WGET $DOWNLOAD_SITE/$FILENAME || die
else
if [ -n "${CURL}" -a -x "${CURL}" ]; then
$CURL $DOWNLOAD_SITE/$FILENAME -o $FILENAME || die
else
show_alert Unable to find a wget or curl command.
show_alert $SETUP cannot continue.
die;
fi
fi
}
########################################################################
# END OF UTILITY FUNCTIONS -- MAIN SECTION BEGINS HERE
########################################################################
########################################################################
# Test to make sure we're running as root
########################################################################
PERMSTESTDIR=/usr/local/ctdltest.$$
mkdir $PERMSTESTDIR || {
show_alert 'Easy Install is unable to create subdirectories in /usr/local.'
show_alert 'Did you forget to run the install command as the root user?'
show_alert 'Please become root (with a command like "su" or "sudo -s") and'
show_alert 'try again.'
exit 1
}
rmdir $PERMSTESTDIR 2>/dev/null
########################################################################
# Gather information about the target system
########################################################################
clear
os=`uname`
OS=`uname -s`
REV=`uname -r`
MACH=`uname -m`
if [ "${OS}" = "SunOS" ] ; then
OS=Solaris
ARCH=`uname -p`
OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
elif [ "${OS}" = "AIX" ] ; then
OSSTR="${OS} `oslevel` (`oslevel -r`)"
elif [ "${OS}" = "Linux" ] ; then
KERNEL=`uname -r`
if [ -f /etc/redhat-release ] ; then
DIST='RedHat'
PSEUDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
elif [ -f /etc/SUSE-release ] ; then
DIST=`cat /etc/SUSE-release | tr "\n" ' '| sed s/VERSION.*//`
REV=`cat /etc/SUSE-release | tr "\n" ' ' | sed s/.*=\ //`
elif [ -f /etc/mandrake-release ] ; then
DIST='Mandrake'
PSEUDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
elif [ -f /etc/debian_version ] ; then
DIST='Debian'
REV=`cat /etc/debian_version`
fi
OSSTR="${OS} ${DIST} ${REV}(${PSEUDONAME} ${KERNEL} ${MACH})"
elif [ "${OS}" = "Darwin" ] ; then
DIST='MacOS'
fi
rm -rf $BUILD 2>/dev/null
mkdir -p $BUILD || die
cd $BUILD || die
########################################################################
# Test to see whether whiptail is usable by presenting a dialog box
########################################################################
clear
if whiptail --infobox "Welcome to Citadel Easy Install" 10 70 2>/dev/null
then
CTDL_DIALOG=`which whiptail`
export CTDL_DIALOG
fi
clear
########################################################################
# Test to make sure our build directory works
########################################################################
tempfilename=test$$.sh
echo '#!/bin/sh' >$tempfilename
echo '' >>$tempfilename
echo 'exit 0' >>$tempfilename
chmod 700 $tempfilename
[ -x $tempfilename ] || {
show_alert Cannot write to `pwd`
show_alert 'Are you not running this program as root?'
die
}
./$tempfilename || {
show_alert Cannot execute a script.
show_alert 'If /tmp is mounted noexec, please change this before continuing.'
die
}
########################################################################
# Welcome the user to our installation experience.
########################################################################
show_info "Welcome to $SETUP"
show_info Running on: ${OSSTR}
show_info "We will perform the following actions:"
show_info ""
show_info "Installation:"
show_info "- Download/install supporting libraries (if needed)"
show_info "- Download/install Citadel (if needed)"
show_info "- Download/install WebCit (if needed)"
show_info ""
show_info "Configuration:"
show_info "- Configure Citadel"
show_info "- Configure WebCit"
show_info ""
#show_prompt 'Perform the above installation steps now? '
#read yesno </dev/tty
#if [ "`echo $yesno | cut -c 1 | tr N n`" = "n" ]; then
# exit 2
#fi
FILENAME=gpl.txt ; download_this
cat $FILENAME
show_info ""
show_info "Do you accept the terms of this license?"
show_info "If you do not accept the General Public License, Easy Install will exit."
show_prompt 'Enter Y or Yes to accept: '
#read yesno </dev/tty
#if [ "`echo $yesno | cut -c 1 | tr N n`" = "n" ]; then
# exit 2
#fi
echo
if [ -f $CITADEL/data/cdb.00 ]
then
IS_UPGRADE=yes
show_info 'Upgrading your existing Citadel installation.'
else
IS_UPGRADE=no
show_info 'This is a NEW Citadel installation.'
fi
if [ x$IS_UPGRADE = xyes ]
then
show_info 'This appears to be an upgrade of an existing Citadel installation.'
show_prompt 'Have you performed a FULL BACKUP of your programs and data? '
read yesno </dev/tty
if [ "`echo $yesno | cut -c 1 | tr N n`" = "n" ]; then
show_alert "citadel.org does not provide emergency support for sites"
show_alert "which broke irrecoverably during a failed upgrade."
show_alert "Easy Install will now exit."
exit 2
fi
fi
clear
show_info "Installation will now begin."
########################################################################
# Remove components of libraries we used to build ourselves
# These are now supplied by the system libraries
########################################################################
find /usr/local/ctdlsupport | grep -i ical | xargs rm -v 2>/dev/null
find /usr/local/ctdlsupport | grep -i expat | xargs rm -v 2>/dev/null
find /usr/local/ctdlsupport | grep -i curl | xargs rm -v 2>/dev/null
########################################################################
# Offer to install dependencies from the operating system distributor
########################################################################
#show_prompt 'Do you want Easy Install to attempt to install your OS dependencies? '
#read yesno </dev/tty
#if [ "`echo $yesno | cut -c 1 | tr N n`" = "n" ]; then
# show_prompt 'OS dependencies will not be installed.'
#else
# if [ ${DIST} == 'RedHat' ]
# then
# show_info You are on a RedHat-like system.
# yum groupinstall "Development Tools" </dev/tty || die
# yum install \
# zlib-devel \
# openldap-devel \
# openssl-devel \
# libcurl-devel \
# libical-devel \
# expat-devel \
# </dev/tty || die
# fi
# if [ ${DIST} == 'Debian' ]
# then
# show_info You are on a Debian-like system.
# apt-get install \
# make \
# build-essential \
# zlib1g-dev \
# libldap2-dev \
# libssl-dev \
# gettext \
# libical-dev \
# libexpat1-dev \
# libcurl4-openssl-dev \
# </dev/tty || die
# fi
# if [ ${DIST} == 'MacOS' ]
# then
# show_alert 'Easy Install does not yet know how to do this on Mac OS.'
# die
# fi
#i
########################################################################
# Make sure we are using GNU Make. Old unix make doesn't work.
########################################################################
MAKE=xx
if gmake -v 2>&1 | grep -i GNU ; then
MAKE=`which gmake`
else
if make -v 2>&1 | grep -i GNU ; then
MAKE=`which make`
fi
fi
if [ $MAKE == xx ] ; then
show_alert 'Easy Install requires gmake, which was not found.'
show_alert 'Please install gmake and try again.'
exit 1
fi
echo MAKE is $MAKE
export MAKE
# ########################################################################
# # Install cmake (needed for libical)
# ########################################################################
#
# cmake --help >/dev/null 2>&1 || {
# show_alert 'Easy Install also requires cmake, which was not found.'
# show_alert 'Please install cmake and try again.'
# exit 1
# }
########################################################################
# Create the support directories if they don't already exist
########################################################################
mkdir $SUPPORT 2>/dev/null
mkdir $SUPPORT/bin 2>/dev/null
mkdir $SUPPORT/sbin 2>/dev/null
mkdir $SUPPORT/lib 2>/dev/null
mkdir $SUPPORT/libexec 2>/dev/null
mkdir $SUPPORT/include 2>/dev/null
mkdir $SUPPORT/etc 2>/dev/null
########################################################################
# Install libsieve
########################################################################
cd $BUILD || die
FILENAME=libsieve-easyinstall.sum ; download_this
SUM=`cat libsieve-easyinstall.sum`
SUMFILE=$SUPPORT/etc/libsieve-easyinstall.sum
if [ -r $SUMFILE ] ; then
OLDSUM=`cat $SUMFILE`
else
OLDSUM=does_not_exist
fi
if [ "$SUM" = "$OLDSUM" ] ; then
show_info 'libsieve does not need updating.'
else
show_info 'Downloading libsieve...'
FILENAME=$LIBSIEVE_SOURCE ; download_this
show_info 'Installing libsieve...'
( gzip -dc $LIBSIEVE_SOURCE | tar -xf - ) || die
cd $BUILD/libsieve-2.2.7/src || die
./configure --prefix=$SUPPORT || die
$MAKE $MAKEOPTS || die
$MAKE install || die
show_info 'Complete.'
echo $SUM >$SUMFILE
rm -f $CITADEL/citadel-easyinstall.sum 2>/dev/null
fi
# ########################################################################
# # Install libical
# ########################################################################
#
# cd $BUILD || die
# FILENAME=libical-easyinstall.sum ; download_this
# SUM=`cat libical-easyinstall.sum`
# SUMFILE=$SUPPORT/etc/libical-easyinstall.sum
# if [ -r $SUMFILE ] ; then
# OLDSUM=`cat $SUMFILE`
# else
# OLDSUM=does_not_exist
# fi
#
# if [ "$SUM" = "$OLDSUM" ] ; then
# show_info 'libical does not need updating.'
# else
# show_info 'Downloading libical...'
# FILENAME=$LIBICAL_SOURCE ; download_this
# show_info 'Installing libical...'
# ( gzip -dc $LIBICAL_SOURCE | tar -xf - ) || die
# cd $BUILD/libical-3.0.3 || die
# mkdir build || die
# cd build || die
# pwd
# cmake .. -DICAL_GLIB=False -DWITH_CXX_BINDINGS=false -DICAL_ERRORS_ARE_FATAL=false \
# -DCMAKE_INSTALL_LIBDIR=/usr/local/ctdlsupport/lib \
# -DSHARED_ONLY=true -DICAL_BUILD_DOCS=false -DICAL_GLIB_VAPI=false \
# -DCMAKE_INSTALL_INCLUDEDIR=/usr/local/ctdlsupport/include \
# -DCMAKE_INSTALL_DATAROOTDIR=/usr/local/ctdlsupport/etc \
# || die
# make || die
# make install || die
# show_info 'Complete.'
# echo $SUM >$SUMFILE
# rm -f $CITADEL/citadel-easyinstall.sum 2>/dev/null
# fi
########################################################################
# Install Berkeley DB
########################################################################
cd $BUILD || die
FILENAME=db-easyinstall.sum ; download_this
SUM=`cat db-easyinstall.sum`
SUMFILE=$SUPPORT/etc/db-easyinstall.sum
if [ -r $SUMFILE ] ; then
OLDSUM=`cat $SUMFILE`
else
OLDSUM=does_not_exist
fi
if [ "$SUM" = "$OLDSUM" ] ; then
show_info 'Berkeley DB does not need updating.'
else
show_info 'Downloading Berkeley DB...'
FILENAME=$DB_SOURCE ; download_this
show_info 'Installing Berkeley DB...'
( gzip -dc $DB_SOURCE | tar -xf - ) || die
cd $BUILD/db-6.2.32.NC/build_unix || die
../dist/configure --prefix=$SUPPORT --disable-compat185 --disable-cxx --disable-debug --disable-dump185 --disable-java --disable-tcl --disable-test --without-rpm || die
$MAKE $MAKEOPTS || die
$MAKE install || die
show_info 'Complete.'
echo $SUM >$SUMFILE
rm -f $CITADEL/citadel-easyinstall.sum 2>/dev/null
fi
# ########################################################################
# # Install expat
# ########################################################################
#
# cd $BUILD || die
# FILENAME=expat-easyinstall.sum ; download_this
# SUM=`cat expat-easyinstall.sum`
# SUMFILE=$SUPPORT/etc/expat-easyinstall.sum
# if [ -r $SUMFILE ] ; then
# OLDSUM=`cat $SUMFILE`
# else
# OLDSUM=does_not_exist
# fi
#
# if [ "$SUM" = "$OLDSUM" ] ; then
# show_info 'expat does not need updating.'
# else
# show_info 'Downloading expat...'
# FILENAME=$EXPAT_SOURCE ; download_this
# show_info 'Installing Expat...'
# ( gzip -dc $EXPAT_SOURCE | tar -xf - ) || die
# cd $BUILD/expat-2.0.1 || die
# ./configure --prefix=$SUPPORT || die
# $MAKE $MAKEOPTS || die
# $MAKE install || die
# show_info 'Complete.'
# echo $SUM >$SUMFILE
# rm -f $CITADEL/citadel-easyinstall.sum 2>/dev/null
# fi
# ########################################################################
# # Install libcurl
# ########################################################################
#
# cd $BUILD || die
# FILENAME=libcurl-easyinstall.sum ; download_this
# SUM=`cat libcurl-easyinstall.sum`
# SUMFILE=$SUPPORT/etc/libcurl-easyinstall.sum
# if [ -r $SUMFILE ] ; then
# OLDSUM=`cat $SUMFILE`
# else
# OLDSUM=does_not_exist
# fi
#
# if [ "$SUM" = "$OLDSUM" ] ; then
# show_info 'libcurl does not need updating.'
# else
# show_info 'Downloading libcurl...'
# FILENAME=$LIBCURL_SOURCE ; download_this
# show_info 'Installing libcurl...'
# ( gzip -dc $LIBCURL_SOURCE | tar -xf - ) || die
# CFLAGS="${CFLAGS} -I${SUPPORT}/include ${INCADD} -g"
# CPPFLAGS="${CFLAGS}"
# LDFLAGS="-L${SUPPORT}/lib -Wl,--rpath -Wl,${SUPPORT}/lib ${LDADD}"
# export CFLAGS CPPFLAGS LDFLAGS
# cd $BUILD/curl-7.26.0 || die
# ./configure --prefix=$SUPPORT --disable-file --disable-ldap --disable-ldaps \
# --disable-dict --disable-telnet --disable-tftp --disable-manual \
# --enable-thread --disable-sspi --disable-crypto-auth --disable-cookies \
# --without-libssh2 --without-ca-path --without-libidn \
# || die
# $MAKE $MAKEOPTS || die
# $MAKE install || die
# show_info 'Complete.'
# echo $SUM >$SUMFILE
# rm -f $CITADEL/citadel-easyinstall.sum 2>/dev/null
# fi
########################################################################
# Install libcitadel
########################################################################
cd $BUILD || die
FILENAME=libcitadel-easyinstall.sum ; download_this
SUM=`cat libcitadel-easyinstall.sum`
SUMFILE=$SUPPORT/etc/libcitadel-easyinstall.sum
if [ -r $SUMFILE ] ; then
OLDSUM=`cat $SUMFILE`
else
OLDSUM=does_not_exist
fi
if [ "$SUM" = "$OLDSUM" ] ; then
show_info 'libcitadel does not need updating.'
else
show_info 'Downloading libcitadel...'
FILENAME=$LIBCITADEL_SOURCE ; download_this
show_info 'Installing libcitadel...'
( gzip -dc $LIBCITADEL_SOURCE | tar -xf - ) || die
cd $BUILD/libcitadel || die
./configure --prefix=$SUPPORT || die
$MAKE $MAKEOPTS || die
$MAKE install || die
show_info 'Complete.'
echo $SUM >$SUMFILE
# Upgrading libcitadel forces the upgrade of programs which link to it
rm -f $CITADEL/citadel-easyinstall.sum 2>/dev/null
rm -f $CITADEL/webcit-easyinstall.sum 2>/dev/null
rm -f $CITADEL/textclient-easyinstall.sum 2>/dev/null
fi
########################################################################
# Install Citadel Server
########################################################################
cd $BUILD || die
if [ x$IS_UPGRADE = xyes ]
then
show_info 'Upgrading your existing Citadel installation.'
fi
CFLAGS="${CFLAGS} -I${SUPPORT}/include ${INCADD} -g"
CPPFLAGS="${CFLAGS}"
LDFLAGS="-L${SUPPORT}/lib -Wl,--rpath -Wl,${SUPPORT}/lib ${LDADD}"
export CFLAGS CPPFLAGS LDFLAGS
DO_INSTALL_CITADEL=yes
FILENAME=citadel-easyinstall.sum ; download_this
SUM=`cat citadel-easyinstall.sum`
SUMFILE=$CITADEL/citadel-easyinstall.sum
if [ -r $SUMFILE ] ; then
OLDSUM=`cat $SUMFILE`
else
OLDSUM=does_not_exist
fi
if [ "$SUM" = "$OLDSUM" ] ; then
show_info 'Citadel does not need updating.'
DO_INSTALL_CITADEL=no
fi
if [ $DO_INSTALL_CITADEL = yes ] ; then
show_info 'Downloading Citadel...'
FILENAME=$CITADEL_SOURCE ; download_this
show_info 'Installing Citadel...'
cd $BUILD || die
( gzip -dc $CITADEL_SOURCE | tar -xf - ) || die
cd $BUILD/citadel || die
./configure --prefix=$CITADEL --with-db=$SUPPORT --with-pam || die
$MAKE $MAKEOPTS || die
if [ x$IS_UPGRADE = xyes ]
then
show_info 'Performing Citadel upgrade...'
$MAKE upgrade || die
else
show_info 'Performing Citadel install...'
$MAKE install || die
useradd -c "Citadel service account" -d $CITADEL -s $CITADEL/citadel citadel
fi
echo $SUM >$SUMFILE
fi
########################################################################
# Install WebCit
########################################################################
cd $BUILD || die
DO_INSTALL_WEBCIT=yes
FILENAME=webcit-easyinstall.sum ; download_this
SUM=`cat webcit-easyinstall.sum`
SUMFILE=$WEBCIT/webcit-easyinstall.sum
if [ -r $SUMFILE ] ; then
OLDSUM=`cat $SUMFILE`
else
OLDSUM=does_not_exist
fi
if [ "$SUM" = "$OLDSUM" ] ; then
show_info 'WebCit does not need updating.'
DO_INSTALL_WEBCIT=no
fi
if [ $DO_INSTALL_WEBCIT = yes ] ; then
show_info 'Downloading WebCit...'
FILENAME=$WEBCIT_SOURCE ; download_this
show_info 'Installing WebCit...'
cd $BUILD || die
( gzip -dc $WEBCIT_SOURCE | tar -xf - ) || die
cd $BUILD/webcit || die
./configure --prefix=$WEBCIT --with-libical || die
$MAKE $MAKEOPTS || die
rm -fr $WEBCIT/static 2>&1
$MAKE install || die
show_info 'Complete.'
echo $SUM >$SUMFILE
fi
########################################################################
# Install text client
########################################################################
cd $BUILD || die
DO_INSTALL_TEXTCLIENT=yes
FILENAME=textclient-easyinstall.sum ; download_this
SUM=`cat textclient-easyinstall.sum`
SUMFILE=$CITADEL/webcit-easyinstall.sum
if [ -r $SUMFILE ] ; then
OLDSUM=`cat $SUMFILE`
else
OLDSUM=does_not_exist
fi
if [ "$SUM" = "$OLDSUM" ] ; then
show_info 'Citadel text mode client does not need updating.'
DO_INSTALL_TEXTCLIENT=no
fi
if [ $DO_INSTALL_TEXTCLIENT = yes ] ; then
show_info 'Downloading the Citadel text mode client...'
FILENAME=$TEXTCLIENT_SOURCE ; download_this
show_info 'Installing the Citadel text mode client...'
cd $BUILD || die
( gzip -dc $TEXTCLIENT_SOURCE | tar -xf - ) || die
cd $BUILD/textclient || die
./configure --prefix=$CITADEL --bindir=$CITADEL || die
$MAKE $MAKEOPTS || die
$MAKE install || die
echo " Complete."
echo $SUM >$SUMFILE
fi
########################################################################
# Configure the system
########################################################################
show_info 'Configuring your system ...'
if [ x$IS_UPGRADE = xyes ]
then
show_info 'Upgrading your existing Citadel installation.'
else
show_info 'This is a new Citadel installation.'
fi
#if [ -x /etc/init.d/citadel ] ; then
# show_info 'Stopping any previously running Citadel server...'
# /etc/init.d/citadel stop
#fi
# If we are running a Linux operating system we try even harder to stop citserver
#if uname -a | grep -i linux ; then
# if ps ax | grep citserver | grep -v grep ; then
# show_alert 'citserver still running ... trying again to terminate it'
# killall citserver
# sleep 3
# fi
#fi
# If we are running a Linux operating system we now try to kill a running citserver
#if uname -a | grep -i linux ; then
# if ps ax | grep citserver | grep -v grep ; then
# show_alert 'citserver still running ... trying again to terminate it'
# killall -9 citserver
# sleep 3
# fi
#fi
#FILENAME=citadel-init-scripts.tar ; download_this
#cat citadel-init-scripts.tar | (cd / ; tar xvf - )
show_info 'finished building and installing citadel'
#show_info 'Starting Citadel server...'
#/etc/init.d/citadel start
# We do not run citadel-setup and webcit-setup.
# $CITADEL/setup </dev/tty || die
# $WEBCIT/setup </dev/tty || die
rm -fr $BUILD
########################################################################
# End
########################################################################