[go: up one dir, main page]

File: install

package info (click to toggle)
sirc 2.211-9.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, squeeze
  • size: 476 kB
  • ctags: 420
  • sloc: perl: 5,330; ansic: 1,200; sh: 855; makefile: 78
file content (629 lines) | stat: -rwxr-xr-x 14,880 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

# Installation script for sirc, will try to find your perl interpreter,
# C compiler, check your perl installation and setup sirc.

# (bits stolen from ircII's "easyinst" and from various configure
# scripts)

cat << '_EOF_'

This script will compile, configure and install sirc for your system.
You can exit at any time by pressing ^C (Control-C) and start over if
you wish to change your settings.

Whenever asked for something, the default answer is shown between
[brackets]. Pressing Enter at that point will take the default answer.

_EOF_

if test "`echo -n a`" = "a"
then
  n='-n'
  c=''
else
  n=''
  c='\c'
fi

echo $n "Continue with the installation? ([y]/n) " $c
read A
case "$A" in
  n*|N*) echo "Aborting."
  	 exit 1
esac

echo
if test -r dsirc -a -r ssfe.c
then
  echo "Checking where dsirc and ssfe.c are - OK"
else
  echo "I can't find the files dsirc or ssfe.c, from the sirc distribution."
  echo "Please run this script in the directory where these files are."
  echo
  exit 1
fi

rm -f ssfe sircsock.ph crfkbtsk.c crfkbtsk
IFS="${IFS= 	}"; save_ifs=$IFS; IFS="${IFS}:"; CC=""; PERL=""
for dir in $PATH
do
  test -z "$dir" && dir="."
  test -f $dir/gcc && CC="$dir/gcc"
  test -f $dir/cc -a -z "$CC" && CC="$dir/cc"
  test -f $dir/perl5 && PERL="$dir/perl5"
  test -f $dir/perl -a -z "$PERL" && PERL="$dir/perl"
done

IFS="$save_ifs"
echo

if test -z "$CC"
then
  echo "I can't find a C compiler, either cc or gcc."
  echo
  CC=none
fi

echo "Enter the name of the C compiler you want to use, or \"none\" if you"
echo "don't have access to one. In that case you can only use this IRC"
echo "client in dumb (not full-screen) mode."
echo
echo "If you don't know what this is all about, just press Enter :)"
echo
echo $n "Compiler? [$CC] " $c
read compiler
test -z "$compiler" || CC="$compiler"
test "$CC" = none && CC=""

if test "$CC"
then
  echo
  echo "ssfe.c needs the termcap library, or something compatible with it,"
  echo "such as ncurses.  Also, on some systems the termcap library is"
  echo "included in the curses library, so \"curses\" might work."
  echo 
  echo $n "Which library to use? [termcap] " $c
  read library
  test -z "$library" && library="termcap"
  case "$library" in
    -l*)
      lib="$library"
      ;;
    *)
      lib="-l$library"
  esac
  echo $n "Use the old BSD sgtty interface instead of the POSIX one? (y/[n]) " $c
  read sgtty
  case "$sgtty" in
    y*|Y*)
      opt="-DUSE_SGTTY"
      ;;
    *)
      opt=""
  esac
  echo $n "Any other flags (-O, -L, -I ...) for the compiler? [none] " $c
  read flags
  echo
  echo $n "Attempting to compile ssfe.c with $CC ... press Enter " $c
  read blah
  echo "$CC $opt $flags ssfe.c -o ssfe $lib"
  eval "$CC $opt $flags ssfe.c -o ssfe $lib"
  if test -x ssfe
  then
    echo
    echo "It seems to have worked :)"
  else
    echo
    echo "I can't compile ssfe, for whatever reason. Press ^C and try again"
    echo "with a different compiler or different compile options, or press"
    echo $n "Enter to go on and install sirc in dumb mode... " $c
    read blah
    echo "Going on."
    echo
  fi
fi
test -f ssfe && strip ssfe

echo
if test -z "$PERL"
then
  echo "I can't find your perl interpreter anywhere."
  echo "There is no way sirc can run without perl; please check your"
  echo "PATH and/or ask your sysadmin about it."
  echo
  echo "Enter the full pathname to the perl interpreter, or press ^C"
  echo "to abort the installation."
else
  echo "Enter the name of the perl interpreter you want to use, or"
  echo "press Enter to use $PERL"
fi
echo $n "Perl interpreter? [$PERL] " $c
read perl
test -z "$perl" || PERL="$perl"
echo
echo $n "Checking your perl interpreter... " $c
perlmsg=`eval "$PERL -v" 2>&1`

case "$perlmsg" in 
  *Wall*) echo "OK"
  	  ;;
   *)     echo "Doesn't seem to work ... aborting."
	  exit 1
esac

if $PERL -e 'eval "use Socket; &AF_INET;" || exit 1'
then
  echo You have perl 5.  Congratulations.
else
  echo
  echo "Trying to setup the perl include files sirc needs..."
  sockfile="sircsock.ph"
  hosttype=`uname -a`
  test -z "$hosttype" && hosttype=unknown

  case "$hosttype" in
    AIX*|HP-UX*|Linux*|NEXT*|OSF1*|SunOS*4.1*|ULTRIX*|FreeBSD*|NetBSD*|OpenBSD*)
      echo "... using the defaults I have for your type of system."
      cat > $sockfile << '_EOF_'
eval 'sub SOCK_STREAM {0x1;}';
eval 'sub AF_INET {0x2;}';
eval 'sub PF_INET {0x2;}';
_EOF_
      ;;
    SunOS*5.*|IRIX*5.*)
      echo "... using the defaults I have for your type of system."
      cat > $sockfile << '_EOF_'
eval 'sub SOCK_STREAM {0x2;}';
eval 'sub AF_INET {0x2;}';
eval 'sub PF_INET {0x2;}';
_EOF_
      ;;
    *)
      echo "I don't have any specific defaults for your type of system."
      if test -z "$CC"
      then
	echo "Since we can't use a C compiler, we're stuck with the general"
	echo "default values... I hope they work :>"
	cat > $sockfile << '_EOF_'
eval 'sub SOCK_STREAM {0x1;}';
eval 'sub AF_INET {0x2;}';
eval 'sub PF_INET {0x2;}';
_EOF_
      else
	echo
	echo "Do you want to use the general default values? If you answer \"no\","
	echo "I will try to find out the right values for your system."
	echo $n "Use general defaults? (y/[n]) " $c
	read use
	case "$use" in
	  y*|Y*)
	    echo "Going on with the global defaults... I hope they work for you"
	    cat > $sockfile << '_EOF_'
eval 'sub SOCK_STREAM {0x1;}';
eval 'sub AF_INET {0x2;}';
eval 'sub PF_INET {0x2;}';
_EOF_
	    ;;
	  *)
	    cat > crfkbtsk.c << '_EOF_'
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>

main() {
  printf("eval 'sub SOCK_STREAM {0x%x;}';\n", SOCK_STREAM);
  printf("eval 'sub AF_INET {0x%x;}';\n", AF_INET);
  printf("eval 'sub PF_INET {0x%x;}';\n", PF_INET);
}

_EOF_

	    echo 
	    echo "Compiling intermediary program..."
	    echo 
	    eval "$CC crfkbtsk.c -o crfkbtsk"
	    if test -f crfkbtsk
	    then
	      echo "The intermediary C program seems to have compiled OK."
	    else
	      echo
	      echo "The intermediary C program seems NOT to compile OK."
	      echo "Try again with the global defaults or another compiler..."
	      echo "Aborting."
	      exit
	    fi
	    ./crfkbtsk > $sockfile
	    rm -f crfkbtsk crfkbtsk.c
	    echo "We're done installing your perl include files for sirc"
	esac
      fi
  esac
fi

if $PERL -e 'if (eval "require \"getopts.pl\";") { exit 1 } else { exit 0 }'
then
  echo
  echo "Your perl installation is really messed up, you don't even have the"
  echo "getopts.pl library... creating it in sirc's directory"
  # this code comes from the perl distribution
  cat > getopts.pl << '_EOF_'
;# getopts.pl - a better getopt.pl

;# Usage:
;#      do Getopts('a:bc');  # -a takes arg. -b & -c not. Sets opt_* as a
;#                           #  side effect.

sub Getopts {
    local($argumentative) = @_;
    local(@args,$_,$first,$rest);
    local($errs) = 0;
    local($[) = 0;

    @args = split( / */, $argumentative );
    while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
	($first,$rest) = ($1,$2);
	$pos = index($argumentative,$first);
	if($pos >= $[) {
	    if($args[$pos+1] eq ':') {
		shift(@ARGV);
		if($rest eq '') {
		    ++$errs unless @ARGV;
		    $rest = shift(@ARGV);
		}
		eval "\$opt_$first = \$rest;";
	    }
	    else {
		eval "\$opt_$first = 1";
		if($rest eq '') {
		    shift(@ARGV);
		}
		else {
		    $ARGV[0] = "-$rest";
		}
	    }
	}
	else {
	    print STDERR "Unknown option: $first\n";
	    ++$errs;
	    if($rest ne '') {
		$ARGV[0] = "-$rest";
	    }
	    else {
		shift(@ARGV);
	    }
	}
    }
    $errs == 0;
}

1;
_EOF_
else
  echo "Your perl's getopts.pl library seems to be OK"
fi

curdir=`pwd`
if test -w /bin
then
  bindir="/usr/local/bin"
  plibdir="/usr/local/lib/sirc"
else
  bindir="$HOME/bin"
  if test -d "$HOME/lib"
  then
    plibdir="$HOME/lib/sirc"
  else
    plibdir="$HOME/sirc"
  fi
fi

echo
echo "Where do you want to install the sirc binaries?"
echo $n "Binaries directory? [$bindir] " $c
read bin
test -z "$bin" || bindir="$bin"

if test -d "$bindir"
then
  true
else
  echo "The bin directory $bindir doesn't exist."
  echo $n "Create it? ([y]/n) " $c
  read creat
  echo
  case "$creat" in
    n*|N*)
      echo "I can't put your files there, then!"
      echo "Aborting."
      exit 1
      ;;
    *)
      if mkdir "$bindir"
      then
        echo "Created!"
      else
        echo "Can't create directory... aborting"
	exit 1
      fi
  esac
fi
if test -w "$bindir"
then
  true
else
  echo "I can't write in the $bindir directory."
  echo "Aborting."
  exit 1
fi

echo "Ok"
echo
echo "Other than the executable files in the bin directory, sirc needs to"
echo "keep a small number of files in a directory of its own. You can either"
echo "leave them here in $curdir,"
echo "or specify another directory."
echo
echo $n "Pick another directory for sirc's files? (y/[n]) " $c
read another
filesmoved=""
case "$another" in
  y*|Y*)
    echo $n "sirc directory? [$plibdir] " $c
    read libdir
    test -z "$libdir" && libdir="$plibdir"
    if test -d "$libdir"
    then
      true
    else
      echo "The directory $libdir doesn't exist."
      echo $n "Create it? ([y]/n) " $c
      read creat
      echo
      case "$creat" in
	n*|N*)
	  echo "OK, up to you to move the files there later, then"
	  ;;
	*)
	  if mkdir "$libdir"
	  then
	    echo "Created!"
	  else
	    echo "Can't create directory... aborting"
	    exit 1
	  fi
      esac
    fi
    echo $n "Copy all the files sirc needs in that directory? ([y]/n) " $c
    read copyfiles
    case "$copyfiles" in
      n*|N*)
	echo "Ok, I'll leave that to you..."
        ;;
      *)
	echo "Copying files from $curdir to $libdir..."
	cp ChangeLog PROGRAMMING README dsirc sirc.help.gz ssfe.c n0thing.pl socks.pl $libdir
	chmod 755 $libdir $libdir/dsirc
	chmod 644 $libdir/ChangeLog $libdir/PROGRAMMING $libdir/README $libdir/sirc.help.gz $libdir/ssfe.c $libdir/n0thing.pl
	if test -f getopts.pl
	then
	  cp getopts.pl $libdir
	  chmod 644 $libdir/getopts.pl
	fi
	if test -f sircsock.ph
	then
	  cp sircsock.ph $libdir
	  chmod 644 $libdir/sircsock.ph
	fi
	filesmoved="1"
	if test -f "$libdir/dsirc"
	then
	  echo "done copying."
	else
	  echo
	  echo "Something seems to have gone wrong... aborting."
	  exit 1
	fi
    esac
    ;;
  *)
    libdir="$curdir"
    echo OK
esac

cat << '_EOF_'

sirc now includes experimental support for SOCKS proxies.  If you are
behind a firewall (i.e your host can't directly connect to outside) and
the firewall is running a SOCKS proxy, answer "yes" to this question.
Otherwise answer "no".

_EOF_

echo $n "Support SOCKS proxies? (y/[n]) " $c
read socks
soxtra1=""
soxtra2=""
soxtra3=""
case "$socks" in
  y*|Y*)
    echo $n "Enter the hostname of your SOCKS proxy: " $c
    read socksserver
    if test -z "$socksserver"
    then
      echo "Uhm, I guess you don't really want SOCKS then"
    else
      soxtra1="SOCKS_SERVER=$socksserver; export SOCKS_SERVER
"
      echo $n "What port does your SOCKS proxy use? [1080] " $c
      read socksport
      if test "$socksport"
      then
        soxtra2="SOCKS_PORT=$socksport; export SOCKS_PORT
"
      fi
      test -z "$proxyport" && proxyport=1080
      cat << '_EOF_'

sirc also supports the SOCKS4A extension to the SOCKS protocol, allowing
clients to ask the SOCKS host to resolve hostnames if they can't
themselves.  If your machine has access to a working nameserver, you
don't want this.

_EOF_
      echo $n "Use SOCKS4A DNS extension? (y/[n]) " $c
      read socks4a
      case "$socks4a" in
	y*|Y*)
	  soxtra3="SOCKS_DNS=1; export SOCKS_DNS
"
      esac
    fi
esac

if test -w /usr/local/man/man1
then
  manp=/usr/local/man/man1
else
  if test -w /usr/man/man1
  then
    manp=/usr/man/man1
  else
    if test -w /opt/man/man1
    then
      manp=/opt/man/man1
    else
      if test -w $HOME/man/man1
      then
	manp=$HOME/man/man1
      else
	manp=none
      fi
    fi
  fi
fi

cat << '_EOF_'

In which directory do you want to install sirc's manpages?  If you
don't want them installed, enter "none".

_EOF_

echo $n "Manpage directory? [$manp] " $c
read manp2
test -z "$manp2" || manp="$manp2"
if test "$manp" = "none"
then
  echo "Not copying manpages..."
else
  if test -d $manp -a -w $manp
  then
    cp sirc.1 ssfe.1 $manp
    chmod 644 $manp/ssfe.1 $manp/sirc.1
  else
    echo "Can't write to manpage directory... not installing manpages"
  fi
fi

server="irc.primenet.com"
cat << '_EOF_'

One thing left to setup now: the name of your default IRC server.
You should pick the closest server to you in the net you wish to use.

If you don't know which server to use, you can pick one of the following,
or look at http://www.irchelp.org for information:

     irc.primenet.com -  EFnet server in America
     irc.ec-lille.fr  -  EFnet server in Europe
     us.undernet.org  -  Undernet server in America
     eu.undernet.org  -  Undernet server in Europe
     irc.stealth.net  -  IRCnet server in America
     irc.funet.fi     -  IRCnet server in Europe
     irc.dal.net      -  DALnet server in America
     fi.dal.net       -  DALnet server in Europe

_EOF_
echo $n "Default server? [$server] " $c
read serv
test -z "$serv" || server="$serv"

echo
echo "OK, time to put the binaries in the bin directory, and to create the"
echo "startup script."
echo $n "Press Enter to go on, or ^C to interrupt... " $c
read blah
echo

rm -f $bindir/sirc
if test -f ssfe
then
  chmod 755 ssfe
  rm -f $bindir/ssfe
  cp ssfe $bindir
  echo "#!/bin/sh

SIRCLIB=$libdir ; export SIRCLIB
${soxtra1}${soxtra2}${soxtra3}
if test -z \"\$SIRCSERVER\" && test -z \"\$IRCSERVER\"
then
  SIRCSERVER=\"$server\"
  export SIRCSERVER
fi

case \"\$1\" in
  -d) shift
      exec $PERL $libdir/dsirc \"\$@\"
      ;;
  *)  eval exec $bindir/ssfe \$SSFE $PERL $libdir/dsirc \\\"\\\$@\\\"
esac" > $bindir/sirc
else
  echo "#!/bin/sh

SIRCLIB=$libdir ; export SIRCLIB
${soxtra1}${soxtra2}${soxtra3}
if test -z \"\$SIRCSERVER\" && test -z \"\$IRCSERVER\"
then
  SIRCSERVER=\"$server\"
  export SIRCSERVER
fi

case \"\$1\" in
  -d) shift
esac
exec $PERL $libdir/dsirc \"\$@\"" > $bindir/sirc

fi
chmod 755 $bindir/sirc

if test -n "$soxtra1"
then
  echo '&load("socks.pl");' > $libdir/sircrc.pl
fi

if test "$filesmoved"
then
  echo
  echo "Since you have copied the files in $libdir,"
  echo "you probably don't need them here... you can delete them if you want."
fi

echo
echo "We're done. You can start sirc at any time by typing \"sirc\" at the Unix"
echo "prompt. If that doesn't work, check your PATH, or you can always start sirc"
echo "by typing $bindir/sirc" | sed "s|$HOME|~|"
echo


if test -f $bindir/ssfe
then
  echo "Keep in mind that you can always exit sirc by pressing Control-X C"
else
  echo "Keep in mind that you can always exit sirc by pressing Control-C"
fi

echo
echo "Happy IRCing..."
echo "... and don't forget to read $libdir/README sometime :)" | sed "s|$HOME|~|"