summaryrefslogtreecommitdiff
path: root/net-setup.pl
blob: a9fc3341e0d7047a819b580e1f5c650f78951409 (plain)
  1. #!/usr/bin/perl
  2. #
  3. ######################################################################
  4. # LedgerSMB Small Medium Business Accounting Software Installer
  5. # http://www.ledgersmb.org/
  6. #
  7. # Copyright (C) 2006
  8. # This work contains copyrighted information from a number of sources all used
  9. # with permission.
  10. #
  11. # This file contains source code included with or based on SQL-Ledger which
  12. # is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
  13. # under the GNU General Public License version 2 or, at your option, any later
  14. # version. For a full list including contact information of contributors,
  15. # maintainers, and copyright holders, see the CONTRIBUTORS file.
  16. #
  17. # Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
  18. # Copyright (c) 2002, Dieter Simader
  19. #
  20. # Web: http://www.sql-ledger.org
  21. #
  22. #######################################################################
  23. # Next bunch of lines are to check to see if they have the cpan module installed.
  24. my $cpan = 0;
  25. eval { use CPAN; };
  26. if ( !$@ ) {
  27. $cpan = 1;
  28. }
  29. $| = 1;
  30. #not sure how safe this is. If the browser sends a blank GATEWAY_INTERFACE
  31. #will this script destroy part of the install?
  32. #This script should probably be made inaccessible via HTTP until this feature is working
  33. if ( ( $ENV{GATEWAY_INTERFACE} ) || ( $ENV{HTTP_HOST} ) ) {
  34. print
  35. "Content-type: text/html\n\nThis does not work yet! use $0 from the command line";
  36. exit;
  37. }
  38. # Make sure they have the required perl modules installed.
  39. # bin/mozilla/admin.pl needs Digest::MD5 for session handling
  40. # HTML:LinkExtor is used by the setup program.
  41. my @req_modules = (qw(DBI DBD::Pg Digest::MD5 HTML::LinkExtor));
  42. foreach my $module (@req_modules) {
  43. print "Checking for: $module ...\t";
  44. my @results = &check_module($module);
  45. print "$results[1]\n";
  46. next if ( $results[0] ); # Passed, no need to continue..
  47. if ( $cpan == 1 ) {
  48. # Can try to install the module..
  49. print
  50. "\n\nWould you like to try and install this package ($module) through CPAN? (Y/N) [Y]:";
  51. my $response = <STDIN>;
  52. if ( ( $response =~ /y/i ) or ( $response eq "\n" ) ) {
  53. my $inst_obj = CPAN::Shell->install($module);
  54. @results = &check_module($module);
  55. if ( !$results[0] ) {
  56. print "\n\nCould not install $module using CPAN.\n";
  57. die "Please try to install this module manually\n";
  58. }
  59. }
  60. else {
  61. die "Please install the $module perl module and retry the setup.\n";
  62. }
  63. }
  64. else {
  65. # Can't try to install the module..
  66. die "Please install the $module perl module and retry the setup.\n";
  67. }
  68. }
  69. use HTML::LinkExtor;
  70. my $lynx = `lynx -version`; # if LWP is not installed use lynx
  71. my $gzip = `gzip -V 2>&1`; # gz decompression utility
  72. my $tar = `tar --version 2>&1`; # tar archiver
  73. my $latex = `latex -version`;
  74. my $versionurl = 'http://prdownloads.sourceforge.net/ledger-smb';
  75. my %source = (
  76. 1 => {
  77. url => "http://voxel.dl.sourceforge.net/sourceforge/ledger-smb",
  78. site => "New York, U.S.A",
  79. locale => 'us'
  80. },
  81. 2 => {
  82. url => "http://easynews.dl.sourceforge.net/sourceforge/ledger-smb",
  83. site => "Arizona, U.S.A",
  84. locale => 'us'
  85. },
  86. 3 => {
  87. url => "http://ufpr.dl.sourceforge.net/sourceforge/ledger-smb",
  88. site => "Brazil",
  89. locale => 'br'
  90. },
  91. 4 => {
  92. url => "http://surfnet.dl.sourceforge.net/sourceforge/ledger-smb",
  93. site => "The Netherlands",
  94. locale => 'nl'
  95. },
  96. 5 => {
  97. url => "http://http://kent.dl.sourceforge.net/sourceforge/ledger-smb",
  98. site => "U.K",
  99. locale => 'uk'
  100. },
  101. 6 => {
  102. url => "http://ovh.dl.sourceforge.net/sourceforge/ledger-smb",
  103. site => "France",
  104. locale => 'fr'
  105. },
  106. 7 => {
  107. url => "http://mesh.dl.sourceforge.net/sourceforge/ledger-smb",
  108. site => "Germany",
  109. locale => 'de'
  110. },
  111. 8 => {
  112. url => "http://citkit.dl.sourceforge.net/sourceforge/ledger-smb",
  113. site => "Russia",
  114. locale => 'ru'
  115. },
  116. 9 => {
  117. url => "http://optusnet.dl.sourceforge.net/sourceforge/ledger-smb",
  118. site => "Sydney, Australia",
  119. locale => 'au'
  120. },
  121. 10 => {
  122. url => "http://nchc.dl.sourceforge.net/sourceforge/ledger-smb",
  123. site => "Taiwan",
  124. locale => 'tw'
  125. },
  126. 11 => {
  127. url => "http://jaist.dl.sourceforge.net/sourceforge/ledger-smb",
  128. site => "Japan",
  129. locale => 'jp'
  130. },
  131. 12 => {
  132. url => "http://heanet.dl.sourceforge.net/sourceforge/ledger-smb",
  133. site => "Ireland",
  134. locale => 'ie'
  135. }
  136. );
  137. my $userspath = "users"; # default for new installation
  138. eval { require "ledger-smb.conf"; };
  139. my $filename = shift;
  140. chomp $filename;
  141. my $newinstall = 1;
  142. # is LWP installed
  143. eval { require LWP::Simple; };
  144. $lwp = !($@);
  145. unless ( $lwp || $lynx || $filename ) {
  146. die "You must have either lynx or LWP installed or specify a filename.
  147. perl $0 <filename>\n";
  148. }
  149. if ($filename) {
  150. # extract version
  151. die "Not a Ledger-SMB archive\n" if ( $filename !~ /^ledger-smb/ );
  152. $version = $filename;
  153. $version =~ s/ledger-smb-(\d+\.\d+\.\d+).*$/$1/;
  154. }
  155. if ( -f "VERSION" ) {
  156. # get installed version from VERSION file
  157. open( FH, '<', "VERSION" );
  158. @a = <FH>;
  159. close(FH);
  160. $version = $a[0];
  161. chomp $version;
  162. $newinstall = !$version;
  163. if ( !-f "ledger-smb.conf" ) {
  164. $newinstall = 1;
  165. }
  166. }
  167. # Try to determine web user and group..
  168. $webowner = "nobody";
  169. $webgroup = "nogroup";
  170. # Check for apache2.conf
  171. if ( $httpd = `find /etc /usr/local/etc -type f -name 'apache2.conf'` ) {
  172. chomp $httpd;
  173. $webowner = `grep "^User " $httpd`;
  174. $webgroup = `grep "^Group " $httpd`;
  175. chomp $webowner;
  176. chomp $webgroup;
  177. ( undef, $webowner ) = split / /, $webowner;
  178. ( undef, $webgroup ) = split / /, $webgroup;
  179. }
  180. elsif ( $httpd = `find /etc /usr/local/etc -type f -name 'httpd.conf'` ) {
  181. # Else check for httpd.conf
  182. chomp $httpd;
  183. $webowner = `grep "^User " $httpd`;
  184. $webgroup = `grep "^Group " $httpd`;
  185. chomp $webowner;
  186. chomp $webgroup;
  187. ( undef, $webowner ) = split / /, $webowner;
  188. ( undef, $webgroup ) = split / /, $webgroup;
  189. }
  190. if ( $confd = `find /etc /usr/local/etc -type d -name 'apache*/conf.d'` ) {
  191. chomp $confd;
  192. }
  193. # If we are doing a new install.. check the postgresql installation..
  194. if ( $newinstall == 1 ) {
  195. # Check the postgresql version before we even check for a connection if local
  196. system("tput clear"); # Clear the screen..
  197. our ( $pghost, $pgport, $pguser, $pgpassword );
  198. print
  199. "\n\nIs PostgreSQL installed [L]ocally,\n or will you be connecting to a [R]emote server? (L/R) [L]:";
  200. my $localremote = <STDIN>;
  201. if ( ( $localremote =~ /L/i ) or ( $localremote eq "\n" ) ) {
  202. $pghost = 'localhost';
  203. # If local, check the local postgresql version..
  204. my $pgversion = `psql --version`;
  205. ($pgversionnum) = $pgversion =~ m/(\d\.\d\.\d)/;
  206. unless ( $pgversionnum gt '8.0.0' ) {
  207. # Die, cannot continue..
  208. print
  209. "LedgerSMB requires postgres version 8.0 or higher. You have version $pgversionnum installed\n";
  210. die;
  211. }
  212. }
  213. if ( !&check_pgconnect ) {
  214. print "\n\n\nInstallation was not successful\n Exiting....\n";
  215. exit;
  216. }
  217. }
  218. system("tput clear");
  219. if ($filename) {
  220. $install = "\ninstall $version from (f)ile\n";
  221. }
  222. # check for latest version
  223. &get_latest_version;
  224. chomp $latest_version;
  225. if ( !$newinstall ) {
  226. $install .= "\n(r)einstall $version\n";
  227. }
  228. if ( $version && $latest_version ) {
  229. if ( $version ne $latest_version ) {
  230. $install .= "\n(u)pgrade to $latest_version\n";
  231. }
  232. }
  233. $install .= "\n(i)nstall $latest_version (from Internet)\n" if $latest_version;
  234. $install .= "\n(d)ownload $latest_version (no installation)" unless $filename;
  235. print qq|
  236. LedgerSMB Accounting and ERP Installation
  237. $install
  238. Enter: |;
  239. $a = <STDIN>;
  240. chomp $a;
  241. exit unless $a;
  242. $a = lc $a;
  243. if ( $a !~ /d/ ) {
  244. print qq|\nEnter httpd owner [$webowner] : |;
  245. $web = <STDIN>;
  246. chomp $web;
  247. $webowner = $web if $web;
  248. print qq|\nEnter httpd group [$webgroup] : |;
  249. $web = <STDIN>;
  250. chomp $web;
  251. $webgroup = $web if $web;
  252. }
  253. if ( $a ne 'f' ) {
  254. system("tput clear");
  255. # choose site
  256. foreach $item ( sort { $a <=> $b } keys %source ) {
  257. $i++;
  258. print qq|$i. $source{$item}{site}\n|;
  259. }
  260. $site = "1";
  261. print qq|\nChoose Location [$site] : |;
  262. $b = <STDIN>;
  263. chomp $b;
  264. $site = $b if $b;
  265. }
  266. if ( $a eq 'd' ) {
  267. &download;
  268. }
  269. if ( $a =~ /(i|u)/ ) {
  270. &install_smb;
  271. }
  272. if ( $a eq 'r' ) {
  273. $latest_version = $version;
  274. &install_smb;
  275. }
  276. if ( $a eq 'f' ) {
  277. &install_smb;
  278. }
  279. exit;
  280. # end main
  281. sub check_module {
  282. my ($module) = @_;
  283. eval "use $module";
  284. if ( !$@ ) {
  285. return 1, "Ok";
  286. }
  287. else {
  288. return 0, "FAILED", $@;
  289. }
  290. }
  291. sub download {
  292. &get_source_code;
  293. }
  294. sub get_latest_version {
  295. print "Checking for latest version number .... ";
  296. if ($filename) {
  297. print "skipping, filename supplied\n";
  298. return;
  299. }
  300. my $urlresult = '';
  301. if ($lwp) {
  302. if ( $urlresult = LWP::Simple::get("$versionurl") ) {
  303. $latest_version = parse_links($urlresult);
  304. }
  305. else {
  306. print "not found";
  307. }
  308. }
  309. else {
  310. if ( !$lynx ) {
  311. print "\nYou must have either lynx or LWP installed";
  312. exit 1;
  313. }
  314. $ok = `lynx -dump -head $versionurl`;
  315. if ( $ok = ( $ok =~ s/HTTP.*?200 // ) ) {
  316. $urlresult = `lynx -dump $versionurl`;
  317. $latest_version = parse_links($urlresult);
  318. }
  319. else {
  320. print "not found";
  321. }
  322. die unless $ok;
  323. }
  324. if ($latest_version) {
  325. print "ok\n";
  326. 1;
  327. }
  328. }
  329. my @versions = ();
  330. sub parse_links {
  331. # Take the html retrieved by lwp or lynx and look for the version numbers.
  332. my $text = shift;
  333. my $version = '';
  334. my $p = HTML::LinkExtor->new( \&cb );
  335. $p->parse($text) or die;
  336. foreach (@versions) {
  337. my ($chkversion) =
  338. $_ =~
  339. /^\/ledger-smb\/ledger-smb-(\d{1,3}\.\d{1,3}\.\d{1,3}\w*)\.tar\.gz$/;
  340. $version = $chkversion if ( $chkversion gt $version );
  341. }
  342. return $version;
  343. }
  344. sub cb {
  345. # Callback function for LinkExtor
  346. my ( $tag, %attr ) = @_;
  347. return if $tag ne 'a';
  348. return
  349. unless $attr{href} =~
  350. /^\/ledger-smb\/ledger-smb-\d{1,3}\.\d{1,3}\.\d{1,3}\w*\.tar\.gz$/;
  351. push( @versions, values %attr );
  352. }
  353. sub get_source_code {
  354. $err = 0;
  355. @order = ();
  356. push @order, $site;
  357. for ( sort { $a <=> $b } keys %source ) {
  358. push @order, $_;
  359. }
  360. if ($latest_version) {
  361. # download it
  362. chomp $latest_version;
  363. $latest_version = "ledger-smb-${latest_version}.tar.gz";
  364. print "\nStatus\n";
  365. print "Downloading $latest_version .... ";
  366. foreach $key (@order) {
  367. print "\n$source{$key}{site} .... ";
  368. if ($lwp) {
  369. $err =
  370. LWP::Simple::getstore( "$source{$key}{url}/$latest_version",
  371. "$latest_version" );
  372. $err -= 200;
  373. }
  374. else {
  375. $ok = `lynx -dump -head $source{$key}{url}/$latest_version`;
  376. $err = !( $ok =~ s/HTTP.*?200 // );
  377. if ( !$err ) {
  378. $err =
  379. system(
  380. "lynx -dump $source{$key}{url}/$latest_version > $latest_version"
  381. );
  382. }
  383. }
  384. if ($err) {
  385. print "failed!";
  386. }
  387. else {
  388. last;
  389. }
  390. }
  391. }
  392. else {
  393. $err = -1;
  394. }
  395. if ($err) {
  396. die "Cannot get $latest_version";
  397. }
  398. else {
  399. print "ok!\n";
  400. }
  401. $latest_version;
  402. }
  403. sub install_smb {
  404. if ($filename) {
  405. $latest_version = $filename;
  406. }
  407. else {
  408. $latest_version = &get_source_code;
  409. }
  410. &decompress;
  411. if ($newinstall) {
  412. open( FH, '<', "ledger-smb.conf.default" );
  413. @f = <FH>;
  414. close(FH);
  415. unless ($latex) {
  416. grep { s/^\$latex.*/\$latex = 0;/ } @f;
  417. }
  418. open( FH, '>', "ledger-smb.conf" );
  419. print FH @f;
  420. close(FH);
  421. $alias = $absolutealias = $ENV{'PWD'};
  422. $alias =~ s/.*\///g;
  423. $httpddir = `dirname $httpd`;
  424. if ($confd) {
  425. $httpddir = $confd;
  426. }
  427. chomp $httpddir;
  428. $filename = "ledger-smb-httpd.conf";
  429. # do we have write permission?
  430. if ( !open( FH, '>>', "$httpddir/$filename" ) ) {
  431. open( FH, '>', "$filename" );
  432. $norw = 1;
  433. }
  434. open( HTTPD, '<', 'sql-ledger-httpd.conf' );
  435. while ( $line = <HTTPD> ) {
  436. print FH $line;
  437. }
  438. close(FH);
  439. print qq|
  440. This is a new installation.
  441. |;
  442. if ($norw) {
  443. print qq|
  444. Webserver directives were written to $filename
  445. Copy $filename to $httpddir
  446. |;
  447. if ( !$confd ) {
  448. print qq| and add
  449. # Ledger-SMB
  450. Include $httpddir/$filename
  451. to $httpd
  452. |;
  453. }
  454. print qq| and restart your webserver!\n|;
  455. if ( !$permset ) {
  456. print qq|
  457. WARNING: permissions for templates, users, css and spool directory
  458. could not be set. Login as root and set permissions
  459. # chown -hR :$webgroup users templates css spool
  460. # chmod 771 users templates css spool
  461. |;
  462. }
  463. }
  464. else {
  465. print qq|
  466. Webserver directives were written to
  467. $httpddir/$filename
  468. |;
  469. if ( !$confd ) {
  470. if ( !(`grep "^# LedgerSMB" $httpd`) ) {
  471. open( FH, '>>', "$httpd" );
  472. print FH qq|
  473. # LedgerSMB
  474. Include $httpddir/$filename
  475. |;
  476. close(FH);
  477. }
  478. }
  479. if ( !$> ) {
  480. # send SIGHUP to httpd
  481. if ( $f = `find /var -type f -name 'httpd.pid'` ) {
  482. $pid = `cat $f`;
  483. chomp $pid;
  484. if ($pid) {
  485. system("kill -s HUP $pid");
  486. }
  487. }
  488. }
  489. }
  490. }
  491. # if this is not root, check if user is part of $webgroup
  492. if ($>) {
  493. if ( $permset = ( $) =~ getgrnam $webgroup ) ) {
  494. `chown -hR :$webgroup users templates css spool`;
  495. chmod 0771, 'users', 'templates', 'css', 'spool';
  496. `chown :$webgroup ledger-smb.conf`;
  497. }
  498. }
  499. else {
  500. # root
  501. `chown -hR 0:0 *`;
  502. `chown -hR $webowner:$webgroup users templates css spool`;
  503. chmod 0771, 'users', 'templates', 'css', 'spool';
  504. `chown $webowner:$webgroup ledger-smb.conf`;
  505. }
  506. chmod 0644, 'ledger-smb.conf';
  507. unlink "ledger-smb.conf.default";
  508. &cleanup;
  509. while ( $a !~ /(Y|N)/ ) {
  510. print qq|\nDisplay README (Y/n) : |;
  511. $a = <STDIN>;
  512. chomp $a;
  513. $a = ($a) ? uc $a : 'Y';
  514. if ( $a eq 'Y' ) {
  515. @args = ( "more", "doc/README" );
  516. system(@args);
  517. }
  518. }
  519. }
  520. sub decompress {
  521. die "Error: gzip not installed\n" unless ($gzip);
  522. die "Error: tar not installed\n" unless ($tar);
  523. &create_lockfile;
  524. # ungzip and extract source code
  525. print "Decompressing $latest_version ... ";
  526. if ( system("gzip -df $latest_version") ) {
  527. print "Error: Could not decompress $latest_version\n";
  528. &remove_lockfile;
  529. exit;
  530. }
  531. else {
  532. print "done\n";
  533. }
  534. # strip gz from latest_version
  535. $latest_version =~ s/\.gz//;
  536. # now untar it
  537. print "Unpacking $latest_version ... ";
  538. if ( system("tar -xf $latest_version") ) {
  539. print "Error: Could not unpack $latest_version\n";
  540. &remove_lockfile;
  541. exit;
  542. }
  543. else {
  544. # now we have a copy in ledger-smb
  545. if ( system("tar -cf $latest_version -C ledger-smb .") ) {
  546. print "Error: Could not create archive for $latest_version\n";
  547. &remove_lockfile;
  548. exit;
  549. }
  550. else {
  551. if ( system("tar -xf $latest_version") ) {
  552. print "Error: Could not unpack $latest_version\n";
  553. &remove_lockfile;
  554. exit;
  555. }
  556. else {
  557. print "done\n";
  558. print "cleaning up ... ";
  559. `rm -rf ledger-smb`;
  560. print "done\n";
  561. }
  562. }
  563. }
  564. }
  565. sub create_lockfile {
  566. if ( -d "$userspath" ) {
  567. open( FH, '>', "$userspath/nologin" );
  568. close(FH);
  569. }
  570. }
  571. sub cleanup {
  572. unlink "$latest_version";
  573. unlink "$userspath/members.default" if ( -f "$userspath/members.default" );
  574. &remove_lockfile;
  575. }
  576. sub remove_lockfile {
  577. unlink "$userspath/nologin"
  578. if ( -f "$userspath/nologin" );
  579. }
  580. sub check_pgconnect {
  581. print
  582. "We will now attempt to validate that we are able to \nconnect to your postgres database.\n";
  583. my $cnx = 0;
  584. while ( !$cnx ) {
  585. print "\nPlease enter the host name of the postgresql database? "
  586. . "(ie localhost)\n [$pghost]:";
  587. my $response = <STDIN>;
  588. $response =~ s/\s*//g;
  589. chomp($response);
  590. # Should probably try to validate the hostname here.. but for now, we'll leave it.
  591. $response = $pghost if ( $response eq '' );
  592. while ( !$pgport ) {
  593. print "\nPlease enter the port postgres is listening on.\n[5432]:";
  594. $pgport = <STDIN>;
  595. chomp($pgport);
  596. $pgport = 5432 if ( $pgport eq '' );
  597. if ( ( $pgport =~ /\D/ ) || ( $pgport > 65535 ) ) {
  598. print "\nThe port must be a number between 0 and 65535, "
  599. . "postgres default is 5432\n";
  600. undef $pgport;
  601. }
  602. }
  603. while ( !$pguser ) {
  604. print "\nPlease enter a valid postgres user name "
  605. . "to validate the connection.:";
  606. $pguser = <STDIN>;
  607. chomp($pguser);
  608. if ( $pguser eq '' ) {
  609. print "\nYou must enter a username\n";
  610. }
  611. }
  612. while ( !$pgpass ) {
  613. print "\nPlease enter a valid postgres password "
  614. . "to validate the connection.:";
  615. $pgpass = <STDIN>;
  616. chomp($pgpass);
  617. if ( $pgpass eq '' ) {
  618. print "\nYou must enter a password\n";
  619. }
  620. }
  621. # Try to connect;
  622. eval {
  623. my $dbh =
  624. DBI->connect(
  625. "dbi:Pg:dbname=template1;host=$response;" . "port=$pgport;",
  626. $pguser, $pgpass )
  627. or die $DBI::errstr;
  628. my $version = $dbh->get_info(18);
  629. if ( $version =~ /^07/ ) {
  630. die "You have postgres version $version installed, "
  631. . "we require a minimum of 8.0\n";
  632. }
  633. };
  634. if ($@) {
  635. system("tput clear");
  636. print "Connection to the database was unsucessful\n"
  637. . "The error we received was this:\n$@\n"
  638. . "Would you like to try to enter the authentication "
  639. . "information again? (Y/N)[N]:";
  640. $answer = <STDIN>;
  641. chomp($answer);
  642. if ( $answer =~ /n/i ) {
  643. $cnx = 1;
  644. }
  645. }
  646. else {
  647. $cnx = 1;
  648. }
  649. }
  650. # Try to guide the user to an answer to the connection problems.
  651. system("tput clear"); # Clear the screen..
  652. print "Have you already set up a database user for LedgerSMB? (Y/N) [N]:";
  653. $answer = <STDIN>;
  654. chomp($answer);
  655. if ( ( $answer =~ /n/i ) or ( $answer eq "" ) ) {
  656. print q|
  657. If you have not set up a database user yet, you can use the following command:
  658. # su postgres
  659. $ createuser -d ledger-smb
  660. Shall the new user be allowed to create databases? (y/n) y
  661. Shall the new user be allowed to create more new users? (y/n) n
  662. if you use passwords to access postgres use this command
  663. $ createuser -d -P ledger-smb
  664. |;
  665. return 0;
  666. }
  667. # Maybe they did not change pg_hba.conf?
  668. print qq|Did you modify pg_hba.conf to allow access?
  669. See pg_hba.conf example entries here:
  670. http://www.postgresql.org/docs/8.0/static/client-authentication.html#EXAMPLE-PG-HBA.CONF
  671. A good starting point would be to add something similar to below to pg_hba.conf:
  672. host all all 192.168.1.5/32 MD5
  673. Which would allow a connection
  674. from any user,
  675. to any database,
  676. from that one IP (You will need to change this for your setup)
  677. Using a MD5 password.
  678. Also, remember to reload postgres when you make the change.
  679. Did you allow access to the postgres database from the web server?
  680. (Y/N) [Y]:|;
  681. $answer = <STDIN>;
  682. if ( ( $response =~ /n/i ) or ( $response eq "\n" ) ) {
  683. return 0;
  684. }
  685. # Add other checks here..
  686. return 0;
  687. }
  688. print "\nConnection Successful, Press enter to continue\n";
  689. $answer = <STDIN>;
  690. return 1;