blob: 364e21a56ed59e5ae9a6424a068265242122d28a (
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
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
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
|
#!/bin/sh
#
# UNIX installation and upgrade script for Urchin
# Copyright (c) 2003 Urchin Software Corporation
# Set shell variables and defaults for installation
PATH=/usr/bin:/usr/sbin:/bin:/sbin:$PATH
OS=`uname -s`
HOST=`uname -n`
INSTALLDIR=/usr/local/urchin
PORT=9999
NOW=`date +%Y%m%d%H%M%S`
LANGUAGE=en
# This sets up a portable way to have echo \c and echo -n be equivalent
case "`echo 'x\c'`" in
'x\c') echo="echo -n" nnl= ;; #BSD style echo
x) echo="echo" nnl="\c" ;; #SysV style echo
*) echo "$0 quitting: Can't set up echo command" 1>&2; exit 1 ;;
esac
# Ask user to choose language
if [ $# -eq 0 ]; then
echo "Choose Language: [Default: 1]"
echo " 1. English"
echo " 2. Japanese / 日本語"
$echo "-> ${nnl}"
read ans
case $ans in
""|1) LANGUAGE=en
;;
2) LANGUAGE=ja
;;
esac
fi
# Language Dictionary
case $LANGUAGE in
en)
ENTRY0001="Error"
ENTRY0002="Unable to determine the current directory"
ENTRY0003="Missing installer file"
ENTRY0004="Welcome to the Urchin Installation and Upgrade Utility"
ENTRY0005="Please select the installation type"
ENTRY0006="New"
ENTRY0007="Upgrade"
ENTRY0008="Default"
ENTRY0009="Version"
ENTRY0010="Invalid response. Please try again."
ENTRY0011="Please read the install.txt file before continuing. Urchin installs and uses a lightweight Apache webserver for web-based administration and report delivery. The installer may ask for the following information during installation"
ENTRY0012="Be sure to backup the current installation before continuing with this upgrade."
ENTRY0013="Japanese"
ENTRY0014="A port number for the Urchin webserver. Port numbers below 1024 require superuser privileges."
ENTRY0015="A valid user and group for ownership and operation."
ENTRY0016="Specify the installation directory"
ENTRY0017="Specify the directory where Urchin was installed"
ENTRY0018="The specified location exists and is not a directory"
ENTRY0019="The specified location is not a directory"
ENTRY0020="The specified directory does not exist"
ENTRY0021="Do you want the script to create it?"
ENTRY0022="Yes"
ENTRY0023="No"
ENTRY0024="Failed to make directory"
ENTRY0025="You do not have permissions to write to the specified directory. You may need to rerun this script as root or a different user."
ENTRY0026="The specified directory already exists."
ENTRY0027="Are you sure you want to install in this location?"
ENTRY0028="The specified directory does not contain the necessary files for performing an upgrade."
ENTRY0029="Unable to change ownership of files to the specified group. The group is either invalid or you don't have permission to change files to that group."
ENTRY0030="Unable to test group argument."
ENTRY0031="Invalid option. You cannot specify a new installation and an upgrade at the same time."
ENTRY0032="Invalid user."
ENTRY0033="You must be root to specify a different user."
ENTRY0034="The webserver cannot be run as root."
ENTRY0035="Invalid argument supplied after -s option."
ENTRY0036="A port number less than 1024 requires superuser privileges."
ENTRY0037="The specified port is not available."
ENTRY0038="You appear to be downgrading Urchin."
ENTRY0039="Installed Version"
ENTRY0040="Installer Version"
ENTRY0041="Stopping Urchin webserver and scheduler"
ENTRY0042="Choose a port number for the webserver"
ENTRY0043="Choose a user for the webserver and file ownership"
ENTRY0044="Choose a group for the webserver and file ownership"
ENTRY0045="Would you like the installer to start the Urchin webserver and scheduler at the end of the installation?"
ENTRY0046="Summary Information"
ENTRY0047="Installing Urchin"
ENTRY0048="Upgrading Urchin"
ENTRY0049="Installation Directory"
ENTRY0050="Webserver Port"
ENTRY0051="Webserver User"
ENTRY0052="Webserver Group"
ENTRY0053="Start Webserver and Scheduler"
ENTRY0054="Press return to continue"
ENTRY0055="Please select continue or exit"
ENTRY0056="Backing up configuration databases and files"
ENTRY0057="The following configuration file is not the same as the distributed version. Please check this file to make sure it contains the correct options"
ENTRY0058="Installing Urchin"
ENTRY0059="Continue"
ENTRY0060="Creating webserver configuration"
ENTRY0061="Initializing the configuration databases"
ENTRY0062="Upgrading Urchin"
ENTRY0063="Updating the configuration databases"
ENTRY0064="Setting file ownership and permission"
ENTRY0065="Starting the Urchin webserver and scheduler daemon"
ENTRY0066="Installation Complete"
ENTRY0067="Problems changing permissions on the distribution files"
ENTRY0068="The Urchin administrative interface should be ready to use at"
ENTRY0069="The Urchin administrative interface will be ready to use at the following address after the webserver and scheduler have been started."
ENTRY0070="The administrative interface default username is admin and the password is urchin. A wizard will direct you through the process of licensing the product and changing the default password. We strongly recommend that you change the default value to something more secure."
ENTRY0071="To start or stop the Urchin webserver or scheduler, run 'urchinctl start' or 'urchinctl stop' from the installation bin directory."
ENTRY0072="Usage"
ENTRY0073="directory"
ENTRY0074="port"
ENTRY0075="user"
ENTRY0076="group"
ENTRY0077="prints this help message"
ENTRY0078="operates the installer in quiet mode (disables some messages)"
ENTRY0079="specifies the installation directory"
ENTRY0080="specifies the port for the webserver"
ENTRY0081="specifies the group for the webserver"
ENTRY0082="specifies the user for the webserver"
ENTRY0083="specifies whether to start the Urchin webserver and scheduler"
ENTRY0084="specifies a new installation"
ENTRY0085="specifies an upgrade installation"
ENTRY0086="Exit"
ENTRY0087="Restarting Urchin webserver and scheduler"
ENTRY0088="Determining data and var directory locations"
ENTRY0089="Installer cannot continue with upgrade"
ENTRY0090="Warning"
;;
ja)
ENTRY0001="エラー"
ENTRY0002="現在のディレクトリが見つかりません"
ENTRY0003="インストールファイルが不足しています"
ENTRY0004="Urchin インストールとアップグレードユーティリティへようこそ"
ENTRY0005="インストールタイプを選択してください。"
ENTRY0006="新規"
ENTRY0007="アップグレード"
ENTRY0008="デフォルト"
ENTRY0009="バージョン"
ENTRY0010="入力が間違っています。もう一度入力してください。"
ENTRY0011="続行する前に install.txt をお読みください。Urchin は、ウェブベースの管理・リポート配布に行うため、軽量化された Apache ウェブサーバーをインストールします。インストール中にこれらの情報を必要とすることがあります。"
ENTRY0012="アップグレードを続行する前に、現在インストールされている Urchin をバックアップしてください。"
ENTRY0013="日本語"
ENTRY0014="Urchin ウェブサーバー用のポート番号です。1024以下のポート番号使用にはスーパーユーザーの権限を必要とします。"
ENTRY0015="所有用と操作用の有効なユーザとグループ"
ENTRY0016="インストールディレクトリを指定してください"
ENTRY0017="Urchin がインストールされているディレクトリを指定してください"
ENTRY0018="指定された場所は存在しますが、ディレクトリではありません"
ENTRY0019="指定された場所はディレクトリではありません"
ENTRY0020="指定されたディレクトリは存在しません"
ENTRY0021="スクリプトによってそれを作成しますか?"
ENTRY0022="はい"
ENTRY0023="いいえ"
ENTRY0024="ディレクトリ作成に失敗しました"
ENTRY0025="指定されたディレクトリに書き込む権限がありません。ルート、又は別のユーザーでこのスクリプトを再起動してください。"
ENTRY0026="指定されたディレクトリはすでに存在します。"
ENTRY0027="本当にこの場所にインストールしてもよろしいですか?"
ENTRY0028="指定されたディレクトリには、アップグレードに必要なファイルが存在しません。"
ENTRY0029="ファイルの所有権を、指定したグループに変更できません。このグループが不正であるか、あなたにファイルをこのグループに変更する権限がありません。"
ENTRY0030="グループ引数を変更できません。"
ENTRY0031="不正なオプションです。新規インストールとアップグレードを同時に行えません。"
ENTRY0032="不正なユーザー"
ENTRY0033="違うユーザーを指定するにはルートユーザーになる必要があります。"
ENTRY0034="ウェブサーバはルートでは起動できません。"
ENTRY0035="-s の後に不正な引数が付いています。"
ENTRY0036="1024より小さいポート番号にはスーパーユーザーの権限が必要です。A"
ENTRY0037="選択されたポートは有効ではありません。"
ENTRY0038="Urchin をダウングレードしようとしています。"
ENTRY0039="インストールされたバージョン"
ENTRY0040="インストーラのバージョン"
ENTRY0041="Urchin ウェブサーバーとスケジューラを停止しいます。"
ENTRY0042="ウェブサーバ用のポート番号を選択してください"
ENTRY0043="ウェブサーバとファイルの所有権を持つユーザを選択してください"
ENTRY0044="ウェブサーバとファイルの所有権を持つグループを選択してください"
ENTRY0045="インストールの最後に Urchin ウェブサーバとスケジューラを立ち上げますか?"
ENTRY0046="要約情報"
ENTRY0047="Urchin インストール中"
ENTRY0048="Urchin アップグレード中"
ENTRY0049="インストールディレクトリ"
ENTRY0050="ウェブサーバポート"
ENTRY0051="ウェブサーバユーザー"
ENTRY0052="ウェブサーバグループ"
ENTRY0053="ウェブサーバとスケジューラを起動してください"
ENTRY0054="続けるためにはリターンを押してください"
ENTRY0055="Please select continue or exit"
ENTRY0056="Backing up configuration databases and files"
ENTRY0057="The following configuration file is not the same as the distributed version. Please check this file to make sure it contains the correct options"
ENTRY0058="Urchin のインストール中"
ENTRY0059="Continue"
ENTRY0060="ウェブサーバ設定の作成中"
ENTRY0061="設定データベースの初期化中"
ENTRY0062="Upgrading Urchin"
ENTRY0063="設定データベースのアップデート中"
ENTRY0064="ファイル所有権・パーミッションの設定中"
ENTRY0065="Urchin ウェブサーバとスケジューラデーモンの起動中"
ENTRY0066="インストール完了"
ENTRY0067="配布ファイルのパーミッション変更に問題があります"
ENTRY0068="Urchin 管理インターフェースは使用中です"
ENTRY0069="ウェブサーバとスケジューラ起動後、Urchin 管理インターフェースが以下のアドレスで使用されます。"
ENTRY0070="管理インターフェースでは、デフォルトユーザー名は admin、パスワードはurchin です。ウィザードから製品のライセンス化とデフォルトパスワードの変更を行えます。デフォルト値をより安全なものに変更することをお勧めします。"
ENTRY0071="Urchin ウェブサーバとスケジューラの起動・停止には、インストール bin ディレクトリから、「urchinctl start」又は「urchinctl stop」を起動してください。"
ENTRY0072="使用法"
ENTRY0073="ディレクトリ"
ENTRY0074="ポート"
ENTRY0075="ユーザー"
ENTRY0076="グループ"
ENTRY0077="このヘルプメッセージをプリントしてください"
ENTRY0078="インストーラを quiet モード(幾つかのメッセージが非表示になります)で行ってください"
ENTRY0079="インストールディレクトリを指定してください"
ENTRY0080="ウェブサーバのポートを指定してください"
ENTRY0081="ウェブサーバのグループを指定してください"
ENTRY0082="ウェブサーバのユーザを指定してください"
ENTRY0083="Urchin ウェブサーバとスケジューラを起動するかを指定してください"
ENTRY0084="新規インストールを指定してください"
ENTRY0085="アップグレードインストールを指定してください"
ENTRY0086="Exit"
ENTRY0087="Restarting Urchin webserver and scheduler"
ENTRY0088="Determining data and var directory locations"
ENTRY0089="Installer cannot continue with upgrade"
ENTRY0090="Warning"
;;
esac
# Function to format text output
echof () {
if [ -f /usr/bin/fmt ] && [ $LANGUAGE = en ]; then
echo "$1" | fmt
else
echo "$1"
fi
}
# Determine the current directory and the location of the installation files
CURRENTDIR=`pwd`
if [ "x$CURRENTDIR" = x ]; then
echof "## $ENTRY0001: $ENTRY0002"
exit 1
fi
TEMPDIR=`dirname $0`
if [ "x$TEMPDIR" != x ] && [ "x$TEMPDIR" != x. ]; then
INSTALLERDIR=$CURRENTDIR/$TEMPDIR
else
INSTALLERDIR=$CURRENTDIR
fi
# Verify installation files are present in the installer's directory
INSPECTOR=$INSTALLERDIR/inspector
if [ ! -f "$INSPECTOR" ]; then
echof "## $ENTRY0001: $ENTRY0003: $INSPECTOR"
exit 1
fi
GUNZIP=$INSTALLERDIR/gunzip
if [ ! -f "$GUNZIP" ]; then
if [ -f /usr/bin/gunzip ] && [ -x /usr/bin/gunzip ]; then
GUNZIP=/usr/bin/gunzip
else
echof "## $ENTRY0001: $ENTRY0003: $GUNZIP"
exit 1
fi
fi
DIST=$INSTALLERDIR/urchin.tar.gz
if [ ! -f "$DIST" ]; then
echof "## $ENTRY0001: $ENTRY0003: $DIST"
exit 1
fi
# Get the version number for displaying to the user
NEWVERSION=`"$INSPECTOR" -v | cut -d ":" -f 2 | cut -d " " -f 3 | cut -c 1,2,3,4`
MAJORVERSION=`echo $NEWVERSION | cut -c 1`
MINORVERSION=`echo $NEWVERSION | cut -c 2,3,4`
# Determine username of the person executing this script
if [ $OS = SunOS ]; then
if [ -f /usr/xpg4/bin/id ]; then
MYLOGIN=`/usr/xpg4/bin/id -un`
fi
else
MYLOGIN=`id -un`
fi
# Verify MYLOGIN was set
if [ x$MYLOGIN = x ]; then
if [ ! x$USER = x ]; then
MYLOGIN=$USER
elif [ ! x$LOGNAME = x ]; then
MYLOGIN=$LOGNAME
else
MYLOGIN=nobody
fi
fi
# Set the default user for the web server. This will be verified later...
if [ $MYLOGIN = root ]; then
WUSER=nobody
else
WUSER=$MYLOGIN
fi
# Set the default group for the user. This will be verified later...
if [ $OS = SunOS ]; then
if [ -f /usr/xpg4/bin/id ]; then
WGROUP=`/usr/xpg4/bin/id -gn $WUSER`
fi
else
WGROUP=`id -gn $WUSER`
fi
if [ x$WGROUP = x ]; then
WGROUP=`groups $WUSER | awk '{print $1}'`
fi
# Set flags for command line options
dflag=0 # Install Directory flag
gflag=0 # Group flag
pflag=0 # Port flag
qflag=0 # Quiet flag
sflag=0 # Start scheduler and webserver flag
tflag=0 # Installation type (new or upgrade)
uflag=0 # User flag
# Check for a --help argument
for arg in "$@"; do
if [ "x$arg" = x--help ]; then
$0 -h
exit 0
fi
done
# Read in command line arguments and set flags and variables accordingly
while getopts d:g:hnmp:qs:u: OPT; do
case $OPT in
# Partially verify the installation directory
d) if [ "x$OPTARG" != x ]; then
if [ -r "$OPTARG" ] || [ -w "$OPTARG" ] || [ -x "$OPTARG" ] && [ ! -d "$OPTARG" ]; then
echof "## $ENTRY0001: $ENTRY0018: $OPTARG"
exit 1
fi
# Perform remainder of directory checks at end of the getopts while loop right after
# selection of installation type.
INSTALLDIR=$OPTARG
dflag=1
fi
;;
# Verify the group
g) if [ x$OPTARG != x ]; then
if [ ! -d /tmp/.urchin$$ ] && [ ! -f /tmp/.urchin$$ ] && [ ! -r /tmp/.urchin$$ ] && [ ! -w /tmp/.urchin$$ ] && [ ! -x /tmp/.urchin$$ ]; then
touch /tmp/.urchin$$
chgrp $OPTARG /tmp/.urchin$$ > /dev/null 2>&1
if [ $? != 0 ]; then
echof "## $ENTRY0001: $ENTRY0029: $OPTARG"
exit 1
else
WGROUP=$OPTARG
gflag=1
fi
if [ -f /tmp/.urchin$$ ]; then
rm /tmp/.urchin$$
fi
else
echof "## $ENTRY0001: $ENTRY0030"
fi
fi
;;
# Print help information
h) echof "$ENTRY0072: $0 [-h] [-q] [-d $ENTRY0073] [-p $ENTRY0074] [-g $ENTRY0076] [-u $ENTRY0075] [-s (yes|no)] [-n|-m]"
echof " -h $ENTRY0077"
echof " -q $ENTRY0078"
echof " -d $ENTRY0079"
echof " -p $ENTRY0080"
echof " -g $ENTRY0081"
echof " -u $ENTRY0082"
echof " -s $ENTRY0083"
echof " -n $ENTRY0084"
echof " -m $ENTRY0085"
echof ""
exit 0
;;
# New installation
n) if [ $tflag -eq 0 ]; then
upgrade=0
tflag=1
else
if [ $upgrade -eq 1 ]; then
echof "## $ENTRY0001: $ENTRY0031"
exit 1
fi
fi
;;
# Upgrade installation
m) if [ $tflag -eq 0 ]; then
upgrade=1
tflag=1
else
if [ $upgrade -eq 0 ]; then
echof "## $ENTRY0001: $ENTRY0031"
exit 1
fi
fi
;;
# Verify the port
p) if [ x$OPTARG != x ]; then
if [ $MYLOGIN != root ] && [ $OPTARG -lt 1024 ]; then
echof "## $ENTRY0001: $ENTRY0036: $OPTARG"
exit 1
else
PORT=$OPTARG
pflag=1
fi
fi
;;
# Set the quiet flag
q) qflag=1
;;
# Set the start flag
s) if [ x$OPTARG != x ]; then
if [ x$OPTARG = xyes ]; then
startservers=1
elif [ x$OPTARG = xno ]; then
startservers=0
else
echof "## $ENTRY0001: $ENTRY0035"
exit 1
fi
sflag=1
fi
;;
# Verify the user
u) if [ x$OPTARG != x ]; then
if [ $OPTARG = root ]; then
echof "## $ENTRY0001: $ENTRY0034: $OPTARG"
exit 1
fi
id $OPTARG > /dev/null 2>&1
if [ ! $? = 0 ]; then
echof "## $ENTRY0001: $ENTRY0032: $OPTARG"
exit 1
elif [ $OPTARG != $MYLOGIN ] && [ $MYLOGIN != root ]; then
echof "## $ENTRY0001: $ENTRY0033: $OPTARG"
exit 1
else
WUSER=$OPTARG
uflag=1
fi
fi
;;
\?) $0 -h
exit 1
;;
esac
done
# Print installation splash screen and basic information
if [ $qflag -eq 0 ]; then
clear
echof "------------------------------------------------------------------------"
echof "-- $ENTRY0004"
echof "-- $ENTRY0009 $MAJORVERSION.$MINORVERSION"
echof "------------------------------------------------------------------------"
echof ""
echof "$ENTRY0011:"
echof " 1. $ENTRY0014"
echof " 2. $ENTRY0015"
echof ""
fi
# Prompt user for new install vs upgrade
if [ $tflag -eq 0 ]; then
wflag=0
while [ $wflag -eq 0 ]; do
echof "$ENTRY0005 [$ENTRY0008: 1]"
echof " 1. $ENTRY0006"
echof " 2. $ENTRY0007"
$echo "-> ${nnl}"
read ans
case $ans in
""|1) upgrade=0
wflag=1
;;
2) upgrade=1
wflag=1
;;
*) echof "$ENTRY0010"
;;
esac
echof ""
done
fi
# Warn user to backup before proceeding
if [ $upgrade -eq 1 ] && [ $qflag -eq 0 ]; then
echof "$ENTRY0012"
echof ""
fi
# Finish verification of directory entered as a command line option based on installation type.
if [ $dflag -eq 1 ]; then
# Check if $INSTALLDIR does not exist
if [ ! -d "$INSTALLDIR" ]; then
if [ $upgrade -eq 0 ]; then
mkdir "$INSTALLDIR"
if [ $? -gt 0 ]; then
echof "## $ENTRY0001: $ENTRY0024: $INSTALLDIR"
exit 1
fi
else
echof "## $ENTRY0001: $ENTRY0020: $INSTALLDIR"
exit 1
fi
# Check if $INSTALLDIR is not writeable
elif [ ! -w "$INSTALLDIR" ]; then
echof "## $ENTRY0001: $ENTRY0025: $INSTALLDIR"
exit 1
fi
fi
# Verify the port is available if this is a new installation and the port was a command line option.
if [ $upgrade -eq 0 ] && [ $pflag -eq 1 ]; then
"$INSPECTOR" -P $PORT
if [ $? -ne 0 ]; then
echof "## $ENTRY0001: $ENTRY0037: $PORT"
exit 1
fi
fi
# ---Installation Directory---
# Perform necessary checks on the installation directory entered by the user
if [ $dflag -eq 0 ]; then
wflag=0
while [ $wflag -eq 0 ]; do
# Prompt user for installation directory
if [ $upgrade -eq 0 ]; then
echof "$ENTRY0016 [$ENTRY0008: $INSTALLDIR]:"
$echo "-> ${nnl}"
else
echof "$ENTRY0017 [$ENTRY0008: $INSTALLDIR]:"
$echo "-> ${nnl}"
fi
read dir
echof ""
# Assign default answer to $dir if nothing was entered
if [ "x$dir" = "x" ]; then
dir=$INSTALLDIR
fi
# Verify that $dir is not already a file
if [ -r "$dir" -o -w "$dir" -o -x "$dir" ] && [ ! -d "$dir" ]; then
if [ $upgrade -eq 0 ]; then
echof "$ENTRY0018: $dir"
else
echof "$ENTRY0019: $dir"
fi
echof ""
# Check if $dir does not exist
elif [ ! -d "$dir" ]; then
if [ $upgrade -eq 0 ]; then
echof "$ENTRY0020: $dir"
echof ""
wflag2=0
while [ $wflag2 -eq 0 ]; do
# Prompt user regarding creation of $dir
echof "$ENTRY0021 [$ENTRY0008: 1]"
echof " 1. $ENTRY0022"
echof " 2. $ENTRY0023"
$echo "-> ${nnl}"
read ans
case $ans in
""|1) mkdir "$dir"
if [ $? -gt 0 ]; then
echof "## $ENTRY0001: $ENTRY0024: $dir"
exit 1
fi
INSTALLDIR=$dir
wflag2=1
wflag=1
;;
2) wflag2=1
;;
*) echof "$ENTRY0010"
;;
esac
echof ""
done
else
echof "$ENTRY0020: $dir"
echof ""
fi
elif [ ! -w "$dir" ]; then
echof "$ENTRY0025"
echof ""
else
if [ $upgrade -eq 0 ]; then
wflag2=0
echof "$ENTRY0026"
while [ $wflag2 -eq 0 ]; do
echof "$ENTRY0027 [$ENTRY0008: 2]"
echof " 1. $ENTRY0022"
echof " 2. $ENTRY0023"
$echo "-> ${nnl}"
read ans
case $ans in
1) wflag2=1
INSTALLDIR=$dir
wflag=1
;;
""|2) wflag2=1
;;
*) echof "$ENTRY0010"
;;
esac
echof ""
done
else
if [ ! -f "$dir/bin/urchin" ]; then
echof "$ENTRY0028"
echof ""
else
INSTALLDIR=$dir
wflag=1
fi
fi
fi
done
fi
# Verify this is an upgrade and not a downgrade
if [ $upgrade -eq 1 ]; then
# Check the version number to make sure this is an upgrade and not a downgrade.
OLDVERSION=0
if [ -x "$INSTALLDIR/bin/urchin" ]; then
OLDVERSION=`"$INSTALLDIR/bin/urchin" -v | cut -d ":" -f 2 | cut -d " " -f 3 | cut -c 1,2,3,4`
fi
if [ $NEWVERSION -lt $OLDVERSION ]; then
echof "## $ENTRY0001: $ENTRY0038"
echof "$ENTRY0039: $OLDVERSION"
echof "$ENTRY0040: $NEWVERSION"
exit 1
fi
fi
# Determine the locations of the data and var directories from urchin.conf
INSTALLDATADIR="$INSTALLDIR/data"
INSTALLVARDIR="$INSTALLDIR/var"
if [ $upgrade -eq 1 ]; then
if [ $qflag -eq 0 ]; then
echof "$ENTRY0088"
fi
if [ -f "$INSTALLDIR/etc/urchin.conf" ]; then
DATADIR=`grep "^[ \t]*dataDirectory:" "$INSTALLDIR/etc/urchin.conf" | cut -d : -f 2 | sed -e 's/^[ \t]*//'`
VARDIR=`grep "^[ \t]*varDirectory:" "$INSTALLDIR/etc/urchin.conf" | cut -d : -f 2 | sed -e 's/^[ \t]*//'`
fi
if [ x$DATADIR != x ]; then
LETTER1=`echo "$DATADIR" | cut -c 1`
if [ x$LETTER1 = x/ ]; then
INSTALLDATADIR="$DATADIR"
else
INSTALLDATADIR="$INSTALLDIR/$DATADIR"
fi
fi
if [ x$VARDIR != x ]; then
LETTER1=`echo "$VARDIR" | cut -c 1`
if [ x$LETTER1 = x/ ]; then
INSTALLVARDIR="$VARDIR"
else
INSTALLVARDIR="$INSTALLDIR/$VARDIR"
fi
fi
# Verify that the data directory is a directory and is writable
if [ -r "$INSTALLDATADIR" -o -w "$INSTALLDATADIR" -o -x "$INSTALLDATADIR" ] && [ ! -d "$INSTALLDATADIR" ]; then
echof "## $ENTRY0001: $ENTRY0018: $INSTALLDATADIR"
echof "## $ENTRY0089"
exit 1
elif [ ! -d "$INSTALLDATADIR" ]; then
echof "## $ENTRY0001: $ENTRY0020: $INSTALLDATADIR"
echof "## $ENTRY0089"
exit 1
elif [ ! -w "$INSTALLDATADIR" ]; then
echof "## $ENTRY0001: $ENTRY0025: $INSTALLDATADIR"
echof "## $ENTRY0089"
exit 1
fi
# Verify that the var directory is a directory and is writable
if [ -r "$INSTALLVARDIR" -o -w "$INSTALLVARDIR" -o -x "$INSTALLVARDIR" ] && [ ! -d "$INSTALLVARDIR" ]; then
echof "## $ENTRY0001: $ENTRY0018: $INSTALLVARDIR"
echof "## $ENTRY0089"
exit 1
elif [ ! -d "$INSTALLVARDIR" ]; then
echof "## $ENTRY0001: $ENTRY0020: $INSTALLVARDIR"
echof "## $ENTRY0089"
exit 1
elif [ ! -w "$INSTALLVARDIR" ]; then
echof "## $ENTRY0001: $ENTRY0025: $INSTALLVARDIR"
echof "## $ENTRY0089"
exit 1
fi
if [ $qflag -eq 0 ]; then
echof ""
fi
fi
# Shutdown the webserver and scheduler if they are running
if [ -f "$INSTALLVARDIR/httpd.pid" ] || [ -f "$INSTALLVARDIR/urchind.pid" ] || [ -f "$INSTALLVARDIR/urchinwebd.pid" ]; then
if [ $qflag -eq 0 ]; then
echof "$ENTRY0041"
if [ -f "$INSTALLDIR/bin/wrapper" ]; then
cd "$INSTALLDIR/bin"
./wrapper -disable
cd "$CURRENTDIR"
else
"$INSTALLDIR/bin/urchinctl" stop
fi
echof ""
else
if [ -f "$INSTALLDIR/bin/wrapper" ]; then
cd "$INSTALLDIR/bin"
./wrapper -disable > /dev/null 2>&1
cd "$CURRENTDIR"
else
"$INSTALLDIR/bin/urchinctl" stop > /dev/null 2>&1
fi
fi
fi
# Verify the port is available if this is an upgrade and the port was a command line option.
if [ $upgrade -eq 1 ] && [ $pflag -eq 1 ]; then
"$INSPECTOR" -P $PORT
if [ $? -ne 0 ]; then
echof "## $ENTRY0001: $ENTRY0037: $PORT"
exit 1
fi
fi
# ---Webserver Configuration---
# Prompt user for the webserver port
if [ $pflag -eq 0 ]; then
wflag=0
while [ $wflag -eq 0 ]; do
if [ $upgrade -eq 0 ]; then
echof "$ENTRY0042 [$ENTRY0008: $PORT]"
$echo "-> ${nnl}"
else
port=0
if [ -r "$INSTALLVARDIR/urchinwebd.conf" ]; then
port=`grep "^Port" "$INSTALLVARDIR/urchinwebd.conf" | cut -d " " -f 2`
elif [ -r "$INSTALLDIR/etc/httpd.conf" ]; then
port=`grep "^Port" "$INSTALLDIR/etc/httpd.conf" | cut -d " " -f 2`
fi
if [ $port -ne 0 ]; then
PORT=$port
fi
echof "$ENTRY0042 [$ENTRY0008: $PORT]"
$echo "-> ${nnl}"
fi
read portin
echof ""
if [ x$portin = x ]; then
portin=$PORT
fi
if [ $MYLOGIN != root ] && [ $portin -lt 1024 ]; then
echof "$ENTRY0036"
echof ""
else
# Verify the port is available
"$INSPECTOR" -P $portin
if [ $? -ne 0 ]; then
echof "$ENTRY0037"
echof ""
else
PORT=$portin
wflag=1
fi
fi
done
fi
# Determine and verify the user
if [ $uflag -eq 0 ]; then
# If we're root, we can choose which user to run the webserver as
if [ $MYLOGIN = root ]; then
wflag=0
while [ $wflag -eq 0 ]; do
if [ $upgrade -eq 0 ]; then
echof "$ENTRY0043 [$ENTRY0008: $WUSER]"
$echo "-> ${nnl}"
else
if [ -r "$INSTALLVARDIR/urchinwebd.conf" ]; then
user=`grep "^User" "$INSTALLVARDIR/urchinwebd.conf" | cut -d " " -f 2`
elif [ -r "$INSTALLDIR/etc/httpd.conf" ]; then
user=`grep "^User" "$INSTALLDIR/etc/httpd.conf" | cut -d " " -f 2`
fi
if [ x$user != x ]; then
WUSER=$user
fi
echof "$ENTRY0043 [$ENTRY0008: $WUSER]"
$echo "-> ${nnl}"
fi
read userin
echof ""
if [ x$userin = x ]; then
userin=$WUSER
fi
if [ $userin = root ]; then
echof "$ENTRY0034"
echof ""
else
id $userin > /dev/null 2>&1
if [ $? -ne 0 ]; then
echof "$ENTRY0032"
echof ""
else
WUSER=$userin
wflag=1
fi
fi
done
fi
fi
# Determine and verify the group
if [ $gflag -eq 0 ]; then
# If we're root, we can choose which group to run the webserver as
if [ $MYLOGIN = root ]; then
wflag=0
while [ $wflag -eq 0 ]; do
if [ $OS = SunOS ]; then
if [ -f /usr/xpg4/bin/id ]; then
WGROUP=`/usr/xpg4/bin/id -gn $WUSER`
fi
else
WGROUP=`id -gn $WUSER`
fi
if [ x$WGROUP = x ]; then
WGROUP=`groups $WUSER | awk '{print $1}'`
fi
if [ $upgrade -eq 0 ]; then
echof "$ENTRY0044 [$ENTRY0008: $WGROUP]"
$echo "-> ${nnl}"
else
if [ -r "$INSTALLVARDIR/urchinwebd.conf" ]; then
group=`grep "^Group" "$INSTALLVARDIR/urchinwebd.conf" | cut -d " " -f 2`
elif [ -r "$INSTALLDIR/etc/httpd.conf" ]; then
group=`grep "^Group" "$INSTALLDIR/etc/httpd.conf" | cut -d " " -f 2`
fi
if [ x$group != x ]; then
WGROUP=$group
fi
echof "$ENTRY0044 [$ENTRY0008: $WGROUP]"
$echo "-> ${nnl}"
fi
read groupin
echof ""
if [ x$groupin = x ]; then
groupin=$WGROUP
fi
touch "$INSTALLDIR/.urchin$$"
chgrp $groupin "$INSTALLDIR/.urchin$$" > /dev/null 2>&1
if [ $? != 0 ]; then
echof "$ENTRY0029"
echof ""
else
WGROUP=$groupin
wflag=1
fi
rm "$INSTALLDIR/.urchin$$"
done
fi
fi
# Verify the user wishes to start the webserver and scheduler
if [ $sflag -eq 0 ]; then
wflag=0
while [ $wflag -eq 0 ]; do
echof "$ENTRY0045 [$ENTRY0008: 1]"
echof " 1. $ENTRY0022"
echof " 2. $ENTRY0023"
$echo "-> ${nnl}"
read ans
case $ans in
""|1) startservers=1
wflag=1
;;
2) startservers=0
wflag=1
;;
*) echof "$ENTRY0010"
;;
esac
echof ""
done
fi
# Print summary information for installation
if [ $qflag -eq 0 ]; then
echof "------------------------------------------------------------------------"
echof "-- $ENTRY0046"
if [ $upgrade -eq 0 ]; then
echof "-- $ENTRY0047 $MAJORVERSION.$MINORVERSION"
else
echof "-- $ENTRY0048 $MAJORVERSION.$MINORVERSION"
fi
echof "------------------------------------------------------------------------"
echof ""
echof "$ENTRY0049: $INSTALLDIR"
echof "$ENTRY0050: $PORT"
echof "$ENTRY0051: $WUSER"
echof "$ENTRY0052: $WGROUP"
if [ $startservers -eq 1 ]; then
echof "$ENTRY0053: $ENTRY0022"
else
echof "$ENTRY0053: $ENTRY0023"
fi
echof ""
fi
# Prompt user to continue or exit
if [ $qflag -eq 0 ]; then
wflag=0
while [ $wflag -eq 0 ]; do
echof "$ENTRY0055 [$ENTRY0008: 1]"
echof " 1. $ENTRY0059"
echof " 2. $ENTRY0086"
$echo "-> ${nnl}"
read ans
case $ans in
""|1) wflag=1
;;
2) if [ $upgrade -eq 1 ]; then
echof "$ENTRY0087"
if [ -f "$INSTALLDIR/bin/urchinctl" ]; then
"$INSTALLDIR/bin/urchinctl" start
elif [ -f "$INSTALLDIR/bin/wrapper" ]; then
cd "$INSTALLDIR/bin"
./wrapper -enable
cd "$CURRENTDIR"
fi
fi
exit 0
;;
*) echof "$ENTRY0010"
;;
esac
done
echof ""
fi
# Backup configuration databases and files
if [ $upgrade -eq 1 ]; then
if [ $qflag -eq 0 ]; then
echof "$ENTRY0056"
"$INSTALLDIR/util/uconf-export" -f "$INSTALLDIR/util/conf.backup.$NOW"
echof ""
else
"$INSTALLDIR/util/uconf-export" -f "$INSTALLDIR/util/conf.backup.$NOW" > /dev/null 2>&1
fi
SESSIONCONF="$INSTALLDIR/etc/session.conf"
URCHINCONF="$INSTALLDIR/etc/urchin.conf"
HTTPDCONF="$INSTALLDIR/etc/httpd.conf"
URCHINWEBDCONF="$INSTALLVARDIR/urchinwebd.conf.template"
if [ -f "$SESSIONCONF" ]; then
mv "$SESSIONCONF" "$SESSIONCONF.sav$NOW"
fi
if [ -f "$URCHINCONF" ]; then
mv "$URCHINCONF" "$URCHINCONF.sav$NOW"
fi
if [ -f "$HTTPDCONF" ]; then
mv "$HTTPDCONF" "$HTTPDCONF.sav$NOW"
fi
if [ -f "$URCHINWEBDCONF" ]; then
mv "$URCHINWEBDCONF" "$URCHINWEBDCONF.sav$NOW"
fi
fi
# Uncompress and extract files into the installation directory
if [ $upgrade -eq 0 ]; then
if [ $qflag -eq 0 ]; then
echof "$ENTRY0058"
echof ""
fi
"$GUNZIP" -c "$DIST" | (cd "$INSTALLDIR"; tar xf -)
else
if [ $qflag -eq 0 ]; then
echof "$ENTRY0062"
echof ""
fi
if [ ! -d "$INSTALLERDIR/tmp.$NOW.$$" ]; then
mkdir "$INSTALLERDIR/tmp.$NOW.$$"
if [ $? -gt 0 ]; then
echof "## $ENTRY0001: $ENTRY0024: $INSTALLERDIR/tmp.$NOW.$$"
exit 1
fi
fi
"$GUNZIP" -c "$DIST" | (cd "$INSTALLDIR"; tar xf - bin doc etc htdocs lib util)
"$GUNZIP" -c "$DIST" | (cd "$INSTALLERDIR/tmp.$NOW.$$"; tar xf - data var)
cd "$INSTALLERDIR/tmp.$NOW.$$/data"
tar cf - admin cache conf geodata history logs reports session | (cd "$INSTALLERDIR"; cd "$INSTALLDATADIR"; tar xf -)
cd "$INSTALLERDIR/tmp.$NOW.$$/var"
tar cf - * | (cd "$INSTALLERDIR"; cd "$INSTALLVARDIR"; tar xf -)
cd "$INSTALLERDIR"
/bin/rm -rf "$INSTALLERDIR/tmp.$NOW.$$"
fi
# Create webserver configuration template and startup/shutdown script
if [ $qflag -eq 0 ]; then
echof "$ENTRY0060"
echof ""
fi
sed -e "s^XXXUSERXXX^${WUSER}^" -e "s^XXXGROUPXXX^${WGROUP}^" "$INSTALLVARDIR/urchinwebd_unix.conf.template" > "$INSTALLVARDIR/urchinwebd.conf.template"
rm -f "$INSTALLVARDIR/urchinwebd_unix.conf.template"
sed -e "s^XXXINSTALLDIRXXX^${INSTALLDIR}^" "$INSTALLDIR/util/urchin_daemons.template" > "$INSTALLDIR/util/urchin_daemons"
# Save distributed configuration files with .dist extension
if [ -f "$SESSIONCONF" ]; then
cp "$SESSIONCONF" "$SESSIONCONF.dist"
fi
if [ -f "$URCHINCONF" ]; then
cp "$URCHINCONF" "$URCHINCONF.dist"
fi
if [ -f "$URCHINWEBDCONF" ]; then
cp "$URCHINWEBDCONF" "$URCHINWEBDCONF.dist"
fi
# Copy saved configuration files back into position
if [ $upgrade -eq 1 ]; then
if [ -f "$SESSIONCONF.sav$NOW" ] && [ $OLDVERSION -ge "5000" ]; then
cp "$SESSIONCONF.sav$NOW" "$SESSIONCONF"
fi
if [ -f "$URCHINCONF.sav$NOW" ]; then
cp "$URCHINCONF.sav$NOW" "$URCHINCONF"
fi
if [ -f "$URCHINWEBDCONF.sav$NOW" ]; then
sed -e "s/^User[ \t].*/User ${WUSER}/" -e "s/^Group[ \t].*/Group ${WGROUP}/" "$URCHINWEBDCONF.sav$NOW" > "$URCHINWEBDCONF"
fi
fi
# Warn users if configuration files differ from distributed files
if [ $upgrade -eq 1 ]; then
if [ -f "$SESSIONCONF" ] && [ -f "$SESSIONCONF.dist" ]; then
`diff "$SESSIONCONF" "$SESSIONCONF.dist" > /dev/null 2>&1`
if [ $? -ne 0 ]; then
echof "## $ENTRY0090: $ENTRY0057: $SESSIONCONF"
echof ""
fi
fi
if [ -f "$URCHINCONF" ] && [ -f "$URCHINCONF.dist" ]; then
`diff "$URCHINCONF" "$URCHINCONF.dist" > /dev/null 2>&1`
if [ $? -ne 0 ]; then
echof "## $ENTRY0090: $ENTRY0057: $URCHINCONF"
echof ""
fi
fi
if [ -f "$URCHINWEBDCONF" ] && [ -f "$URCHINWEBDCONF.dist" ]; then
`diff "$URCHINWEBDCONF" "$URCHINWEBDCONF.dist" > /dev/null 2>&1`
if [ $? -ne 0 ]; then
echof "## $ENTRY0090: $ENTRY0057: $URCHINWEBDCONF"
echof ""
fi
fi
fi
# Move the domain databases into place if they don't exist
if [ ! -f "$INSTALLDATADIR/geodata/domain.unf" ] || [ ! -f "$INSTALLDATADIR/geodata/domain.unh" ] || [ ! -f "$INSTALLDATADIR/geodata/domain.uni" ] || [ ! -f "$INSTALLDATADIR/geodata/domain.uns" ]; then
mv "$INSTALLDATADIR/geodata/.domain.unf" "$INSTALLDATADIR/geodata/domain.unf"
mv "$INSTALLDATADIR/geodata/.domain.unh" "$INSTALLDATADIR/geodata/domain.unh"
mv "$INSTALLDATADIR/geodata/.domain.uni" "$INSTALLDATADIR/geodata/domain.uni"
mv "$INSTALLDATADIR/geodata/.domain.uns" "$INSTALLDATADIR/geodata/domain.uns"
else
rm "$INSTALLDATADIR/geodata/.domain.unf"
rm "$INSTALLDATADIR/geodata/.domain.unh"
rm "$INSTALLDATADIR/geodata/.domain.uni"
rm "$INSTALLDATADIR/geodata/.domain.uns"
fi
if [ ! -f "$INSTALLDATADIR/geodata/domain.local" ]; then
mv "$INSTALLDATADIR/geodata/.domain.local" "$INSTALLDATADIR/geodata/domain.local"
else
rm "$INSTALLDATADIR/geodata/.domain.local"
fi
# Remove outdated files (for upgrade only)
if [ $upgrade -eq 1 ]; then
# For upgrade from 4.006 to 4.100+
rm -f "$INSTALLDIR/bin/httpd"
rm -f "$INSTALLDIR/bin/httpdctl.sh"
rm -f "$INSTALLDIR/bin/urchindctl.sh"
rm -f "$INSTALLDIR/bin/wrapper"
rm -f "$INSTALLDIR/etc/httpd.conf"
rm -f "$INSTALLDIR/etc/httpd.conf.template"
rm -f "$INSTALLDIR/etc/httpd.conf.template_unix"
# For upgrade from 4.002 to 4.003+
rm -f "$INSTALLDIR/htdocs/ujs/calender.js"
# For upgrade from 4.101 to 4.102+
rm -f "$INSTALLDIR/util/setup_conf.sh"
# For upgrade from 4.102+ to 5.000
rm -rf "$INSTALLDIR/lib/languages"
rm -rf "$INSTALLDIR/lib/templates"
rm -rf "$INSTALLDIR/lib/ugroups"
rm -rf "$INSTALLDIR/lib/views"
fi
# Initialize or update the configuration databases
if [ $upgrade -eq 0 ]; then
if [ $qflag -eq 0 ]; then
echof "$ENTRY0061"
echof ""
"$INSTALLDIR/util/uconf-import" -r -f "$INSTALLDIR/util/initialdb.config"
echof ""
else
"$INSTALLDIR/util/uconf-import" -r -f "$INSTALLDIR/util/initialdb.config" > /dev/null 2>&1
fi
else
if [ $qflag -eq 0 ]; then
echof "$ENTRY0063"
echof ""
"$INSTALLDIR/util/uconf-import" -f "$INSTALLDIR/util/initialdb.config"
echof ""
else
"$INSTALLDIR/util/uconf-import" -f "$INSTALLDIR/util/initialdb.config" > /dev/null 2>&1
fi
fi
# Update __domaindb task with day/time for download
SETDATE=`"$INSTALLDIR/util/uconf-driver" table=task name=__domaindb action=get_parameter parameter=ct_setdate`
if [ "x$SETDATE" != "x1" ]; then
DAY=`date +%d`
if [ $DAY -eq 1 ]; then
DAY=28
else
DAY=`expr $DAY - 1`
fi
if [ $DAY -lt 1 ] || [ $DAY -gt 28 ]; then
DAY=1
fi
HOUR=`date +%H`
if [ $HOUR -lt 0 ] || [ $HOUR -gt 23 ]; then
HOUR=0
fi
MIN=`date +%M`
if [ $MIN -lt 0 ] || [ $MIN -gt 59 ]; then
MIN=0
fi
"$INSTALLDIR/util/uconf-driver" action=set_parameter cs_dom=$DAY table=task name=__domaindb > /dev/null 2>&1
"$INSTALLDIR/util/uconf-driver" action=set_parameter cs_hour=$HOUR table=task name=__domaindb > /dev/null 2>&1
"$INSTALLDIR/util/uconf-driver" action=set_parameter cs_minute=$MIN table=task name=__domaindb > /dev/null 2>&1
"$INSTALLDIR/util/uconf-driver" action=set_parameter ct_setdate=1 table=task name=__domaindb > /dev/null 2>&1
fi
# Set the user and group on the installed files.
# Only change owner if installer is run as root
if [ $qflag -eq 0 ]; then
echof "$ENTRY0064"
if [ $MYLOGIN = root ]; then
chown -R $WUSER "$INSTALLDIR"
chown -R $WUSER "$INSTALLDATADIR"
fi
chgrp -R $WGROUP "$INSTALLDIR"
chgrp -R $WGROUP "$INSTALLDATADIR"
# Use the installed inspector in repair mode to set the permissions of the files
"$INSTALLDIR/util/inspector" -R
if [ $? -ne 0 ]; then
echof ""
echof "## $ENTRY0001: $ENTRY0067"
fi
echof ""
else
if [ $MYLOGIN = root ]; then
chown -R $WUSER "$INSTALLDIR"
chown -R $WUSER "$INSTALLDATADIR"
fi
chgrp -R $WGROUP "$INSTALLDIR"
chgrp -R $WGROUP "$INSTALLDATADIR"
# Use the installed inspector in repair mode to set the permissions of the files
"$INSTALLDIR/util/inspector" -R > /dev/null 2>&1
if [ $? -ne 0 ]; then
echof "## $ENTRY0001: $ENTRY0067"
fi
fi
# Start the Urchin webserver and scheduler daemon
if [ $startservers -eq 1 ]; then
if [ $qflag -eq 0 ]; then
echof "$ENTRY0065"
"$INSTALLDIR/bin/urchinctl" -p $PORT start
echof ""
else
"$INSTALLDIR/bin/urchinctl" -p $PORT start > /dev/null 2>&1
fi
else
"$INSTALLDIR/bin/urchinctl" -p $PORT status > /dev/null 2>&1
fi
# Administrative announcements
if [ $qflag -eq 0 ]; then
echof "------------------------------------------------------------------------"
echof "-- $ENTRY0066"
echof "------------------------------------------------------------------------"
echof ""
if [ $startservers -eq 1 ]; then
echof "$ENTRY0068"
else
echof "$ENTRY0069"
fi
echof ""
echof " http://${HOST}:${PORT}/"
echof ""
echof "$ENTRY0071"
echof ""
echof "$ENTRY0070"
fi
|