Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 876 lines (753 sloc) 19.287 kb
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
1 use ExtUtils::MakeMaker;
2 require ExtUtils::Install;
3
4 BEGIN {
5 eval {
6 require FindBin;
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
7 chdir $FindBin::RealBin;
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
8 };
9 }
10
11 use Config;
12
13 use File::Copy;
14 use File::Path;
15 use File::Basename;
16 use File::Find;
17 use Data::Dumper;
18 use Cwd;
19 require 5.005;
20
21 use strict;
22
23 use vars (qw($VERSION $DOWARN));
24
25 my $TermRead;
26 my $Prompt_sub;
27 my @mods_to_get;
3223dc6 @perusionmike Added warning about removing .old and .old~ files left from
perusionmike authored
28 my @remove_old;
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
29 my $Lock_troubles;
30
09d6467 @perusionmike * Major changes to the Interchange output model and UI.
perusionmike authored
31 $VERSION = '4.9.7';
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
32
33 my @os_hints;
34 eval {
35 # gets package 'mvhints'
36 require 'hints.pl';
37 @os_hints = mvhints::get_hints();
38 };
39
40 my @chown_files = qw/
41 error.log
42 etc
43 /;
44
45 # Now we can use the libraries
46 use lib './lib';
47
48
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
49 my $origdir = cwd();
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
50
51 # See if we have Term::ReadLine::Perl
52 eval {
53 require Term::ReadLine;
54 require Term::ReadLine::Perl;
55 require Term::ReadKey;
56 $TermRead = 1;
57 };
58 unless($@) {
59 $ENV{PERL_RL} = 'Perl';
60 }
61
62 my $term;
63 if($TermRead) {
07782e4 @perusionmike * Handle error if Term::Readline::Perl can't open tty.
perusionmike authored
64 eval {
65 $term = new Term::ReadLine 'MakeFile';
66 };
67
68 ! $@ and $Prompt_sub = sub {
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
69 my($prompt, $default) = @_;
70 $prompt .= "[$default] "
71 if defined $default && !$ENV{PERL_RL};
72 return $term->readline($prompt, $default);
73 };
74 }
75
76 sub compare_file {
77 my($first,$second) = @_;
78 return 0 unless -s $first == -s $second;
79 local $/;
80 open(FIRST, $first) or return undef;
81 open(SECOND, $second) or (close FIRST and return undef);
82 binmode(FIRST);
83 binmode(SECOND);
84 $first = '';
85 $second = '';
86 while($first eq $second) {
87 read(FIRST, $first, 1024);
88 read(SECOND, $second, 1024);
89 last if length($first) < 1024;
90 }
91 close FIRST;
92 close SECOND;
93 $first eq $second;
94 }
95
5655697 @perusionmike Got sick of the problems with filename.old laying around and causing
perusionmike authored
96 sub get_rename {
97 my ($bn, $extra) = @_;
98 $bn =~ s:(.*/)::;
99 my $dn = $1;
100 $extra = '~' if ! $extra;
101 return $dn . "/.$extra." . $bn;
102 }
103
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
104 sub install_file {
105 my ($srcdir, $targdir, $filename) = @_;
106 my $srcfile = $srcdir . '/' . $filename;
107 my $targfile = $targdir . '/' . $filename;
108 my $mkdir = File::Basename::dirname($targfile);
109 my $extra;
110 my $perms;
111
112 if(! -d $mkdir) {
113 File::Path::mkpath($mkdir)
114 or die "Couldn't make directory $mkdir: $!\n";
115 }
116
117 if (! -f $srcfile) {
118 die "Source file $srcfile missing.\n";
119 }
120 else {
121 $perms = (stat(_))[2] & 0777;
122 }
123
124 if( -f $targfile and ! compare_file($srcfile, $targfile) ) {
125 open (GETVER, $targfile)
126 or die "Couldn't read $targfile for version update: $!\n";
127 while(<GETVER>) {
128 /VERSION\s+=.*?\s+([\d.]+)/ or next;
129 $extra = $1;
130 $extra =~ tr/0-9//cd;
131 last;
132 }
5655697 @perusionmike Got sick of the problems with filename.old laying around and causing
perusionmike authored
133 $extra = '~' unless $extra;
134 my $rename = get_rename($targfile, $extra);
135 while (-f $rename ) {
136 push @remove_old, $rename;
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
137 $extra .= '~';
5655697 @perusionmike Got sick of the problems with filename.old laying around and causing
perusionmike authored
138 $rename = get_rename($targfile, $extra);
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
139 }
5655697 @perusionmike Got sick of the problems with filename.old laying around and causing
perusionmike authored
140 push @remove_old, $rename;
141 rename $targfile, $rename
142 or die "Couldn't rename $targfile to $rename: $!\n";
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
143 }
144
145 File::Copy::copy($srcfile, $targfile)
146 or die "Copy of $srcfile to $targfile failed: $!\n";
147 chmod $perms, $targfile;
148
149 }
150
151 sub copyright_prompt {
152
153 print <<EOF;
154
d6dc450 @perusionmike Changed Interchange name all over, minor exceptions being mvfaq.pod and
perusionmike authored
155 Interchange V$VERSION
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
156
3b3741f @jonjensen Note Perl 5.6 requirement and update a few copyright notices.
jonjensen authored
157 Copyright (C) 1996-2003 Red Hat, Inc., and Interchange Development Group.
d6dc450 @perusionmike Changed Interchange name all over, minor exceptions being mvfaq.pod and
perusionmike authored
158 Interchange is free under the terms of the GNU General Public License.
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
159
60c4edb @jonjensen Update some notices, URLs, etc.
jonjensen authored
160 http://www.icdevgroup.org/
161
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
162 EOF
163 }
164
165 sub my_prompt {
166 return $_[1] if $MV::Default{force};
167 return &$Prompt_sub(@_)
168 if defined $Prompt_sub;
169 my($pr) = shift || '? ';
170 my($def) = shift;
171 my($ans);
172
173 print $pr;
174 print "[$def] " if $def;
175 chomp($ans = <STDIN>);
176 $ans ? $ans : $def;
177 }
178
179
180 sub extra_libs {
181
182 my ($realdir) = @_;
183 # Do the extra library checks
184
185 my @extra_lib_dirs;
186 my @extra_lib_files;
187
188 eval {
189 require IniConf;
190 };
191 if ($@) {
192 push @extra_lib_files, 'IniConf.pm';
193 }
194
195 eval {
196 require HTML::Entities;
197 };
198 if ($@) {
199 push @extra_lib_dirs, 'HTML';
200 push @extra_lib_files, 'HTML/Entities.pm';
201 }
202
203 eval {
204 require Business::UPS;
205 };
206 if ($@) {
207 push @extra_lib_dirs, 'Business';
208 push @extra_lib_files, 'Business/UPS.pm';
209 }
210
211 eval {
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
212 require Tie::ShadowHash;
213 };
214 if ($@) {
215 push @extra_lib_dirs, 'Tie';
216 push @extra_lib_files, 'Tie/ShadowHash.pm';
217 }
218
219 eval {
220 require Business::Fedex;
221 };
222 if ($@) {
223 push @extra_lib_dirs, 'Business';
224 push @extra_lib_files, 'Business/Fedex.pm';
225 }
226
227 eval {
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
228 require Storable;
229 };
230 unless ($@) {
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
231 my $def = 's';
232 print <<EOF if $MV::Default{storable};
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
233
234 You appear to have Raphael Manfredi's Storable module installed.
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
235 This module will significantly improve your DBM storage and fetch times.
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
236
237 You can reply one of:
238
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
239 n -- Don't use Storable
240 s -- Use for sessions only, won't break existing databases
241 y -- Use for both sessions and databases
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
242
592149b @perusionmike Adjustments and finagling after testing of latest software. Many minor c...
perusionmike authored
243 It is recommended that all installations reply S unless there is a need for
ac362a5 fixed some minivend/interchange naming issues in documentation
Eric Zarko authored
244 improved performance in Interchange DBM databases.
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
245
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
246 If you reply YES and you use any GDBM or DB_File databases they will
247 NEED TO BE REMADE for ALL CATALOGS using this Interchange server instance.
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
248 EOF
249
250 if($ENV{MINIVEND_STORABLE_DB} || -f "$realdir/_db_storable" || -f "_db_storable") {
251 $def = 'y';
252 }
253 elsif($ENV{MINIVEND_STORABLE} || -f "$realdir/_session_storable" || -f "_session_storable") {
254 $def = 's';
255 }
c043823 @perusionmike Remove Storable prompt (can be called with perl Makefile.PL storable=1)
perusionmike authored
256 my $ask;
257 $ask = $def;
258 $ask = my_prompt("Use Storable module? (y/n/s) ", $def)
259 if $MV::Default{storable};
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
260 if ($ask =~ /^\s*(y|d)/i) {
261 open(TSTORABLE, ">_db_storable")
262 or die "creat _db_storable: $!\n";
263 print TSTORABLE "REMOVE THIS FILE TO STOP USING Storable\n";
264 close TSTORABLE;
265 }
266 if ($ask =~ /^\s*(y|s)/i) {
267 open(TSTORABLE, ">_session_storable")
268 or die "creat _session_storable: $!\n";
269 print TSTORABLE "REMOVE THIS FILE TO STOP USING Storable\n";
270 close TSTORABLE;
271 }
272 }
273
274 COPYEXTRA: {
275 my $cpdir = '.';
276 mkdir $cpdir, 0777 unless -d $cpdir;
277 mkdir "$cpdir/lib", 0777 unless -d "$cpdir/lib";
278 for(@extra_lib_dirs) {
279 next if -d "$cpdir/lib/$_";
280 mkdir "$cpdir/lib/$_", 0777 or die "mkdir $cpdir/lib/$_: $!\n";
281 }
282 for(@extra_lib_files) {
283 File::Copy::copy ("extra/$_", "lib/$_")
284 or die "Couldn't copy $_: $!\n";
285 }
286 }
287 }
288
289 sub mk_initp {
290 my ($ref) = @_;
291 local($Data::Dumper::Terse);
292 $Data::Dumper::Terse = 1;
293 open (INITP, ">scripts/initp.pl")
294 or die "Can't write initp.pl: $!\n";
295 print INITP '$MV::Self = ';
296 print INITP Dumper($ref);
297 print INITP ";\n1;";
298 close INITP;
299 }
300
301 sub initialize {
eafe509 @perusionmike One or two more MINIVEND->INTERCHANGE changes.
perusionmike authored
302 #warn "Got to initialize\n";
12eb33b @jonjensen Add relocate.pl script for scripts/ -> bin/ conversion.
jonjensen authored
303 my @scripts = map { "scripts/$_" } qw(
304 compile_link
305 config_prog
306 configdump
307 dump
308 expire
309 expireall
9e15651 @perusionmike Add new findtags command to scripts.
perusionmike authored
310 findtags
12eb33b @jonjensen Add relocate.pl script for scripts/ -> bin/ conversion.
jonjensen authored
311 ic_mod_perl
312 interchange
313 localize
314 makecat
315 newcat
316 offline
317 restart
318 update
319 );
320 my %X;
321 $X{INSTALLDIRS} = "perl";
322 $X{EXE_FILES} = [ @scripts ];
323 $X{PL_FILES} = { 'relocate.pl' => [ @scripts ] };
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
324
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
325 $MV::Default{LSB} ||= $MV::Default{RPM};
326
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
327 if(! $MV::Default{force} and ! $MV::Default{PREFIX}) {
328 if($> == 0) {
f657579 s:scripts/minivend:scripts/interchange:g;
Eric Zarko authored
329 $MV::Default{PREFIX} = '/usr/local/interchange';
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
330 }
331 else {
9d897f0 Changed default non-root installation location from ~/mvend to ~/interch...
Eric Zarko authored
332 $MV::Default{PREFIX} = "$ENV{HOME}/interchange";
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
333 }
334 }
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
335 if($MV::Default{LSB}) {
336 if($> != 0) {
337 die "Cannot install LSB (RPM-style) unless root.\n";
338 }
339 unlink '_uid';
340 $MV::Default{PREFIX} = '/usr/lib/interchange';
341 $MV::Default{INTERCHANGE_USER} = 'interch';
342 }
343
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
344 if($MV::Default{rpmbuilddir} or $MV::Default{RPMBUILDDIR}) {
345 $X{RPMBUILDDIR} = $MV::Default{rpmbuilddir} || $MV::Default{RPMBUILDDIR};
346 $MV::Default{RPMBUILDDIR} = $X{RPMBUILDDIR};
347 }
348
4d7c725 @jonjensen Fix bug in return value, brought up by failure in Perl 5.8.0.
jonjensen authored
349 return \%X if $MV::Default{nocopy};
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
350
175babd @perusionmike Fixed UID in Makefile.PL that was preventing RPM build.
perusionmike authored
351 my $uid = $MV::Default{INTERCHANGE_USER};
1573e40 @perusionmike Fixed bug where _uid was not remembered.
perusionmike authored
352 if(-f "_uid") {
353 open UID, '_uid'
354 or die "Cannot read _uid file: $!\n";
355 chomp($uid = <UID>);
356 close UID;
357 }
358
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
359 #warn "Got past open UID file , uid=$uid user=$>\n";
eafe509 @perusionmike One or two more MINIVEND->INTERCHANGE changes.
perusionmike authored
360
1573e40 @perusionmike Fixed bug where _uid was not remembered.
perusionmike authored
361 GETUID: {
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
362 if($> == 0 and ! $MV::Default{INTERCHANGE_USER}) {
1573e40 @perusionmike Fixed bug where _uid was not remembered.
perusionmike authored
363 $uid = my_prompt(
364 qq{Interchange cannot be run as root. Which user should run Interchange? },
365 ($uid || 'interch'),
366 );
367 my $name = getpwnam($uid);
368 if(! $name) {
369 my $ans = my_prompt("User name $uid doesn't exist. Use anyway? ", 'n');
370 last GETUID if $ans =~ /^\s*y/i;
371 redo GETUID;
372 }
373 }
175babd @perusionmike Fixed UID in Makefile.PL that was preventing RPM build.
perusionmike authored
374 elsif ($uid = $MV::Default{INTERCHANGE_USER}) {
375 # do nothing
376 }
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
377 else {
1573e40 @perusionmike Fixed bug where _uid was not remembered.
perusionmike authored
378 eval {
379 $uid = scalar getpwuid($>);
380 };
381 }
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
382 }
eafe509 @perusionmike One or two more MINIVEND->INTERCHANGE changes.
perusionmike authored
383 #warn "Got past GETUID\n" ; #if $X{RPMBUILDDIR};
1573e40 @perusionmike Fixed bug where _uid was not remembered.
perusionmike authored
384 if($uid) {
385 open(UID, ">_uid")
386 or die "Can't write uid file: $!\n";
387 print UID "$uid";
388 close UID;
389 }
390
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
391 for(@Config{
392 qw/
393 archlib
394 archlibexp
395 privlib
396 privlibexp
397 sitearch
398 sitearchexp
399 sitelib
400 sitelibexp
401 /
402 })
403 {
404 die "Can't install in Perl library!\n" if $MV::Default{PREFIX} eq $_;
405 }
406
407 my $realdir;
408
eb9e2f3 Fix bug discovered by Monte <monte@techark.com>, that prevents installat...
Jason Holt authored
409 $origdir =~ s:[\\/]\s*$::;
410 $origdir =~ s:^\s*::;
411
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
412 if(! $MV::Default{final}) {
413 &copyright_prompt();
414
39be240 @jonjensen Installer now refuses to install into software source directory (allevia...
jonjensen authored
415 # don't suggest install target same as software source directory
416 $MV::Default{PREFIX} = '' if
eb9e2f3 Fix bug discovered by Monte <monte@techark.com>, that prevents installat...
Jason Holt authored
417 $MV::Default{PREFIX} eq $origdir;
39be240 @jonjensen Installer now refuses to install into software source directory (allevia...
jonjensen authored
418
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
419 PROMPTDIR: {
420 if($MV::Default{LSB}) {
421 $realdir = $MV::Default{PREFIX};
39be240 @jonjensen Installer now refuses to install into software source directory (allevia...
jonjensen authored
422 }
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
423 else {
424 $realdir = my_prompt(
425 "Where is your Interchange to be installed? ",
426 $MV::Default{PREFIX},
427 );
428 $realdir =~ s:[\\/]\s*$::;
429 $realdir =~ s:^\s*::;
430 if ($realdir eq $origdir) {
431 warn "Can't install in software source directory!\n";
432 redo;
433 }
434 }
435 print "\n";
39be240 @jonjensen Installer now refuses to install into software source directory (allevia...
jonjensen authored
436 }
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
437 }
438 else {
6c16a68 @jonjensen Trivial directory match improvement. Version changed to 4.5.8.
jonjensen authored
439 $MV::Default{final} =~ s:[\\/]\s*$::;
440 $MV::Default{final} =~ s:^\s*::;
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
441 $realdir = $MV::Default{final};
442 }
443
7d8a752 @racke reverted change committed in the wrong branch
racke authored
444 die "Can't install in software source directory!\n" if
eb9e2f3 Fix bug discovered by Monte <monte@techark.com>, that prevents installat...
Jason Holt authored
445 ! $MV::Default{force} && $realdir eq $origdir;
39be240 @jonjensen Installer now refuses to install into software source directory (allevia...
jonjensen authored
446
eafe509 @perusionmike One or two more MINIVEND->INTERCHANGE changes.
perusionmike authored
447 #warn "Got past realdir prompt\n" ; #if $X{RPMBUILDDIR};
448
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
449 $X{INSTALLSCRIPT} = "$realdir/bin";
450 $X{INSTALLBIN} = "$realdir/bin";
451 $X{INSTALLARCHLIB} = "$realdir";
452 $X{INSTALLPRIVLIB} = "$realdir/lib";
453 if(! $MV::Default{final}) {
5c30761 @perusionmike * Change install dir for man pages (in tar install) to "man" instead
perusionmike authored
454 $X{INSTALLMAN1DIR} = "$realdir/man"
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
455 if ! $MV::Default{INSTALLMAN1DIR};
5c30761 @perusionmike * Change install dir for man pages (in tar install) to "man" instead
perusionmike authored
456 $X{INSTALLMAN3DIR} = "$realdir/man"
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
457 if ! $MV::Default{INSTALLMAN3DIR};
458 }
459
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
460 my @re_link = qw();
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
461 my @re_dir = qw();
462 my @re_copy = qw();
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
463
9cce3ec @perusionmike * When it is an update, don't send out "you are now ready to run makecat...
perusionmike authored
464 my $upgrade;
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
465 if($MV::Default{final}) {
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
466 $^W = 0;
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
467 for(glob "_*") {
468 File::Copy::copy($_, $realdir);
469 }
470 open(MANI, "MANIFEST")
471 or die "No MANIFEST?\n";
472 my (@files) = <MANI>;
473 close MANI;
65cf4f6 @jonjensen 1. Copy share/ to software installation directory.
jonjensen authored
474
eafe509 @perusionmike One or two more MINIVEND->INTERCHANGE changes.
perusionmike authored
475 #warn "Got past open MANIFEST\n" ; #if $X{RPMBUILDDIR};
476
65cf4f6 @jonjensen 1. Copy share/ to software installation directory.
jonjensen authored
477 # install share/ files from MANIFEST
478 chomp(my @sharefiles = grep m:^share/:, @files);
479 install_file('.', $realdir, $_) for @sharefiles;
b8f67fd @perusionmike * Install the new code/ directory.
perusionmike authored
480 # install code/ files from MANIFEST
481 chomp(my @codefiles = grep m:^code/:, @files);
482 install_file('.', $realdir, $_) for @codefiles;
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
483 # create symbolic links for images used for
484 # other languages either not yet translated
485 # or without embedded text
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
486 my @imgfiles = grep m:^share/interchange-5/en_US/:, @sharefiles;
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
487 my @loc;
488 @loc = map { s:.*/::; s/\.cfg$//; $_ } glob('dist/lib/UI/locales/*_*.cfg');
489 my $cwd = cwd();
490 my ($locale, $imgfile, $fname);
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
491 chdir("$realdir/share/interchange-5")
492 || die "Couldn't enter directory $realdir/share/interchange-5: $!\n";
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
493
494 for $locale (@loc) {
495 unless (-d $locale) {
496 mkdir ($locale, 0777)
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
497 || die "Couldn't create directory $realdir/share/interchange-5/$locale: $!\n";
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
498 }
499 for $imgfile (@imgfiles) {
500 $fname = basename($imgfile);
501 next if -f "$locale/$fname";
502 symlink ("../en_US/$fname", "$locale/$fname")
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
503 || die "Couldn't create symlink $realdir/share/interchange-5/$locale/$fname: $!\n";
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
504 }
65cf4f6 @jonjensen 1. Copy share/ to software installation directory.
jonjensen authored
505 }
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
506 chdir($cwd)
507 || die "Couldn't enter directory $cwd: $!\n";
12eb33b @jonjensen Add relocate.pl script for scripts/ -> bin/ conversion.
jonjensen authored
508
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
509 #warn "Got past install SHAREFILES\n" ; #if $X{RPMBUILDDIR};
eafe509 @perusionmike One or two more MINIVEND->INTERCHANGE changes.
perusionmike authored
510
65cf4f6 @jonjensen 1. Copy share/ to software installation directory.
jonjensen authored
511 # install dist/ files from MANIFEST
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
512 print "Installing dist/ files\n";
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
513 @files = grep m:^dist/:, @files;
514 chomp(@files);
515 @files = map { s:^dist/::; $_} @files;
516
517 # New install_file routine
518 chdir 'dist';
519 for (@re_dir) {
a220279 @perusionmike Removed dependency on simple catalog in distro, @re_dir.
perusionmike authored
520 mkdir $_, 0777
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
521 or @re_copy = ();
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
522 }
523 while ($_ = shift @re_copy ) {
524 my $from = $_;
525 my $to = shift @re_copy;
526 push @files, $to;
527 File::Copy::copy($from, $to);
528 }
529 for (@files) {
9cce3ec @perusionmike * When it is an update, don't send out "you are now ready to run makecat...
perusionmike authored
530 $upgrade ||= -f "$realdir/$_";
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
531 install_file('.', $realdir, $_);
532 }
65cf4f6 @jonjensen 1. Copy share/ to software installation directory.
jonjensen authored
533 chdir '..';
534
eafe509 @perusionmike One or two more MINIVEND->INTERCHANGE changes.
perusionmike authored
535 #warn "Got past install all files\n" ; #if $X{RPMBUILDDIR};
536
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
537 for(@os_hints) {
538 my ($condition, $routine) = @$_;
539 unless (ref($condition) =~ /CODE/ and ref($routine) =~ /CODE/) {
540 warn <<EOF;
541 OS hint condititon and routine must be code reference, is
542
543 condition: $condition
544 routine: $routine
545
546 Skipping.
547 EOF
548 next;
549 }
550 next unless $condition->();
551 my $odir = cwd();
552 chdir $realdir
553 or die "Cannot chdir to $realdir: $!\n";
554 $routine->();
555
556 }
a803edb @perusionmike Added symlink facility to link bin/minivend to interchange.
perusionmike authored
557 while ($_ = shift @re_link ) {
558 my $from = $_;
559 my $to = shift @re_link;
560 push @files, $to;
561 my $odir = cwd();
562 chdir $realdir
563 or die "Cannot chdir to $realdir: $!\n";
564 eval {
565 symlink($from, $to);
566 };
567 chdir $odir;
568 }
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
569 if(-f "$realdir/_uid" and $> == 0) {
570 open(UID, "$realdir/_uid")
571 or die "Can't open uid file: $!\n";
572 my $uid = <UID>;
573 close UID;
eafe509 @perusionmike One or two more MINIVEND->INTERCHANGE changes.
perusionmike authored
574 $MV::Default{INTERCHANGE_UID} = getpwnam($uid);
575 $MV::Default{INTERCHANGE_GID} = getgrnam($uid);
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
576 for(@chown_files) {
eafe509 @perusionmike One or two more MINIVEND->INTERCHANGE changes.
perusionmike authored
577 chown $MV::Default{INTERCHANGE_UID},
578 $MV::Default{INTERCHANGE_GID},
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
579 "$realdir/$_";
580 }
581 }
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
582 if($MV::Default{LSB}) {
583 my $d = cwd();
584 print "Doing LSB install...\n";
585 do './install_lsb.pl';
586 print "Done with LSB install.\n";
587 }
3223dc6 @perusionmike Added warning about removing .old and .old~ files left from
perusionmike authored
588 if(@remove_old) {
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
589 if($MV::Default{UNLINK}) {
590 print "Removing old files....";
591 my $odir = cwd();
592 chdir $realdir
593 or die "Cannot chdir to $realdir: $!\n";
594 print "Changed dir to realdir=$realdir.\n";
595 unlink @remove_old;
596 print "done.\n";
597 chdir $odir
598 or die "Cannot chdir to $odir: $!\n";
599 print "Changed dir to odir=$odir.\n";
600 }
601 else {
602 my $msg = <<EOF;
3223dc6 @perusionmike Added warning about removing .old and .old~ files left from
perusionmike authored
603 The following old files were found, different from the installed versions.
604 You should check and remove them at the earliest opportunity.
605
606 EOF
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
607 $msg .= join "\n\t", '', @remove_old;
608 $msg .= <<EOF;
3223dc6 @perusionmike Added warning about removing .old and .old~ files left from
perusionmike authored
609
610
ac362a5 fixed some minivend/interchange naming issues in documentation
Eric Zarko authored
611 If you have not modified any Interchange usertags, software programs, or
612 libraries, it is usually safe to remove them, but you might copy them somewhere
613 just in case you forgot something you changed.
3223dc6 @perusionmike Added warning about removing .old and .old~ files left from
perusionmike authored
614 EOF
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
615 print $msg;
616 }
3223dc6 @perusionmike Added warning about removing .old and .old~ files left from
perusionmike authored
617 }
65cf4f6 @jonjensen 1. Copy share/ to software installation directory.
jonjensen authored
618
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
619 chdir '..';
620
65cf4f6 @jonjensen 1. Copy share/ to software installation directory.
jonjensen authored
621 print <<EOF;
622
623 Your Interchange main software installation appears to have been successful.
624 EOF
eb03c6c @perusionmike * Removed old CPAN stuff, which never worked well. Changed it to
perusionmike authored
625 FINCHECK: {
626 @mods_to_get = ();
627 eval {
628 require Digest::MD5;
629 };
630 push(@mods_to_get, 'Digest::MD5') if $@;
631 eval {
632 require SQL::Statement;
633 };
634 push(@mods_to_get, 'SQL::Statement') if $@;
635 eval {
636 require Safe::Hole;
637 };
638 push(@mods_to_get, 'Safe::Hole') if $@;
639 eval {
640 require MIME::Base64;
641 };
642 push(@mods_to_get, 'MIME::Base64') if $@;
643 eval {
644 require Storable;
645 };
646 push(@mods_to_get, 'Storable') if $@;
647 eval {
648 require URI::URL;
649 };
650 push(@mods_to_get, 'URI::URL') if $@;
651 }
652 if(@mods_to_get) {
653 my $mods = join "\n\t", @mods_to_get;
7de922a @racke nocpaninstall option added, needed to fix the longstanding
racke authored
654
655 if ($MV::Default{nocpaninstall}) {
656 print <<EOF;
657 You do not appear to have all the required modules installed. You are missing:
658
659 $mods
660
661 Please run src/cpan_local_install to install them.
662 EOF
b0c3373 @jonjensen Merge change from 2.9.2.10.
jonjensen authored
663 exit ($MV::Default{force} ? 0 : 1);
7de922a @racke nocpaninstall option added, needed to fix the longstanding
racke authored
664 } else {
665 print <<EOF;
eb03c6c @perusionmike * Removed old CPAN stuff, which never worked well. Changed it to
perusionmike authored
666 You do not appear to have all the required modules installed. You are missing:
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
667
eb03c6c @perusionmike * Removed old CPAN stuff, which never worked well. Changed it to
perusionmike authored
668 $mods
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
669
eb03c6c @perusionmike * Removed old CPAN stuff, which never worked well. Changed it to
perusionmike authored
670 Trying to install now.
671 EOF
7de922a @racke nocpaninstall option added, needed to fix the longstanding
racke authored
672 }
673
eb03c6c @perusionmike * Removed old CPAN stuff, which never worked well. Changed it to
perusionmike authored
674 chdir $realdir
675 or die "Couldn't change directory to $realdir: $!\n";
676 system $^X, 'src/cpan_local_install';
677 eval {
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
678 require Storable;
679 open JUNK, ">_session_storable"
680 and close JUNK;
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
681 };
eb03c6c @perusionmike * Removed old CPAN stuff, which never worked well. Changed it to
perusionmike authored
682 eval {
683 require Business::UPS;
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
684 };
eb03c6c @perusionmike * Removed old CPAN stuff, which never worked well. Changed it to
perusionmike authored
685 if($@) {
686 print "Retrying a couple of modules, just a sec...\n\n";
687 require HTML::Tagset
688 or
689 system $^X, 'src/cpan_local_install', '-c', 'HTML::Tagset';
690 require HTML::Parser
691 or
692 system $^X, 'src/cpan_local_install', '-c', 'HTML::Parser';
693 system $^X, 'src/cpan_local_install', '-c', 'LWP::Simple';
694 system $^X, 'src/cpan_local_install', '-c', 'Business::UPS';
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
695 }
eb03c6c @perusionmike * Removed old CPAN stuff, which never worked well. Changed it to
perusionmike authored
696 system $^X, 'src/cpan_local_install', '-c';
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
697 }
9cce3ec @perusionmike * When it is an update, don't send out "you are now ready to run makecat...
perusionmike authored
698 if($upgrade) {
699 print <<EOF;
700
701 Since this was an update, you are now ready to restart and ensure
702 your catalogs run as expected. You do NOT need to re-run makecat,
703 though you can always do that to make a new catalog. Never run
704 makecat on an existing catalog.
705
706 EOF
707 }
708 else {
eb03c6c @perusionmike * Removed old CPAN stuff, which never worked well. Changed it to
perusionmike authored
709 print <<EOF;
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
710
eb03c6c @perusionmike * Removed old CPAN stuff, which never worked well. Changed it to
perusionmike authored
711 You are now ready to cd to $realdir and run 'bin/makecat'
712 to set up your first catalog.
713
714 EOF
9cce3ec @perusionmike * When it is an update, don't send out "you are now ready to run makecat...
perusionmike authored
715 }
eb03c6c @perusionmike * Removed old CPAN stuff, which never worked well. Changed it to
perusionmike authored
716 exit;
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
717
3b09ac4 @perusionmike Minor splash page update.
perusionmike authored
718 }
719
eb03c6c @perusionmike * Removed old CPAN stuff, which never worked well. Changed it to
perusionmike authored
720 # Check for extra needed libraries
721 extra_libs($realdir);
722
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
723 mk_initp(\%X);
724 delete $X{RPMBUILDDIR};
725 return \%X;
726 }
727
728 sub regularize {
729 for (@_) {
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
730 s/[\\]\n//g;
731 s/\n\s+/ /g;
732 s/\s+$//g;
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
733 }
734 wantarray ? @_ : $_[0];
735 }
736
737 sub MY::install {
738
739 my $self = shift;
740 local *install;
741 sub dont_warn {
742 \*install;
743 }
744
663c2e3 @jonjensen Fix for bug #106, hang at install time if specified user ID doesn't exis...
jonjensen authored
745 my $uidparm;
746
747 if (-f "_uid") {
748 if (open UID, '_uid') {
749 chomp (my $uid = <UID>);
750 close UID;
751 $uidparm = "INTERCHANGE_USER=$uid";
752 }
753 }
754
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
755 my @args = (
756 'force',
757 'nocpaninstall=$(NOCPANINSTALL)',
758 );
759 my @extra_args = ( qw/LSB RPM UNLINK/ );
760 for(@extra_args) {
761 next unless $MV::Default{$_};
762 push @args, "$_=$MV::Default{$_}";
763 }
764 push @args, 'final=$(INSTALLARCHLIB)';
765
766 my $argstring = join " ", @args;
767
663c2e3 @jonjensen Fix for bug #106, hang at install time if specified user ID doesn't exis...
jonjensen authored
768 my $new = <<EOF;
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
769 VERBINST=0
770
771 mv_install ::
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
772 \$(PERL) Makefile.PL $argstring
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
773
12eb33b @jonjensen Add relocate.pl script for scripts/ -> bin/ conversion.
jonjensen authored
774 install :: all pure_install mv_install
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
775
776 EOF
777 $new .= <<EOF;
778 rpm_move ::
779 \$(PERL) Makefile.PL force=1 rpmbuilddir=$MV::Default{RPMBUILDDIR} final=\$(INSTALLARCHLIB)
780
12eb33b @jonjensen Add relocate.pl script for scripts/ -> bin/ conversion.
jonjensen authored
781 rpm_build :: all pure_install rpm_move
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
782
783 EOF
784 $_ = $self->MM::install;
785 s/\ninstall :.*/$new/;
786 $_;
787 }
788
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
789 sub MY::postamble {
790 return <<'EOF';
791 UIDIR=dist/lib/UI
d342f99 @jonjensen Dynamically look for available UI locales instead of using hardcoded lis...
jonjensen authored
792 UILCDIR=$(UIDIR)/locales
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
793
794 localefiles:
d342f99 @jonjensen Dynamically look for available UI locales instead of using hardcoded lis...
jonjensen authored
795 @for langfile in $(UILCDIR)/*_*.cfg; do \
796 lang=`basename $$langfile .cfg`; \
797 mv $$langfile $$langfile.old; \
798 cat $(UILCDIR)/default.cfg >> $$langfile.old; \
799 if ! $(INSTALLBIN)/localize -n -m $$langfile.old -u $(UIDIR) -l $$lang `find $(UIDIR) -type f -not -empty` > $$langfile; then \
800 echo "Failed to generate locale file $$langfile"; \
801 mv $$langfile.old $$langfile; \
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
802 fi; \
803 done
804 EOF
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
805 }
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
806
807 my %mv_specific = qw/
f6f57ca @perusionmike * Add LSB=1 option to Makefile.PL. This causes:
perusionmike authored
808 FINAL 1
809 FORCE 1
810 INTERCHANGE_USER 1
811 LSB 1
812 PREFIX 1
813 RPM 1
814 RPMBUILDDIR 1
815 STORABLE 1
816 UNLINK 1
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
817 /;
818 my %delete;
819 use Getopt::Long;
820 my @saveargs = @ARGV;
821 my %optctl = (
822 'junk' => sub { 1 },
823 '<>' => sub {
824 my ($arg) = @_;
825 #warn "checking option $arg\n";
826 my ($opt, $val);
827 if($arg !~ /=/) {
828 $opt = $arg;
829 $val = 1;
830 }
831 else {
832 ($opt, $val) = split /=/, $arg, 2;
833 }
834
835 $delete{$arg} = 1 if $mv_specific{uc $opt};
836
837 $MV::Default{$opt} = $val;
838 return;
5550c3a @perusionmike Initial import of changed Challenger with UI instead of Minimate.
perusionmike authored
839 },
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
840 );
841
842 my @options = ( qw/
843 junk
844 <>
845 / );
846
847 Getopt::Long::config(qw/permute/);
848 GetOptions(\%optctl, @options)
849 or die "Bad option get\n";
850
851 #use Data::Dumper;
852 #$Data::Dumper::Terse = $Data::Dumper::Indent = 2;
853 #print "ARGV: " . Dumper(\@ARGV);
854 #print "OPT: " . Dumper(\%MV::Default);
855
856 @ARGV = grep ! $delete{$_}, @saveargs;
857
858 WriteMakefile(
859 NAME => "Interchange",
860 DISTNAME => "interchange",
861 clean => {
12eb33b @jonjensen Add relocate.pl script for scripts/ -> bin/ conversion.
jonjensen authored
862 FILES => "lib/IniConf.pm _uid _db_storable _session_storable lib/File/CounterFile.pm scripts/initp.pl scripts/compile_link scripts/config_prog scripts/configdump scripts/dump scripts/expire scripts/localize scripts/expireall scripts/makecat scripts/ic_mod_perl scripts/interchange scripts/newcat scripts/offline scripts/restart scripts/update",
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
863 },
864
865 dist => {
866 CI => "ci -l -t-Initial",
867 SUFFIX => ".gz",
868 DIST_DEFAULT => 'all tardist',
869 COMPRESS => "gzip -9f",
870 ZIP_FLAGS => '-pr9',
871 },
872 VERSION_FROM => "scripts/interchange.PL",
873 EXE_FILES => [],
874 CONFIGURE => \&initialize,
875 );
Something went wrong with that request. Please try again.