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
|
$NetBSD: patch-aa,v 1.1.1.1 2000/10/21 19:02:32 rh Exp $
--- install.pl.orig Sat Sep 23 20:15:46 2000
+++ install.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!@@PREFIX@@/bin/perl
#This is the install utility for ISPMan
#I wrote it origionally for Slashcode some time back, but have modified it to be used with ISPMan.
@@ -14,7 +14,6 @@
$HOSTNAME=$ENV{'HOSTNAME'}||`hostname`;
chomp $HOSTNAME;
$PWD=$ENV{'PWD'};
-system("clear");
#this hashref defines sections that we need to configure and their descriptions.
#each key is a section eg ldap, mail, dns etc
@@ -57,7 +56,7 @@
dns_vars => {
'description' => qq|
These are DNS (named) specific variables
- will put an empty named.conf.header and named.conf.footer in /etc/ispman/templates
+ will put an empty named.conf.header and named.conf.footer in @@PREFIX@@/etc/ispman/templates
directory for you which you can later change according to your network.
If you already have these files in place then they will be left untouched.
|,
@@ -122,55 +121,55 @@
},
apacheVhostsDir => {
- default => '/home/httpd/virtual',
+ default => '@@HTDOCS@@',
question => "Directory where the VirtualHosts will be kept\nEach domain will have its entry within this directory \nand each subhost will be created underneath that directory",
},
apacheVhostsFile => {
- default => '/etc/httpd/conf/vhosts.conf',
+ default => '@@PREFIX@@/etc/httpd/vhosts.conf',
question => "The file where I should create VirtualHost Entries",
},
apacheVhostsHeader => {
- default => '/etc/ispman/templates/vhosts.conf.header',
+ default => '@@PREFIX@@/etc/ispman/templates/vhosts.conf.header',
question => "I will prepend this file to the VirtualHosts file",
},
apacheVhostsTemplate => {
- default => '/etc/ispman/templates/vhosts.template',
+ default => '@@PREFIX@@/etc/ispman/templates/vhosts.template',
question => "This is the template that will be used when creating config for Virtualhosts\nIf it does not exists then it will be created for you",
},
apacheVhostsIP=> {
- default => '192.168.1.1',
+ default => '@@IP@@',
question => "This is the ip address that all virtual hosts will share",
},
apacheVhostsFooter => {
- default => '/etc/ispman/templates/vhosts.conf.footer',
+ default => '@@PREFIX@@/etc/ispman/templates/vhosts.conf.footer',
question => "I will append this file to the VirtualHosts file",
},
apacheReloadCommand => {
- default => '/etc/rc.d/init.d/httpd reload',
+ default => '@@PREFIX@@/etc/rc.d/apache restart',
question => "Command to reload apache.\nIf this command is present then it will be used instead \nof stoping and starting the daemon",
},
apacheStopCommand => {
- default => '/etc/rc.d/init.d/httpd stop',
+ default => '@@PREFIX@@/etc/rc.d/apache stop',
question => "Command to stop apache",
},
apacheStartCommand => {
- default => '/etc/rc.d/init.d/httpd start',
+ default => '@@PREFIX@@/etc/rc.d/apache start',
question => "Command to start apache",
},
@@ -179,7 +178,7 @@
ldapInstallPath => {
- default => '/etc/openldap',
+ default => '@@PREFIX@@/etc/openldap',
question => "path to ldap conf directory.",
},
@@ -205,7 +204,7 @@
},
imapHosts => {
- default => 'mail',
+ default => 'localhost',
question => "List all Cyrus mail servers that you have separated by space",
},
@@ -261,49 +260,49 @@
},
namedStopCommand => {
- default => '/etc/rc.d/init.d/named stop',
+ default => '/etc/rc.d/named stop',
question => "Command to stop named",
},
namedConfFile => {
- default => '/etc/named.conf',
+ default => '/etc/namedb/named.conf',
question => "Configuration file for named",
},
namedStartCommand => {
- default => '/etc/rc.d/init.d/named start',
+ default => '/etc/rc.d/named start',
question => "Command to start named",
},
namedConfHeaderFile => {
- default => '/etc/ispman/templates/named.conf.header',
+ default => '@@PREFIX@@/etc/ispman/templates/named.conf.header',
question => "Header file that I should prepend to the generated named.conf",
},
namedConfFooterFile => {
- default => '/etc/ispman/templates/named.conf.footer',
+ default => '@@PREFIX@@/etc/ispman/templates/named.conf.footer',
question => "Header file that I should append to the generated named.conf",
},
dnsMasterEmail => {
- default => 'hostsmaster.yourdomain',
+ default => 'hostmaster.yourdomain',
question => "Emailaddress of the dns master.\nThis is for SOA record",
},
rootEmail => {
- default => 'root@%%hostname%%',
+ default => 'root@localhost',
question => "Email of the administrator.\nThis email adress is used to send emails if something fails",
},
installDir => {
- default => '/opt/ispman',
- question => "Directory where you want to install ispman components.\nYou may choose to install in on an NFS partition so that you can share the same files with multiple machines.\nIt is recommended to install at /opt/ispman",
+ default => '@@PREFIX@@/share/ispman',
+ question => "Directory where you want to install ispman components.\nYou may choose to install in on an NFS partition so that you can share the same files with multiple machines.\nIt is recommended to install at @@PREFIX@@/share/ispman",
},
sleepSecondsBetweenRestart => {
@@ -315,10 +314,10 @@
};
-if (-e "/etc/ispman/conf/ispman.conf"){
+if (-e "@@PREFIX@@/etc/ispman/ispman.conf"){
$ISUPDATE=1;
print "Existing ISPMan installation Exists\nReading defaults from config file\n";
- do "/etc/ispman/conf/ispman.conf";
+ do "@@PREFIX@@/etc/ispman/ispman.conf";
*Config=*ISPMan::Config;
$Config->{'imapHosts'}=join " ", @{$Config->{'imapHosts'}};
for (keys %$Config){
@@ -362,12 +361,7 @@
print getVar($_, 'default');
print "]: ";
}
- chomp(my $answer=<>);
- if ($answer) {
- $vars->{$_}{'default'}=$answer;
- } else {
- $vars->{$_}{'default'}=getVar($_, 'default');
- }
+ $vars->{$_}{'default'}=getVar($_, 'default');
}
}
@@ -376,10 +370,8 @@
sub write_config {
- system("clear");
- print "Writting ispman.conf";
- backup("/etc/ispman/conf/ispman.conf");
- open ("F", ">/etc/ispman/conf/ispman.conf") or die "Cant open x";
+ print "Writting ispman.conf.default";
+ open ("F", ">@@PREFIX@@/etc/ispman/ispman.conf.default") or die "Cant open x";
print F "package ISPMan;\n";
my $key;
@@ -411,16 +403,14 @@
- print "\nWritting /etc/ispman/templates/domain.ldif.template\n";
+ print "\nWritting @@PREFIX@@/etc/ispman/templates/domain.ldif.template.default\n";
print "This template is an ldif template that is used when creating a new domain\n";
print "This template has probably my site defaults. You may want to change it a bit\n";
- backup("/etc/ispman/templates/domain.ldif.template");
- system("cp install-data/domain.ldif.template.dist /etc/ispman/templates/domain.ldif.template");
+ system("cp install-data/domain.ldif.template.dist @@PREFIX@@/etc/ispman/templates/domain.ldif.template.default");
- print "\nWritting /etc/ispman/templates/vhosts.conf.template\n";
- backup("/etc/ispman/templates/vhosts.conf.template");
- system("cp install-data/vhosts.conf.template.dist /etc/ispman/templates/vhosts.conf.template");
+ print "\nWritting @@PREFIX@@/etc/ispman/templates/vhosts.conf.template.default\n";
+ system("cp install-data/vhosts.conf.template.dist @@PREFIX@@/etc/ispman/templates/vhosts.conf.template.default");
}
@@ -442,7 +432,7 @@
print "*"x72, "\n";
if ($vars_info->{$_}{'optional'}) {
print "You may skip this section to get the default values\nDo you want to set them up? y/n [y] ";
- chomp(my $ans=<>);
+ my $ans="n";
if ($ans=~/^\s*n/i){
setDefaults(@{$vars_info->{$_}{'vars'}});
next;
@@ -450,19 +440,16 @@
$vars_info->{$_}{'set'}=1;
}
configure(@{$vars_info->{$_}{'vars'}});
- system("clear");
}
make_directories();
write_config();
}
sub make_directories{
- system("clear");
print "\n\nMaking required directories\n";
system(qq|
- mkdir -p /etc/ispman/templates
- mkdir -p /etc/ispman/conf
+ mkdir -p @@PREFIX@@/etc/ispman/templates
mkdir -p $vars->{'installDir'}{'default'}
|);
@@ -475,22 +462,22 @@
print "Copying cgi-bin to $vars->{'installDir'}{'default'}/ \n";
- system("cp -a ispman-web/cgi-bin $vars->{'installDir'}{'default'}/");
+ system("cp -R ispman-web/cgi-bin $vars->{'installDir'}{'default'}/");
print "Copying htdocs to $vars->{'installDir'}{'default'}/ \n";
- system("cp -a ispman-web/htdocs $vars->{'installDir'}{'default'}/");
+ system("cp -R ispman-web/htdocs $vars->{'installDir'}{'default'}/");
print "Copying bin to $vars->{'installDir'}{'default'}/ \n";
- system("cp -a ispman-utils/bin $vars->{'installDir'}{'default'}/");
+ system("cp -R ispman-utils/bin $vars->{'installDir'}{'default'}/");
print "\nMaking dummy named.conf and vhosts.conf header and footer files\n";
system (qq|
- echo '#this is a named.conf.header file' > $vars->{'namedConfHeaderFile'}{'default'}
- echo '#this is a named.conf.footer file' > $vars->{'namedConfFooterFile'}{'default'}
- echo '#this is a vhosts.conf.header file' > $vars->{'apacheVhostsHeader'}{'default'}
- echo '#this is a vhosts.conf.footer file' > $vars->{'apacheVhostsFooter'}{'default'}
+ echo '#this is a named.conf.header file' > "$vars->{'namedConfHeaderFile'}{'default'}.default"
+ echo '#this is a named.conf.footer file' > "$vars->{'namedConfFooterFile'}{'default'}.default"
+ echo '#this is a vhosts.conf.header file' > "$vars->{'apacheVhostsHeader'}{'default'}.default"
+ echo '#this is a vhosts.conf.footer file' > "$vars->{'apacheVhostsFooter'}{'default'}.default"
|);
}
@@ -501,7 +488,7 @@
sub makeldif{
print "\n\nMaking default ldif file. ispman.ldif\n\n";
-open "F", ">ispman.ldif";
+open "F", ">ispman.ldif.default";
print F qq|dn: $vars->{'ldapBaseDN'}{'default'}
objectclass: top
objectclass: organisation
@@ -570,13 +557,12 @@
sub make_ldap_conf {
print "\n\nShall I make ldap.conf for you? [Y/n]";
- my $install=<>; chomp $install;
+ my $install="y";
if ($install =~/^n$/i){
print "OK\n";
} else {
print "Installing ldap.conf\n";
- backup("$vars->{'ldapInstallPath'}{'default'}/ldap.conf");
- open "F", ">$vars->{'ldapInstallPath'}{'default'}/ldap.conf";
+ open "F", ">$vars->{'ldapInstallPath'}{'default'}/ldap.conf.ispman";
print F "host $vars->{'ldapHost'}{'default'}\n";
print F "base $vars->{'ldapBaseDN'}{'default'}\n";
print F "pam_login_attribute uid\n";
@@ -589,13 +575,12 @@
sub make_slapd_conf {
print "Shall I make slapd.conf for you? [Y/n]";
- my $install=<>; chomp $install;
+ my $install="y";
if ($install =~/^n$/i){
print "OK\n";
} else {
- backup("$vars->{'ldapInstallPath'}{'default'}/slapd.conf");
- open "F", ">$vars->{'ldapInstallPath'}{'default'}/slapd.conf";
+ open "F", ">$vars->{'ldapInstallPath'}{'default'}/slapd.conf.ispman";
print F qq|
include $vars->{'ldapInstallPath'}{'default'}/slapd.at.conf
include $vars->{'ldapInstallPath'}{'default'}/slapd.oc.conf
@@ -625,7 +610,6 @@
make_slapd_conf();
install();
-system("clear");
print "Enjoy!\n";
print qq|
I have created an ldif file ispman.ldif
|