-
- print "\n";
-
- # Directory Settings..
- my $tmpbase = $config{BASE_DIR};
- dir_check("do you wish to install the InspIRCd base", "BASE_DIR");
- if ($tmpbase ne $config{BASE_DIR}) {
- $config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Dir
- $config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
- $config{DATA_DIR} = resolve_directory($config{BASE_DIR}."/data"); # Data Directory
- $config{LOG_DIR} = resolve_directory($config{BASE_DIR}."/logs"); # Log Directory
- $config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
- }
-
- dir_check("are the configuration files", "CONFIG_DIR");
- dir_check("are the modules to be compiled to", "MODULE_DIR");
- dir_check("is the IRCd binary to be placed", "BINARY_DIR");
- dir_check("are variable data files to be located in", "DATA_DIR");
- dir_check("are the logs to be stored in", "LOG_DIR");
- dir_check("do you want the build to take place", "BUILD_DIR");
-
- my $chose_hiperf = 0;
- if ($has_kqueue) {
- yesno('USE_KQUEUE',"You are running a BSD operating system, and kqueue\nwas detected. Would you like to enable kqueue support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable kqueue?");
- print "\n";
- if ($config{USE_KQUEUE} eq "y") {
- $chose_hiperf = 1;
- }
- }
- if ($has_epoll) {
- yesno('USE_EPOLL',"You are running a Linux 2.6+ operating system, and epoll\nwas detected. Would you like to enable epoll support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable epoll?");
- print "\n";
- if ($config{USE_EPOLL} eq "y") {
- $chose_hiperf = 1;
- }
- }
- if ($has_ports) {
- yesno('USE_PORTS',"You are running Solaris 10.\nWould you like to enable I/O completion ports support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable support for I/O completion ports?");
- print "\n";
- if ($config{USE_PORTS} eq "y") {
- $chose_hiperf = 1;
- }
- }
-
- if (!$chose_hiperf) {
- yesno('USE_POLL', "Would you like to use poll?\n This is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable poll?");
- if ($config{USE_POLL} ne "y")
- {
- print "No high-performance socket engines are available, or you chose\n";
- print "not to enable one. Defaulting to select() engine.\n\n";
- }
- }
-
- $config{USE_FREEBSD_BASE_SSL} = "n";
- $config{USE_FREEBSD_PORTS_SSL} = "n";
- if ($config{HAS_OPENSSL_PORT} ne "")
- {
- $config{USE_FREEBSD_PORTS_SSL} = "y";
- print "I have detected the OpenSSL FreeBSD port installed on your system,\n";
- print "version \e[1;32m".$config{HAS_OPENSSL_PORT}."\e[0m. Your base system OpenSSL is version \e[1;32m".$openssl_ver."\e[0m.\n\n";
- yesno('USE_FREEBSD_PORTS_SSL', "Do you want to use the FreeBSD ports version?");
- print "\n";
- $config{USE_FREEBSD_BASE_SSL} = "y" if ($config{USE_FREEBSD_PORTS_SSL} eq "n");
-
- if ($config{USE_FREEBSD_BASE_SSL} eq "n")
- {
- # update to port version
- $openssl_ver = $config{HAS_OPENSSL_PORT};
- }
- }
- else
- {
- $config{USE_FREEBSD_BASE_SSL} = "y" if ($^O eq "freebsd");
- }
-
- $config{USE_SSL} = "n";
- $config{MODUPDATE} = 'n';
-
- if ($config{HAS_GNUTLS} eq "y" || $config{HAS_OPENSSL} eq "y")
- {
- print "Detected GnuTLS version: \e[1;32m" . $gnutls_ver . "\e[0m\n";
- print "Detected OpenSSL version: \e[1;32m" . $openssl_ver . "\e[0m\n\n";
-
- yesno('USE_SSL', "One or more SSL libraries detected. Would you like to enable SSL support?");
- if ($config{USE_SSL} eq "y")
- {
- if ($config{HAS_GNUTLS} eq "y")
- {
- yesno('USE_GNUTLS',"Would you like to enable SSL with m_ssl_gnutls? (recommended)");
- if ($config{USE_GNUTLS} eq "y")
- {
- print "\nUsing GnuTLS SSL module.\n";
- }
- }
-
- if ($config{HAS_OPENSSL} eq "y")
- {
- yesno('USE_OPENSSL', "Would you like to enable SSL with m_ssl_openssl?");
- if ($config{USE_OPENSSL} eq "y")
- {
- print "\nUsing OpenSSL SSL module.\nYou will get better performance if you move to GnuTLS in the future.\n";
- }
- }
- }
- }
- else
- {
- print "\nCould not detect OpenSSL or GnuTLS. Make sure pkg-config is installed and\n";
- print "is in your path.\n\n";
- }
-
- yesno('MODUPDATE',"Would you like to check for updates to third-party modules?");
- print "\n";
- if ($config{MODUPDATE} eq "y") {
- print "Checking for upgrades to extra and third party modules... ";
- system "./modulemanager upgrade";
- }
-}
-
-# We are on a POSIX system, we can enable POSIX extras without asking
-symlink "extra/m_regex_posix.cpp", "src/modules/m_regex_posix.cpp";
-
-dumphash();
-
-if (($config{USE_GNUTLS} eq "y") && ($config{HAS_GNUTLS} ne "y"))
-{
- print "Sorry, but i couldn't detect gnutls. Make sure gnutls-config is in your path.\n";
- exit(0);
-}
-if (($config{USE_OPENSSL} eq "y") && ($config{HAS_OPENSSL} ne "y"))
-{
- print "Sorry, but i couldn't detect openssl. Make sure openssl is in your path.\n";
- exit(0);
-}
-our $failed = 0;
-
-$config{CERTGEN} ||= 'y';
-yesno('CERTGEN',"Would you like generate SSL certificates now?") if ($interactive && ($config{USE_GNUTLS} eq "y" || $config{USE_OPENSSL} eq "y"));
-
-if ($config{USE_GNUTLS} eq "y") {
- unless (-r "src/modules/m_ssl_gnutls.cpp") {
- print "Symlinking src/modules/m_ssl_gnutls.cpp from extra/\n";
- symlink "extra/m_ssl_gnutls.cpp", "src/modules/m_ssl_gnutls.cpp" or print STDERR "Symlink failed: $!";
- }
- if ($interactive && $config{CERTGEN} eq 'y')
- {
- unless (-r "$config{CONFIG_DIR}/key.pem" && -r "$config{CONFIG_DIR}/cert.pem") {
- print "SSL Certificates Not found, Generating.. \n\n
-*************************************************************
-* Generating the Private Key may take some time, go grab a *
-* Coffee. Even better, to generate some more entropy if it *
-* is taking a while, open another console and type du / a *
-* few times and get that HD going :) Then answer the *
-* Questions which follow. If you are unsure, just hit enter *
-*************************************************************\n\n";
- $failed = system "./tools/genssl gnutls";
- if ($failed) {
- print "\n\e[1;32mCertificate generation failed!\e[0m\n\n";
- } else {
- print "\nCertificate generation complete, copying to config directory... ";
- File::Copy::move("key.pem", "$config{CONFIG_DIR}/key.pem") or print STDERR "Could not copy key.pem!\n";
- File::Copy::move("cert.pem", "$config{CONFIG_DIR}/cert.pem") or print STDERR "Could not copy cert.pem!\n";
- print "Done.\n\n";
- }
- }
- else {
- print "SSL Certificates found, skipping.\n\n";
- }
- }
- else
- {
- print "Skipping SSL certificate generation\nin non-interactive mode.\n\n";
- }