head	1.15;
access;
symbols
	HORDE_1_2_0_pre4:1.1.2.28
	STABLE_1_2:1.1.0.2;
locks; strict;
comment	@# @;


1.15
date	99.10.26.11.16.23;	author rkrusty;	state dead;
branches;
next	1.14;

1.14
date	99.10.15.01.52.49;	author rkrusty;	state Exp;
branches;
next	1.13;

1.13
date	99.09.10.09.52.52;	author rkrusty;	state Exp;
branches;
next	1.12;

1.12
date	99.09.10.09.37.06;	author rkrusty;	state Exp;
branches;
next	1.11;

1.11
date	99.08.26.13.05.40;	author rkrusty;	state Exp;
branches;
next	1.10;

1.10
date	99.08.26.13.05.39;	author rkrusty;	state Exp;
branches;
next	1.9;

1.9
date	99.08.24.07.29.52;	author rkrusty;	state Exp;
branches;
next	1.8;

1.8
date	99.08.24.07.19.36;	author rkrusty;	state Exp;
branches;
next	1.7;

1.7
date	99.08.24.01.01.52;	author rkrusty;	state Exp;
branches;
next	1.6;

1.6
date	99.08.22.12.15.34;	author rkrusty;	state Exp;
branches;
next	1.5;

1.5
date	99.08.22.12.15.34;	author rkrusty;	state Exp;
branches;
next	1.4;

1.4
date	99.08.19.17.21.25;	author rkrusty;	state Exp;
branches;
next	1.3;

1.3
date	99.08.19.17.21.23;	author rkrusty;	state Exp;
branches;
next	1.2;

1.2
date	99.08.19.15.44.20;	author rkrusty;	state Exp;
branches;
next	1.1;

1.1
date	99.08.13.12.06.57;	author rkrusty;	state dead;
branches
	1.1.2.1;
next	;

1.1.2.1
date	99.08.13.12.06.57;	author rkrusty;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	99.08.13.12.12.42;	author rkrusty;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	99.08.13.12.52.44;	author rkrusty;	state Exp;
branches;
next	1.1.2.4;

1.1.2.4
date	99.08.13.12.57.07;	author rkrusty;	state Exp;
branches;
next	1.1.2.5;

1.1.2.5
date	99.08.13.13.40.51;	author rkrusty;	state Exp;
branches;
next	1.1.2.6;

1.1.2.6
date	99.08.13.13.44.40;	author rkrusty;	state Exp;
branches;
next	1.1.2.7;

1.1.2.7
date	99.08.14.14.03.17;	author rkrusty;	state Exp;
branches;
next	1.1.2.8;

1.1.2.8
date	99.08.14.14.15.40;	author rkrusty;	state Exp;
branches;
next	1.1.2.9;

1.1.2.9
date	99.08.15.06.57.25;	author rkrusty;	state Exp;
branches;
next	1.1.2.10;

1.1.2.10
date	99.08.17.02.28.08;	author rkrusty;	state Exp;
branches;
next	1.1.2.11;

1.1.2.11
date	99.08.17.02.53.36;	author rkrusty;	state Exp;
branches;
next	1.1.2.12;

1.1.2.12
date	99.08.17.03.04.50;	author rkrusty;	state Exp;
branches;
next	1.1.2.13;

1.1.2.13
date	99.08.18.05.55.40;	author rkrusty;	state Exp;
branches;
next	1.1.2.14;

1.1.2.14
date	99.08.19.20.04.37;	author rkrusty;	state Exp;
branches;
next	1.1.2.15;

1.1.2.15
date	99.08.19.20.04.38;	author rkrusty;	state Exp;
branches;
next	1.1.2.16;

1.1.2.16
date	99.08.19.20.33.04;	author rkrusty;	state Exp;
branches;
next	1.1.2.17;

1.1.2.17
date	99.08.20.22.35.44;	author rkrusty;	state Exp;
branches;
next	1.1.2.18;

1.1.2.18
date	99.08.20.22.35.44;	author rkrusty;	state Exp;
branches;
next	1.1.2.19;

1.1.2.19
date	99.08.22.10.25.42;	author rkrusty;	state Exp;
branches;
next	1.1.2.20;

1.1.2.20
date	99.08.22.12.16.38;	author rkrusty;	state Exp;
branches;
next	1.1.2.21;

1.1.2.21
date	99.08.22.12.25.59;	author rkrusty;	state Exp;
branches;
next	1.1.2.22;

1.1.2.22
date	99.08.22.16.55.06;	author rkrusty;	state Exp;
branches;
next	1.1.2.23;

1.1.2.23
date	99.08.23.21.32.57;	author rkrusty;	state Exp;
branches;
next	1.1.2.24;

1.1.2.24
date	99.08.23.23.30.03;	author rkrusty;	state Exp;
branches;
next	1.1.2.25;

1.1.2.25
date	99.08.24.15.27.24;	author rkrusty;	state Exp;
branches;
next	1.1.2.26;

1.1.2.26
date	99.08.25.03.32.45;	author rkrusty;	state Exp;
branches;
next	1.1.2.27;

1.1.2.27
date	99.08.26.01.30.34;	author rkrusty;	state Exp;
branches;
next	1.1.2.28;

1.1.2.28
date	99.08.26.12.30.20;	author rkrusty;	state Exp;
branches;
next	1.1.2.29;

1.1.2.29
date	99.09.13.03.38.09;	author rkrusty;	state Exp;
branches;
next	1.1.2.30;

1.1.2.30
date	99.09.19.06.09.26;	author rkrusty;	state Exp;
branches;
next	1.1.2.31;

1.1.2.31
date	99.10.10.16.52.06;	author rkrusty;	state Exp;
branches;
next	1.1.2.32;

1.1.2.32
date	99.10.14.04.27.53;	author rkrusty;	state Exp;
branches;
next	1.1.2.33;

1.1.2.33
date	99.10.20.07.02.09;	author rkrusty;	state dead;
branches;
next	;


desc
@@


1.15
log
@[IEM] migrating in changes from 2.2 tree
@
text
@#!/usr/bin/perl
# Parts stolen from the phplibconfig scripts
# Hacked up by Ivan E. Moore II <rkrusty@@debian.org>


# Horde Setup variables
local( $HORDE_SETUP_VER )       = '3.2';
local( $module )                = $ARGV[0];
local( $HORDE_CONFIG_DIR )      = '/etc/horde';
local( $HORDE_DIR )             = '/usr/share/horde';
local( $PHPLIB_DIR )            = '/usr/lib/phplib';
local( $PHPINI_PATH )           = '/etc/php3/apache/php3.ini';
local( $PREPEND_FILE )          = '/etc/horde/prepend.php3';
local( $dbtype )                = check_opts();
local( $debian)                 = 'yes';
local( $APACHE_PATH )           = '/etc/apache';
local( $APACHE_SSL_PATH )       = '/etc/apache-ssl';
local( $db_pass )               = 'none';
local( $MODULE_SCRIPTS_DIR )    = '/usr/share/doc/' . $ARGV[0] . '/examples';
local( $MODULE_CONF_DIR )       = '/etc/' . $ARGV[0];
local $MODULE_DIR;              
local $MODULE_TABLE;
local $APACHE_LINE;
local $have_apache;
local $have_apache_ssl;

# Determine which module to setup and set module specific values

if ($module eq 'imp') {
  $MODULE_DIR = '/usr/share/horde/imp';
  $APACHE_LINE = 'Added for IMP';
  $MODULE_TABLE = "imp_pref";
}

# Is either apache or apache-ssl installed?
if (-d $APACHE_SSL_PATH) { $have_apache_ssl='yes'; } else { $have_apache_ssl='no'; }
if (-d $APACHE_PATH) { $have_apache='yes'; } else { $have_apache='no'; }


# Let's start this puppy

print "\nHORDE Project Configurator - 3.2+ \n" . '-' x 33 . "\n\n";


sub clean {
   local $path        = shift;

  print "* Cleaning up configuration files\n";
   system("/bin/sed -e 's#/usr/lib/phplib:/etc/horde#/etc/horde:/usr/lib/phplib#' $path/access.conf >$path/access.conf.tmp");
   system("if ! test $path/access.conf.horde.back; then (cp $path/access.conf $path/access.conf.horde.back); fi");
   system("if (grep 'HORDE' $path/access.conf.tmp >/dev/null 2>&1); then (mv $path/access.conf.tmp $path/access.conf); fi");

if ($module eq 'horde-clean') {
  system("cat $path/srm.conf | grep -v HORDE | grep -v horde > $path/srm.conf.tmp");
  system("cp $path/srm.conf $path/srm.conf.horde.save > /dev/null 2>&1");
  system("cp $path/srm.conf.tmp $path/srm.conf > /dev/null 2>&1");
}

if ($module eq 'imp-clean') {
 system("cat $path/srm.conf | grep -v IMP | grep -v imp> $path/srm.conf.tmp");      
 system("cp $path/srm.conf $path/srm.conf.imp.save > /dev/null 2>&1");      
 system("cp $path/srm.conf.tmp $path/srm.conf > /dev/null 2>&1");      
}

}


sub config_apache {
   local $path        = shift;

  print "* Verify Apache configuration files\n";

  if (($module eq 'horde') | ($module eq 'imp') | ($module eq 'skattek')){
    print "  + $path/srm.conf  (Verifying Horde Related Aliases)\n";
        system("if (grep '$APACHE_LINE' $path/srm.conf >/dev/null 2>&1); then (echo '    - $module alias should be o.k.'); else (echo '# $APACHE_LINE' >> $path/srm.conf && echo 'Alias /$module $MODULE_DIR' >> $path/srm.conf && echo '    + $module alias added.'); fi");
  }

}

sub command_prompt { 
   local $prompt        = shift;
   local $command;
   if ( ! $prompt ) {      
         print "\n\n" . 'Command : ';
   } else {                  
         print "\n\n" . $prompt;
   }
   $command = <STDIN>;
   $command =~ s/\n//g;
   $command =~ s/\r//g;
   return $command;
}

sub clear_screen() { system( "clear" ); }

sub config_title_bar {
   local $sub_menu = shift;
   print 'HORDE Setup - Version : ' . $HORDE_SETUP_VER . ' Configuration Menu.' . "\n";
   if ( $sub_menu ) { print $sub_menu . "\n"; }
   print '-' x 50 . "\n\n";
}

sub menu_option {                
   local $opt_num       = shift;
   local $text          = shift;
   print ' ' . $opt_num . ') ' . $text . "\n";
}




sub set_value {   
   local $prompt        = shift;
   local $input_val     = shift;
   local $help_text     = shift;
   local $temp, $new_val;
   local $prompt_out;
   if ( $help_text ne '' ) {
      $prompt_out = $prompt . ' [ ' . $$input_val . ' ] ' . "\n" . $help_text . "\n: ";
   } else {
      $prompt_out = $prompt . ' [ ' . $$input_val . ' ] : ';
   }
   $temp = command_prompt( $prompt_out );
   if ( $temp ) {
      $$input_val = $temp;
      return $$input_val;
   } else {
      return $$input_val;
   }
}

sub build_libs
{
  local $command;
  
  print "*  Processing horde libraries\n";
  if ($dbtype) {
    print "  - Database previously set to: $dbtype\n";
  } else {
  print "\n\n";
  config_title_bar( 'HORDE Database Configuration.' );
  menu_option( '0', 'Postgresql');
  menu_option( '1', 'MySql');
  $command = command_prompt();

  if ( $command eq '0' ) {
        $dbtype = 'postgres';
  }
  if ( $command eq '1' ) {
        $dbtype = 'mysql';
  }

  }
 

  print "    + building $module libraries...\n";
  system("cd $MODULE_DIR/lib/src && ./build.pl --database=$dbtype >> /dev/null 2>&1");         
}

sub check_opts
{
   open(OPTIONS, "$HORDE_CONFIG_DIR/build.opts") || return "";

   while(<OPTIONS>) {
     chomp();
     ($Option_Name, $Option_Value) = split('=', $_);
     $Options{$Option_Name} = $Option_Value;
    }
    close(OPTIONS);
    if(exists($Options{"database"})) { $db = $Options{"database"}; }
    else { $db = ""; }

return $db;
}

sub migrate_horde_db
{
  $PSQL_QUERY = "create database horde";

  print "          + Migrating database from imp to horde...\n";
  print "\n\n";
  print "What is your database password? (type in \"none\" for no password)\n";
  print "This is the password you want Horde to use.\n";
  print "(Will be show in clear text, but not stored) ";
  $db_pass = command_prompt('Password: ');
  if (! ($db_pass)) {
    $db_pass = 'none';
  }

  if ($db_pass eq 'none') { $db_pass = ''; }
  system("su - postgres -c '$MODULE_SCRIPTS_DIR/pgsql_cuser.sh $db_pass >>/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/pg_dump imp -f /tmp/imp.out >>/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/psql -c \"$PSQL_QUERY\" template1 >>/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/psql -e horde </tmp/imp.out >>/dev/null 2>&1; rm /tmp/imp.out >>/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/psql template1 < $MODULE_SCRIPTS_DIR/pgsql_create.sql >>/dev/null 2>&1'");

}

sub build_horde_db 
{

  $PSQL_QUERY = "create database horde";
  $PSQL2_QUERY = "GRANT SELECT, INSERT, UPDATE ON active_sessions, auth_user, auth_user_md5 TO hordemgr";
  print "\n\n";
  print "What is your database password? (type in \"none\" for no password)\n";
  print "This is the password you want Horde to use.\n";
  print "(Will be show in clear text, but not stored) ";
  $db_pass = command_prompt('Password: ');
  if (! ($db_pass)) {
    $db_pass = 'none';
  }

  if ($db_pass eq 'none') { $db_pass = ''; }
  print "    + Creating horde database...\n";
  system("su - postgres -c '$MODULE_SCRIPTS_DIR/pgsql_cuser.sh $db_pass >/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/psql template1 -c \"$PSQL_QUERY\" >/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/psql template1 < $MODULE_SCRIPTS_DIR/pgsql_create.sql' >>/dev/null 2>&1");

}

sub check_horde_db
{
  local $database = shift;

  print "    + Checking $database database...\n";
  $db_owner = "postgres";
  $com1 = "/usr/bin/psql -d $database -c '\\dt'";
  $com2 = "su - ";
  $com4 = ' -c "';
  $com3 = '" | grep ';
  if (!(system("$com2$db_owner$com4$com1$com3$MODULE_TABLE >/dev/null 2>&1")))
  {
    return('true');
  } else {
    return('false');
  }
}

sub configure_postgresql
{
  $PSQL2_QUERY = "GRANT SELECT, INSERT, UPDATE ON active_sessions, auth_user, auth_user_md5 TO hordemgr";
  print "  + Seeing if the Database needs to be configured...\n";
  $dbok = check_horde_db('horde');
  if ($dbok eq "false") {
    print "    + horde database not configured\n";
    $db2ok = check_horde_db('imp');
    if ($db2ok eq "true") {
      print "\n\n  + imp database is configured.\n";
      print "    + Attempting database migration for you...\n";
      print "      - Your old database will not be removed...\n";
      migrate_horde_db();
    } else {
      build_horde_db();
    }
  } else {
    system("su - postgres -c '/usr/bin/psql template1 -c \"$PSQL2_QUERY\" >/dev/null 2>&1'");
    print "  - horde database seems configured properly\n";
  }
}

sub configure_mysql
{

  print "  + Database Configuration\n";
  print "\n\n";
  print "What is your database password? (type in \"none\" for no password)\n";
  print "(Will be show in clear text, but not stored) ";
  $db_pass = command_prompt('Password: ');
  if (! ($db_pass)) {
    $db_pass = 'none';
  }

  print "    + Attempting to auto-config MySQL for you...\n";
    if ($db_pass eq "none") {
      system("/usr/bin/mysql -f < $MODULE_SCRIPTS_DIR/mysql_create.sql ");
    } else {
      system("/usr/bin/mysql -f --password=$db_pass < $MODULE_SCRIPTS_DIR/mysql_create.sql");
    }
}

sub build_imp_defaults
{
$etc="$MODULE_CONF_DIR";
$syshostname=`hostname --fqdn`;    
chop($syshostname=`hostname --fqdn`);

if ($dbtype eq 'postgres') {
  $impmgr='hordemgr';
  $impmgr_passwd='$db_pass';
  $db_name='horde';
}
if ($dbtype eq 'mysql') {
  $impmgr='impmgr';
  $impmgr_passwd='impmgr';
  $db_name='imp';
}

    &setfile('defaults.php3',
'<?php',
"

/* true = put the compose window in the main frame; false = use a popup window for compose windows */
\$default->minimum_popups = false;

/* For debugging purposes */
\$default->error_level               = 15;

/* The longest that things like file uploads and slow functions should be
 * allowed to run. 0 means run until termination (forever if infinite loop).
 * NOTE: you can't set this to 0 if safe_mode is on. */
\$default->max_execution_time        = 0;

/* Server Specific Configuration */
\$default->localhost                 = '$syshostname';

/* Imap Server Default */
\$default->server                    = '$syshostname';
\$default->from_server               = '$syshostname';
\$default->port                      = 143;
\$default->servtype                  = 'imap';

/* Web server configuration */
\$default->root_url                  = '/imp';
\$default->include_dir               = './templates';
\$default->graphics_url              = \$default->root_url . '/graphics';

/* Folder configuration */
\$default->folders                   = '';
\$default->use_imap_subscribe        = true;
\$default->show_dotfiles             = false;
\$default->sent_mail                 = 'sent-mail';
\$default->save_sent_mail            = true;
\$default->drafts                    = 'drafts';

/* Allow caching of the pages */
\$default->cache_pages               = false;

/* Ldap searching */
\$default->use_ldap_search           = true;

/* user is presented with an list of available imap servers */
\$default->use_server_list           = false;

/* User changable items */
\$default->user_change_server        = true;
\$default->user_change_port          = true;
\$default->user_change_servtype      = true;
\$default->user_change_folder        = true;
\$default->user_change_from          = true;
\$default->user_change_fullname      = true;
\$default->user_use_addressbook      = true;
\$default->user_use_folders          = true;

/* New mail configuration */
/* Refresh between check for new mail */
\$default->refresh_delay                  = 300;
\$default->newmail_popup                  = true;

/* Cookie configuration */
\$default->session_enabled           = false;
\$default->session_timeout           = 300;
\$default->cookie_timeout            = 10000;

/* Path to sendmail */
\$default->path_to_sendmail          = '/usr/sbin/sendmail';

/* Ispell setup */
\$default->path_to_ispell            = '/usr/bin/ispell';

/* Mswordview setup */
\$default->path_to_mswordview        = '/usr/bin/mswordview -c';

/* path to tar so that tarballs can be listed */
\$default->path_to_tar               = '/bin/tar';

/* poppasswd support */
\$default->poppassd_server           = '/dev/null';
\$default->poppassd_port             = '0';

/* SSL Configuration block */
\$default->secure                    = true;

/* Cyrus configuration block */
\$default->personal_folders          = '';
// cyrus configs may look like this:
// \$default->personal_folders       = 'INBOX.';

/* Default Language */
\$default->language                  = 'en';

\$default->append_header             = true;
\$default->append_trailer            = true;

\$default->text_parts_inline         = true;

/* database config */
\$default->use_db                    = true;
\$default->db_user_name              = '$impmgr';
\$default->db_password               = '$impmgr_passwd';
\$default->db_name                   = '$db_name';
\$default->db_server_name            = 'localhost';
\$default->db_pref_table             = 'imp_pref';
\$default->db_address_table          = 'imp_addr';
\$default->db_connect_string         = '';
\$default->db_server_port            = '';
\$default->db_server_options         = '';
\$default->db_server_tty             = '';

?>
");    

sub setfileshort {
    local ($filename,$value) = @@_;
    push(@@files,$filename);
    $filecontents{$filename}= $value;
}

sub setfile {
    local ($filename,$value1,$value2,$d) = @@_;
    chop($d=`date`);
    $v=
"$value1\
$value2";
    push(@@files,$filename);
    $filecontents{$filename}=$v;
}

sub reswarn {
    print STDERR "$_[0]\n";
    return 0;
}
for $f (@@files) {
    open(N,">$etc/$f.postinstnew") || die "Error creating $etc/$f.postinstnew: $!\n";
    print(N $filecontents{$f}) || die "Error writing $etc/$f.postinstnew: $!\n";
    close(N) || die "Error closing $etc/$f.postinstnew: $!\n";
}

while (defined($f= pop(@@files))) {
    rename("$etc/$f.postinstnew","$etc/$f") || die "Error installing $etc/$f: $!\n";
}


while (defined($f= pop(@@files))) {
    rename("$etc/$f.postinstnew","$etc/$f") || die "Error installing $etc/$f: $!\n";
}

}


if (($module eq 'skattek') | ($module eq 'horde') | ($module eq 'imp')) {
  if ($have_apache eq 'yes') { config_apache($APACHE_PATH); }
  if ($have_apache_ssl eq 'yes') { config_apache($APACHE_SSL_PATH); }
  
  build_libs();
  print "    + installing custom prepend file\n";
  print "* Database Configuration\n";
  if ($dbtype eq 'postgres') { configure_postgresql(); }
  if ($dbtype eq 'mysql') { configure_mysql(); }

  print "* Checking horde specific configuration files\n";
  if (-s "$MODULE_CONF_DIR/defaults.php3") {
    print "  - Leaving existing defaults.php3 file alone\n";
  } else {
    print "  + Building generic defaults.php3 file.\n";
    if ($module eq 'imp') {
      build_imp_defaults();
    }
  }

  print "  + fixing file permissions\n";
  system("chown -R www-data.root $HORDE_DIR >> /dev/null 2>&1");
  system("chmod -R 555 $MODULE_DIR/lib/*.lib >> /dev/null 2>&1");
  system("chmod 000 $HORDE_DIR/setup.php3 >> /dev/null 2>&1");
  system("chmod 555 $MODULE_CONF_DIR/*.php3 $MODULE_CONF_DIR/*.txt $MODULE_CONF_DIR/*.html >> /dev/null 2>&1 ");

  print "* Restarting Affected Services\n";

  if ($debian eq 'yes') {

    if ($dbtype eq 'postgres') {
      print "  + PostgreSql\n";
      system("/etc/init.d/postgresql stop >> /dev/null 2>&1 ; /etc/init.d/postgresql start >> /dev/null 2>&1 ");
    }
    if ($dbtype eq 'mysql') {
      print "  + MySql\n";
      system("/etc/init.d/mysql restart >> /dev/null 2>&1 ");
    }
    if ($have_apache eq 'yes') { 
      print "  + Apache\n";
      system("/etc/init.d/apache reload >> /dev/null 2>&1 ");
    }
    if ($have_apache_ssl eq 'yes') {
      print "  + Apache-SSL\n";
      system("/etc/init.d/apache-ssl reload >> /dev/null 2>&1 ");
    }
  } else {
    if ($have_apache eq 'yes') { print "  + Please restart Apache\n"; }
    if ($have_apache_ssl eq 'yes') { print "  + Please restart Apache-SSL\n"; }
    if ($dbtype eq 'postgres') { print "  + Please restart PostgreSql\n"; }
    if ($dbtype eq 'mysql') { print "  + Please restart MySql\n"; }
  }


  exit 0;
}

if ( ($module eq 'horde-clean') || ($module eq 'imp-clean') || ($module eq 'skattek-clean') || ($module eq 'clean') ) {
  if ($have_apache eq 'yes') { clean($APACHE_PATH); }
  if ($have_apache_ssl eq 'yes') { clean($APACHE_SSL_PATH); }
  print "\n\n";
  exit 0;
}

print "Usage:  hordesetup modulename \n";        
print "\nModulenames are horde, imp, and skattek currently\n\n";  
exit 1;  
@


1.14
log
@[IEM] updating the -dev tree's debian stuff...(debconf, etc...)
@
text
@@


1.13
log
@[IEM] adding in PHPLIB document (from phplib/README) (more deb updates)
@
text
@d7 1
a7 1
local( $HORDE_SETUP_VER )       = '3.0';
d12 1
a12 1
local( $PHPINI_PATH )           = '/etc/php3';
a28 7
if ($module eq 'horde') {
  $MODULE_DIR = '/usr/share/horde';
  $MODULE_SCRIPTS_DIR = '/usr/share/doc/horde/examples';
  $APACHE_LINE = 'Added for HORDE';
  $MODULE_TABLE = "active_sessions";
}

a34 7
if ($module eq 'skattek') {
  $MODULE_DIR = '/usr/share/horde/skattek'; 
  $APACHE_LINE = 'Added for SKATTEK';
  $MODULE_TABLE = "fw_users";
}


d42 1
a42 1
print "\nHORDE Project Configurator - 3.0+ \n" . '-' x 33 . "\n\n";
a51 1
  
d53 4
d59 5
d65 1
a65 10
sub config_php3 {

  print "* Verify PHP3 configuration files\n";
  foreach $i (split(/\n/, `find $PHPINI_PATH -name "*.ini" -print`)) {
    print "  + $i\n";
    $changed = 0;
        system("if (grep 'extension=imap.so' $i >/dev/null 2>&1); then (echo '    - imap extension o.k.'); else (echo 'extension=imap.so' >> $i && echo '    + imap extension added.'); fi ");
        system("if (grep 'extension=ldap.so' $i >/dev/null 2>&1); then (echo '    - ldap extension o.k.'); else (echo 'extension=ldap.so' >> $i && echo '    + ldap extension added.'); fi ");
        system("if (grep 'extension=pgsql.so' $i >/dev/null 2>&1); then (echo '    - pgsql extension o.k.'); else (echo 'extension=pgsql.so' >> $i && echo '    + pgsql extension added.'); fi ");
        system("if (grep 'extension=mysql.so' $i >/dev/null 2>&1); then (echo '    - mysql extension o.k.'); else (echo 'extension=mysql.so' >> $i && echo '    + mysql extension added.'); fi ");
a66 2
  }
}
a72 5
if ($module eq 'horde') {
   print "  + $path/access.conf\n";
   system("if (grep '$APACHE_LINE' $path/access.conf >/dev/null 2>&1); then (echo '    - horde directory should be o.k.'); else (echo ' ' >> $path/access.conf && echo '# $APACHE_LINE' >> $path/access.conf && echo '<Directory $HORDE_DIR>' >> $path/access.conf && echo 'Options Indexes FollowSymLinks' >> $path/access.conf && echo 'AllowOverride None' >> $path/access.conf && echo 'order allow,deny' >> $path/access.conf && echo 'allow from all' >> $path/access.conf && echo 'php3_include_path $HORDE_CONFIG_DIR:$PHPLIB_DIR' >> $path/access.conf && echo 'php3_auto_prepend_file $PREPEND_FILE' >> $path/access.conf && echo 'php3_magic_quotes_gpc Off' >> $path/access.conf && echo '</Directory>' >> $path/access.conf && echo '    + horde directory added.'); fi");
   } 

d74 1
a74 1
    print "  + $path/srm.conf\n";
a152 1
  system("echo 'database=$dbtype' >> $HORDE_CONFIG_DIR/build.opts");
d155 1
d215 2
a216 2
  system("su - postgres -c '$MODULE_SCRIPTS_DIR/pgsql_cuser.sh $db_pass >>/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/psql -c \"$PSQL_QUERY\" template1 >>/dev/null 2>&1'");
d231 1
a231 1
  if (system("$com2$db_owner$com4$com1$com3$MODULE_TABLE >>/dev/null 2>&1"))
d233 2
a235 2
  } else {
    return('true');
d243 2
a244 1
  if (!(check_horde_db('horde'))) {
d246 2
a247 1
    if ((check_horde_db('imp'))) {
d256 1
a256 1
    system("su - postgres -c '/usr/bin/psql -c \"$PSQL2_QUERY\" template1 >>/dev/null 2>&1'");
a280 180
sub build_skattek_defaults
{      
$etc="$MODULE_CONF_DIR";
$syshostname=`hostname --fqdn`;
chop($syshostname=`hostname --fqdn`);

if ($dbtype eq 'postgres') {
  $impmgr='hordemgr';       
  $impmgr_passwd='';
}

    &setfile('defaults.php3',
'<?php',
"

/* For debugging purposes */
\$default->error_level               = 15;

\$default->max_execution_time        = 0;

\$default->localhost                 = '$syshostname';

/* Web server configuration */
\$default->root_url                  = '/horde/skattek';
\$default->include_dir             = './templates';
\$default->graphics_url              = \$default->root_url . '/graphics';

\$default->cache_pages               = false;

\$default->path_to_ipchains          = '/sbin/ipchains';
\$default->path_to_ipfwadm           = '/sbin/ipfwadm';
\$default->path_to_ssh               = '/usr/bin/ssh';

\$default->cookie_timeout            = '10000';
\$default->secure                    = true;
\$default->language                  = 'en';

\$default->use_db                    = true;
\$default->db_user_name              = 'hordemgr';
\$default->db_password               = '$db_pass';
\$default->db_name                   = 'horde';
\$default->db_server_name            = 'localhost';
\$default->db_objects_table          = 'objects';
\$default->db_fw_users_table         = 'fw_users';
\$default->db_policy_table           = 'policy';
\$default->db_fw_objects_table       = 'fw_objects';
\$default->db_services_table         = 'services';
\$default->db_connect_string         = '';
\$default->db_server_port            = '';
\$default->db_server_options         = '';
\$default->db_server_tty             = '';

?>
"); 

sub setfileshort {
    local ($filename,$value) = @@_;
    push(@@files,$filename);
    $filecontents{$filename}= $value;
}

sub setfile {
    local ($filename,$value1,$value2,$d) = @@_;
    chop($d=`date`);
    $v=
"$value1\
$value2";
    push(@@files,$filename);
    $filecontents{$filename}=$v;
}
sub reswarn {
    print STDERR "$_[0]\n";
    return 0;
}

for $f (@@files) {
    open(N,">$etc/$f.postinstnew") || die "Error creating $etc/$f.postinstnew: $!\n";
    print(N $filecontents{$f}) || die "Error writing $etc/$f.postinstnew: $!\n";
    close(N) || die "Error closing $etc/$f.postinstnew: $!\n";
}

while (defined($f= pop(@@files))) {
    rename("$etc/$f.postinstnew","$etc/$f") || die "Error installing $etc/$f: $!\n";
}


while (defined($f= pop(@@files))) {
    rename("$etc/$f.postinstnew","$etc/$f") || die "Error installing $etc/$f: $!\n";
}
}


sub build_horde_defaults
{
$etc="$HORDE_CONFIG_DIR";
$syshostname=`hostname --fqdn`;    
chop($syshostname=`hostname --fqdn`);

if ($dbtype eq 'postgres') {
  $impmgr='hordemgr';
  $impmgr_passwd='$db_pass';
  $db_name='horde';
}
if ($dbtype eq 'mysql') {
  $impmgr='impmgr';
  $impmgr_passwd='impmgr';
  $db_name='imp';
}


    &setfile('defaults.php3',
'<?php',
"

\$default->root_url                 = '/horde';
\$default->graphics_url             = '/horde/graphics';
\$default->faq_url                  = 'http://faq.horde.org/';
\$default->horde_include_dir        = './templates';

/* Path to sendmail */
\$default->path_to_sendmail         = '/usr/sbin/sendmail';

\$default->cache_pages              = true;

/* database config */
\$default->use_db                    = true;
\$default->db_user_name              = '$impmgr';       
\$default->db_password               = '$impmgr_password';
\$default->db_name                   = 'horde';
\$default->db_server_name            = 'localhost';
\$default->db_signup_table           = 'horde_signup';
\$default->db_pref_table             = 'horde_pref';
\$default->db_connect_string         = '';
\$default->db_server_port            = '';
\$default->db_server_options         = '';
\$default->db_server_tty             = '';

?>
");    


sub setfileshort {
    local ($filename,$value) = @@_;
    push(@@files,$filename);
    $filecontents{$filename}= $value;
}

sub setfile {
    local ($filename,$value1,$value2,$d) = @@_;
    chop($d=`date`);
    $v=
"$value1\
$value2";
    push(@@files,$filename);
    $filecontents{$filename}=$v;
}

sub reswarn {
    print STDERR "$_[0]\n";
    return 0;
}

for $f (@@files) {
    open(N,">$etc/$f.postinstnew") || die "Error creating $etc/$f.postinstnew: $!\n";
    print(N $filecontents{$f}) || die "Error writing $etc/$f.postinstnew: $!\n";
    close(N) || die "Error closing $etc/$f.postinstnew: $!\n";
}

while (defined($f= pop(@@files))) {
    rename("$etc/$f.postinstnew","$etc/$f") || die "Error installing $etc/$f: $!\n";
}


while (defined($f= pop(@@files))) {
    rename("$etc/$f.postinstnew","$etc/$f") || die "Error installing $etc/$f: $!
\n";
}

}

d302 2
a303 2
/* the session file (dbm file) */
\$default->session_file = './lib/sessions';
d333 1
a333 1
\$default->postponed                 = 'postponed-msgs';
d376 4
a450 2
  if ($have_apache eq 'yes') { config_php3($APACHE_PATH); }
  if ($have_apache_ssl eq 'yes') { config_php3($APACHE_SSL_PATH); }
d453 1
a453 1

a455 3
  if ($dbtype eq "postgres") { system("cp $HORDE_CONFIG_DIR/prepend.pgsql $PREPEND_FILE > /dev/null 2>&1"); }
  if ($dbtype eq "mysql") { system("cp $HORDE_CONFIG_DIR/prepend.mysql $PREPEND_FILE > /dev/null 2>&1"); }

a467 6
    if ($module eq 'horde') {
      build_horde_defaults();
    }
    if ($module eq 'skattek') {
      build_skattek_defaults();
    }
a503 14
  system("sleep 4");
  print "\n         *****   NOTE NOTE NOTE ***** \n\n";
  print "The database for postgresql users has moved from imp to horde \n";
  print "and the database user from www-data to hordemgr.  Please make \n";
  print "sure that your defaults.php3 file for horde and imp are set \n";
  print "properly if you are upgrading either.  MySql users will need \n";
  print "to be aware that this will happen to them once the conversion \n";
  print "has been written and tested.   \n\n";
  print "Also, if you have been using horde since prior to pre3-8 plase \n";
  print "make sure you have: \n\n";
  print "       php3_magic_quotes_gpc Off   \n";
  print "\nset in your /etc/apache/access.conf in the HORDE Directory statement\n\n";
  $foo = command_prompt('Press Return');
  print "\n";
d507 1
a507 1
if ($module eq 'clean') {
@


1.12
log
@[IEM] updating hordesetup script
@
text
@d31 1
a31 1
  $MODULE_SCRIPTS_DIR = '/usr/share/doc/horde-core/examples';
@


1.11
log
@[IEM] debian updates ... and

migrating fixes from 2.2 to -dev for signup
@
text
@d4 25
a28 9
#
local( $HORDE_SETUP_VER )        = '2.0';
local $dbtype;
local $module = $ARGV[0];
$debian = 'yes';

$PHPLIB_DIR = '/usr/lib/phplib';
$PHPINI_PATH = '/etc/php3';
$POSTMASTER_INI_FILE = '/etc/postgresql/postmaster.init';
a29 3
  $HORDE_CONFIG_DIR = '/etc/horde';
  $HORDE_DIR = '/usr/share/horde';
  $MODULE_SCRIPTS_DIR = '/usr/doc/horde-core/scripts';
d31 1
a31 2
  $MODULE_CONF_DIR = '/etc/horde';
  $PREPEND_FILE = '/etc/horde/prepend.php3';
a37 2
  $MODULE_CONF_DIR = '/etc/imp';
  $MODULE_SCRIPTS_DIR = '/usr/doc/imp/scripts';
a38 3
  $HORDE_CONFIG_DIR = '/etc/horde';
  $HORDE_DIR = '/usr/share/horde';
  $PREPEND_FILE = '/etc/horde/prepend.php3';
a42 1
  $MODULE_CONF_DIR = '/etc/skattek'; 
a43 3
  $MODULE_SCRIPTS_DIR = '/usr/doc/skattek/scripts';
  $HORDE_DIR = '/usr/share/horde';
  $HORDE_CONFIG_DIR = '/etc/horde';
a44 1
  $PREPEND_FILE = '/etc/horde/prepend.php3';
d49 3
a52 12
$have_apache='no';
if (-d '/etc/apache-ssl') {
  $APACHE_PATH = '/etc/apache-ssl';
  $have_apache='yes';
} else {
  if (-d '/etc/apache') {
    $APACHE_PATH = '/etc/apache';
    $have_apache='yes';
  } else {
    $have_apache='no';
  }
}
d54 4
a57 1
print "\nHORDE Project Configurator - 2.0+ \n" . '-' x 33 . "\n\n";
d59 2
a60 1
if ($module eq 'clean') {
d62 5
a66 15
 foreach $i (split(/\n/, `find $PHPINI_PATH -name "*.ini" -print`)) {
   print "  + $i\n";
   getinifile("$i", 'PHP_3', \%values);
   print "    - Removing HORDE include path.\n";
   $values{'include_path'} = s/ //g;
   print "    - Removing old prepend.php3 statements.\n";
   $values{'auto_prepend_file'} = s/ //g;
   setinifile($i, "$i.new", 'PHP_3', %values);
   @@filelist = split(/\n/, `ls -q1 $i*`);
   rename $i, "$i.old";
   rename "$i.new", $i;
 }
   system("/bin/sed -e 's#/usr/lib/phplib:/etc/horde#/etc/horde:/usr/lib/phplib#' $APACHE_PATH/access.conf >$APACHE_PATH/access.conf.tmp");
   system("cp $APACHE_PATH/access.conf $APACHE_PATH/access.conf.back");
   system("if (grep 'HORDE' $APACHE_PATH/access.conf.tmp >/dev/null 2>&1); then (mv $APACHE_PATH/access.conf.tmp $APACHE_PATH/access.conf); fi");
a69 1
if (($module eq 'skattek') | ($module eq 'horde') | ($module eq 'imp')) {
d71 4
a74 2
print "* Verify PHP3 configuration files\n";
foreach $i (split(/\n/, `find $PHPINI_PATH -name "*.ini" -print`)) {
d85 2
a86 11
if ($have_apache eq 'yes') {
if ($module eq 'horde') {
   print "  + $APACHE_PATH/access.conf\n";
   system("if (grep '$APACHE_LINE' $APACHE_PATH/access.conf >/dev/null 2>&1); then (echo '    - HORDE Directory should be o.k.'); else (echo ' ' >> $APACHE_PATH/access.conf && echo '# $APACHE_LINE' >> $APACHE_PATH/access.conf && echo '<Directory $HORDE_DIR>' >> $APACHE_PATH/access.conf && echo 'Options Indexes FollowSymLinks' >> $APACHE_PATH/access.conf && echo 'AllowOverride None' >> $APACHE_PATH/access.conf && echo 'order allow,deny' >> $APACHE_PATH/access.conf && echo 'allow from all' >> $APACHE_PATH/access.conf && echo 'php3_include_path $HORDE_CONFIG_DIR:$PHPLIB_DIR' >> $APACHE_PATH/access.conf && echo 'php3_auto_prepend_file $PREPEND_FILE' >> $APACHE_PATH/access.conf && echo 'php3_magic_quotes_gpc Off' >> $APACHE_PATH/access.conf && echo '</Directory>' >> $APACHE_PATH/access.conf && echo '    + HORDE Directory added.'); fi");
}
if (($module eq 'horde') | ($module eq 'imp') | ($module eq 'skattek')){
    print "  + $APACHE_PATH/srm.conf\n";
        system("if (grep '$APACHE_LINE' $APACHE_PATH/srm.conf >/dev/null 2>&1); then (echo '    - $module Alias should be o.k.'); else (echo '# $APACHE_LINE' >> $APACHE_PATH/srm.conf && echo 'Alias /$module $MODULE_DIR' >> $APACHE_PATH/srm.conf && echo '    + $module Alias added.'); fi");
}

}
d88 1
a88 4
sub getinifile
{
    my ($filename, $section, $values) = @@_;
    my $found = 0;
d90 4
a93 12
    undef %$values;
    open(FILE, "< $filename");
    while(<FILE>) {
        if ($section ne '' and $found == 0) {
            $found = 1 if (/^\[$section\].*/);
            next;
        }
        next if ($found == 0);
        $values->{$1} = $2 if (/^\s*([\w-_]+)\s*=\s*(.*?)\s*(;.+)*$/);
    }
    close(FILE);
}
d95 4
a98 4
sub setinifile
{
    my ($infile, $outfile, $section, %newvalues) = @@_;
    my $found = $section eq '' ? 1 : 0;
a99 15
    open(INFILE, "< $infile");
    open(OUTFILE, "> $outfile");
    while(<INFILE>) {
        if ($found == 0) {
            $found = 1 if (/^\[$section\].*/);
        }
        if ($found > 0 and /^\s*([\w-_]+)\s*=\s*(.*?)\s*(;.+)*$/ and $newvalues{$1} ne "$2") {
            print OUTFILE "$1 = $newvalues{$1} $3\n";
        }
        else {     
            print OUTFILE $_;
        }
    }
    close(OUTFILE);
    close(INFILE);
d102 1
a102 1
sub command_prompt {                     
d157 2
a158 2
  $dbtype=check_opts();

d160 1
a160 1
    print "    - Database previously set to: $dbtype\n";
d177 2
a178 15
 if ( $dbtype eq 'mysql' ) {
        print "\n\n";
        print "What is your MySql password? (type in \"none\" for no password)";
        $db_pass = command_prompt('Password: ');
      if (! ($db_pass)) {
         $db_pass = 'none';
      }
  }
 if ( $dbtype eq 'postgres' ) {
        system("cp $HORDE_CONFIG_DIR/horde_phplib.inc.pgsql $HORDE_CONFIG_DIR/horde_phplib.inc");
    }
    if ( $dbtype eq 'mysql' ) {
        system("cp $HORDE_CONFIG_DIR/horde_phplib.inc.mysql $HORDE_CONFIG_DIR/horde_phplib.inc");
    }

a179 8
  system("cd $HORDE_CONFIG_DIR/modules && ./create_config.pl >> /dev/null 2>&1");
  system("cd $MODULE_DIR/locale && ./buildLang.sh >>/dev/null 2>&1");
  system("chown -R www-data.root $HORDE_DIR >> /dev/null 2>&1");
  system("chown -R www-data.root $MODULE_CONF_DIR >> /dev/null 2>&1");
  system("chmod -R 555 $MODULE_DIR/lib/*.lib >> /dev/null 2>&1");
  system("chmod 000 $HORDE_DIR/setup.php3 >> /dev/null 2>&1");
  system("chmod 555 $MODULE_CONF_DIR/*.php3 $MODULE_CONF_DIR/*.txt $MODULE_CONF_DIR/*.html >> /dev/null 2>&1");
  
d198 22
d221 1
a221 1
sub configure_database
d223 1
d225 23
a247 3
  print "  + Database Configuration\n";
 if ($dbtype eq "postgres") {
  print "    + Seeing if the Database needs to be configured...\n";
d249 1
a249 1
  $com1 = "/usr/bin/psql -d imp -c '\\dt'";
d253 1
a253 1
  if (!(system("$com2$db_owner$com4$com1$com3$MODULE_TABLE >/dev/null")))
d255 17
a271 18
    print "    + imp database found...looking for horde database...\n";
    $db_owner = "postgres";  
    $com1 = "/usr/bin/psql -d horde -c '\\dt'";
    $com2 = "su - ";
    $com4 = ' -c "';
    $com3 = '" | grep ';
    if (system("$com2$db_owner$com4$com1$com3$MODULE_TABLE >/dev/null"))
    {
      print "\n\n    + Not found.  Attempting database migration for you...\n";
      print "      Your old database will not be removed...\n";
      print "\n\n";
      print "What is your horde database user password? (pick one if you don't have one) ";
      $db_pass = command_prompt('Password: ');
      system("su - postgres -c '$MODULE_SCRIPTS_DIR/pgsql_cuser.sh $db_pass >>/dev/null 2>&1'");
      system("su - postgres -c '/usr/bin/pg_dump imp -f /tmp/imp.out >>/dev/null 2>&1'");
      system("su - postgres -c '/usr/bin/psql -c \"$PSQL_QUERY\" template1 >>/dev/null 2>&1'");
      system("su - postgres -c '/usr/bin/psql -e horde </tmp/imp.out >>/dev/null 2>&1; rm /tmp/imp.out >>/dev/null 2>&1'");
      system("su - postgres -c '/usr/bin/psql template1 < $MODULE_SCRIPTS_DIR/pgsql_create.sql >>/dev/null 2>&1'");
d273 1
a273 3
	  print "    - Postgres seems to be already configured\n";
          print "      You should get rid of the imp database once you are \n";
          print "      comfortable with the new horde database.\n";
d275 3
a277 20
    } else {
      $db_owner = "postgres";
      $com1 = "/usr/bin/psql -d horde -c '\\dt'";
      $com2 = "su - ";
      $com4 = ' -c "';
      $com3 = '" | grep ';
      if (system("$com2$db_owner$com4$com1$com3$MODULE_TABLE >/dev/null"))
      {
      print "    + Attempting to auto-config PostgreSQL for you...\n";
      print "\n\n";
      print "What is your horde database user password? (Pick one if you don't have one) ";
      $db_pass = command_prompt('Password: ');
      system("su - postgres -c '/usr/bin/psql -c \"$PSQL_QUERY\" template1 >>/dev/null 2>&1'");
      system("su - postgres -c '$MODULE_SCRIPTS_DIR/pgsql_cuser.sh $db_pass >>/dev/null 2>&1'");
      system("su - postgres -c '/usr/bin/psql -c \"$PSQL_QUERY\" template1 >>/dev/null 2>&1'");
      system("su - postgres -c '/usr/bin/psql template1 < $MODULE_SCRIPTS_DIR/pgsql_create.sql' >>/dev/null 2>&1");
      } else {
       print "    - Postgres seems to be already configured\n";
       print "      Ignore any errors about missing imp database\n";
      }
d279 4
d284 7
a290 5
  if ($debian eq 'yes') {
    print "  + Restarting PostgreSql\n";
    system("/etc/init.d/postgresql stop >> /dev/null 2>&1 ; /etc/init.d/postgresql start >> /dev/null 2>&1 ");
  } else {
    print "  + Please Restart PostgreSql\n";
a291 1
 }
d293 1
a293 2
  if ($dbtype eq "mysql") {
    print "    + Attempting to auto-config MySQL for you...\n";
a298 7
    if ($debian eq 'yes') {
      print "  + Restarting MySql\n";
      system("/etc/init.d/mysql restart >> /dev/null 2>&1 ");
    } else {
      print "  + Please Restart MySql\n";
    }
  }
d321 1
a321 1
\$default->localhost                 = 'ruins.tdyc.com';
d338 1
a338 1
\$default->db_type                   = 'pgsql';
d340 1
a340 1
\$default->db_password               = '';
d401 2
a402 1
  $impmgr_passwd='';
d407 1
a441 3



d489 2
a490 1
  $impmgr_passwd='';
d495 1
a504 4
/* Email address to send problem reports */
\$default->problem_email             = 'root\@@localhost'; 
\$default->problem_reporting         = true;

a583 7
/* LDAP/IMAP Server Defaults */
\$default->ldap_choose_server = false;
\$default->LDAP_server        = 'ldap.dom.ain';
\$default->LDAP_dn            = 'o=LDAPOrg,c=US';
\$default->LDAP_search_field  = 'uid';


d596 1
a596 1
\$default->db_name                   = 'horde';
a604 4
/* IMP Account Signup */
\$default->signup_email              = 'root\@@localhost';
\$default->signup                    = false;

d643 1
a644 1
}
d646 5
a650 1
$temp = '0';
a651 1
  if (($module eq 'imp') | ($module eq 'horde') | ($module eq 'skattek')) {
d653 1
d656 6
a661 1
  configure_database();
d676 5
a681 2
  $temp = '1';
}
d683 1
d685 1
a685 8
if ($module eq 'clean') {
  print "\n\n";
  $temp = '1';
}
if ($temp eq '0') {
    print "Usage:  hordesetup modulename \n";
    print "\nModulenames are horde, imp, and skattek currently\n\n";
}
d687 10
a696 3
  if (($module eq 'imp') | ($module eq 'horde') | ($module eq 'skattek')) {
   if ($debian eq 'yes') {
      print "  + Restarting Apache\n";
d698 3
d702 6
a707 17
   } else {
     print "  + Please restart Apache\n";
   }
      
     print "\n\n  *****   NOTE NOTE NOTE ***** \n\n";
     print "The database for postgresql users has moved from imp to horde \n";
     print "and the database user from www-data to hordemgr.  Please make \n";
     print "sure that your defaults.php3 file for horde and imp are set \n";
     print "properly if you are upgrading either.  MySql users will need \n";
     print "to be aware that this will happen to them once the conversion \n";
     print "has been written and tested.   \n\n";
     print "Also, if you have been using horde since prior to pre3-8 plase \n";
     print "make sure you have: \n\n";
     print "       php3_magic_quotes_gpc Off   \n";
     print "\nset in your /etc/apache/access.conf in the HORDE Directory statement\n\n";
     $foo = command_prompt('Press Return');
     print "\n\n";
d711 27
a737 1
exit 0;
@


1.10
log
@[IEM] debian updates ... and

migrating fixes from 2.2 to -dev for signup
@
text
@@


1.9
log
@[IEM] adding in auto locales building piece...moving the buildLang.sh file
into the /etc/horde subdir so that it can be conffile'ized...ie..if the user
doesn't want the default (en), they can change it without worry the next
upgrade will wipe it.
@
text
@d77 4
d100 1
a100 1
   system("if (grep '$APACHE_LINE' $APACHE_PATH/access.conf >/dev/null 2>&1); then (echo '    - HORDE Directory should be o.k.'); else (echo ' ' >> $APACHE_PATH/access.conf && echo '# $APACHE_LINE' >> $APACHE_PATH/access.conf && echo '<Directory $HORDE_DIR>' >> $APACHE_PATH/access.conf && echo 'Options Indexes FollowSymLinks' >> $APACHE_PATH/access.conf && echo 'AllowOverride None' >> $APACHE_PATH/access.conf && echo 'order allow,deny' >> $APACHE_PATH/access.conf && echo 'allow from all' >> $APACHE_PATH/access.conf && echo 'php3_include_path $PHPLIB_DIR:$HORDE_CONFIG_DIR' >> $APACHE_PATH/access.conf && echo 'php3_auto_prepend_file $PREPEND_FILE' >> $APACHE_PATH/access.conf && echo 'php3_magic_quotes_gpc Off' >> $APACHE_PATH/access.conf && echo '</Directory>' >> $APACHE_PATH/access.conf && echo '    + HORDE Directory added.'); fi");
d227 1
a227 1
        $db_pass = command_prompt();
d239 1
a239 1
  system("cd $MODULE_DIR/lib/src && ./build.pl --database=$dbtype >> /dev/null 2>&1");
d241 1
a241 1
  system("cd $MODULE_DIR/locale && $HORDE_CONFIG_DIR/buildLang.sh >>/dev/null 2>&1");
d315 1
d532 1
a532 1
$etc="$IMP_CONF_DIR";
d571 1
d597 2
d603 1
d635 7
d751 14
d766 1
@


1.8
log
@[IEM]

   1> Changed exec command for create_config.pl script from
../../config/modules/create_config.pl to cd ../../config/modules && ./create_config.pl

     since create_config.pl is designed to be run from the config/modules dir
it doesn't quite work right if run from lib/src dir. :)  this is still
not the best solution since it still expects you to start out in the
lib/src dir.

also updated more debian stuff.  Now runs the create_config.pl script after
each module configuration wheter it be horde, imp, or whatever.  Each
module during install copies it's config file into /etc/horde/modules so
that when this script is run it picks it up automatically...(hopefullY)
@
text
@d237 1
@


1.7
log
@[IEM] updating deb stuff for -dev so I can start playing
@
text
@d235 2
a236 1
  system("cd $MODULE_DIR/lib/src && ./build.pl --database=$dbtype >> /dev/null 2>&1");         
d238 1
@


1.6
log
@[IEM] more updates.  New hordesetup script that handles both regular
and -dev packages.  Should technically work for non debian systems as well.
Has a toggle at the top of the file for if it's a debian system or not and
the rest of the information is just pathing...plug in the right paths
at the top and it *should* auto configure everything for you.
@
text
@d5 1
a5 1
local( $HORDE_SETUP_VER )        = '1.5';
d12 1
a12 11

if ($module eq 'horde-dev') {
  $HORDE_CONFIG_DIR = '/etc/horde-dev';
  $HORDE_DIR = '/usr/share/horde-dev';
  $MODULE_SCRIPTS_DIR = '/usr/doc/horde-core-dev/scripts';
  $MODULE_DIR = '/usr/share/horde-dev';
  $MODULE_CONF_DIR = '/etc/horde-dev';
  $PREPEND_FILE = '/etc/horde-dev/prepend.php3';
  $APACHE_LINE = 'Added for HORDE-DEV';
  $MODULE_TABLE = "active_sessions";
} 
a23 10
if ($module eq 'imp-dev') {
  $MODULE_DIR = '/usr/share/horde-dev/imp';
  $MODULE_CONF_DIR = '/etc/imp-dev';
  $MODULE_SCRIPTS_DIR = '/usr/doc/imp-dev/scripts';
  $APACHE_LINE = 'Added for IMP-DEV';
  $HORDE_CONFIG_DIR = '/etc/horde-dev';
  $HORDE_DIR = '/usr/share/horde-dev';
  $PREPEND_FILE = '/etc/horde-dev/prepend.php3';
  $MODULE_TABLE = "imp_pref";
} 
a34 10
if ($module eq 'skattek-dev') {
  $MODULE_CONF_DIR = '/etc/skattek-dev'; 
  $MODULE__DIR = '/usr/share/horde-dev/skattek';
  $MODULE_SCRIPTS_DIR = '/usr/doc/skattek-dev/scripts';
  $HORDE_DIR = '/usr/share/horde-dev';
  $HORDE_CONFIG_DIR = '/etc/horde-dev';
  $APACHE_LINE = 'Added for SKATTEK-DEV';
  $PREPEND_FILE = '/etc/horde-dev/prepend.php3';
  $MODULE_TABLE = "fw_users";
} 
d37 1
a37 1
  $MODULE__DIR = '/usr/share/horde/skattek'; 
d61 1
a61 1
print "\nHORDE Project Configurator - 1.5+ \n" . '-' x 33 . "\n\n";
d94 1
a94 1
if (($module eq 'horde') | ($module eq 'horde-dev')) {
d96 1
a96 1
   system("if (grep '$APACHE_LINE' $APACHE_PATH/access.conf >/dev/null 2>&1); then (echo '    - HORDE Directory should be o.k.'); else (echo ' ' >> $APACHE_PATH/access.conf && echo '# $APACHE_LINE' >> $APACHE_PATH/access.conf && echo '<Directory $HORDE_DIR>' >> $APACHE_PATH/access.conf && echo 'Options Indexes FollowSymLinks' >> $APACHE_PATH/access.conf && echo 'AllowOverride None' >> $APACHE_PATH/access.conf && echo 'order allow,deny' >> $APACHE_PATH/access.conf && echo 'allow from all' >> $APACHE_PATH/access.conf && echo 'php3_include_path $PHPLIB_DIR:$HORDE_CONFIG_DIR' >> $APACHE_PATH/access.conf && echo 'php3_auto_prepend_file $PREPEND_FILE' >> $APACHE_PATH/access.conf && echo '</Directory>' >> $APACHE_PATH/access.conf && echo '    + HORDE Directory added.'); fi");
d98 1
a98 1
if (($module eq 'horde') | ($module eq 'horde-dev') | ($module eq 'imp') | ($module eq 'imp-dev') | ($module eq 'skattek') | ($module eq 'skattek-dev')){
d262 1
d271 1
a271 1
  if (system("$com2$db_owner$com4$com1$com3$MODULE_TABLE >/dev/null"))
d273 42
a314 5
    print "    + Attempting to auto-config PostgreSQL for you...\n";
    system("su - postgres -c '$MODULE_SCRIPTS/pgsql_cuser.sh' >> /dev/null 2>&1");
    system("su - postgres -c '/usr/bin/psql template1 < $MODULE_SCRIPTS/pgsql_create.sql' >> /dev/null 2>&1");
  } else {
    print "    - Postgres seems to be already configured\n";
d316 1
d348 1
a348 1
  $impmgr='www-data';       
d379 1
a379 1
\$default->db_user_name              = 'www-data';
d381 1
a381 1
\$default->db_name                   = 'skattek';
d440 1
a440 1
  $impmgr='www-data';
d467 1
a467 1
\$default->db_name                   = 'imp';
d529 1
a529 1
  $impmgr='www-data';
d635 1
a635 1
\$default->db_name                   = 'imp';
d691 1
a691 1
  if (($module eq 'imp') | ($module eq 'horde') | ($module eq 'skattek') | ($module eq 'imp-dev') | ($module eq 'horde-dev') | ($module eq 'skattek-dev')) {
d700 9
a708 1
    build_$module_defaults();
d724 1
a724 1
  if (($module eq 'imp') | ($module eq 'horde') | ($module eq 'skattek') | ($module eq 'imp-dev') | ($module eq 'horde-dev') | ($module eq 'skattek-dev')) {
d727 2
a728 2
      system("/etc/init.d/apache restart >> /dev/null 2>&1 ");
      system("/etc/init.d/apache-ssl restart >> /dev/null 2>&1 ");
@


1.5
log
@[IEM] more updates.  New hordesetup script that handles both regular
and -dev packages.  Should technically work for non debian systems as well.
Has a toggle at the top of the file for if it's a debian system or not and
the rest of the information is just pathing...plug in the right paths
at the top and it *should* auto configure everything for you.
@
text
@@


1.4
log
@[IEM] wow...I forgot to commt my deb stuff too... :)

    1>  Updated italian locales (sync'ng up from -pre)
    2>  Updates to the debian stuff so that it can pseudo like co-exist
        with current horde install.
@
text
@d5 1
a5 1
local( $HORDE_SETUP_VER )        = '1.3';
d8 2
a10 5
$IMP_DIR = '/usr/share/horde-devel/imp';
$HORDE_DIR = '/usr/share/horde-devel';
$IMP_CONFIG_DIR = '/etc/imp-devel';
$HORDE_CONFIG_DIR = '/etc/horde-devel';
$IMP_SCRIPTS_DIR = '/usr/doc/imp-devel/scripts';
d12 66
a89 2
$OLD_PREPEND_FILE = '/usr/lib/phplib/prepend.php3';
$PREPEND_FILE = '/etc/horde/prepend.php3';
d91 1
a91 1
print "\nHORDE Project Configurator - 1.3+ \n" . '-' x 33 . "\n\n";
d99 3
a101 7
   $values{'include_path'} =~ s/$HORDE_CONFIG_DIR://g;
   $values{'include_path'} =~ s/:$HORDE_CONFIG_DIR//g;
   print "    - Removing prepend.php3 statements.\n";
   $values{'auto_prepend_file'} =~ s/$OLD_PREPEND_FILE://g;
   $values{'auto_prepend_file'} =~ s/:$OLD_PREPEND_FILE//g;
   $values{'auto_prepend_file'} =~ s/$PREPEND_FILE://g;
   $values{'auto_prepend_file'} =~ s/:$PREPEND_FILE//g;
d109 1
a109 1
if (($module eq 'horde') | ($module eq 'imp')) {
a114 25
    getinifile("$i", 'PHP_3', \%values);
    if ($values{'include_path'} =~ /$HORDE_CONFIG_DIR/) {
      print "    - include_path o.k.\n";
    } else {
        $values{'include_path'} = "$values{'include_path'}:" if ($values{'include_path'} ne '');
        $values{'include_path'} .= $HORDE_CONFIG_DIR;
        print "    + HORDE path added to include_path.\n";
        $changed = 1;
    }
	if ($values{'auto_prepend_file'} =~ /$PREPEND_FILE/) {
          print "    - auto_prepend_file list o.k.\n";
        } else {
          $values{'auto_prepend_file'} = "$values{'auto_prepend_file'}:" if ($values{'auto_prepend_file'} ne '');
          $values{'auto_prepend_file'} .= $PREPEND_FILE;
          print "    + added prepend.php3 to auto_prepend_file list.\n";
          $changed = 1;
        }

    if ($changed > 0) {
        setinifile($i, "$i.new", 'PHP_3', %values);
        @@filelist = split(/\n/, `ls -q1 $i*`);
        rename $i, "$i.old";
        rename "$i.new", $i;
    }

a122 1

d124 5
a128 2
if ($module eq 'horde') {

d130 1
a130 5
        system("if (grep 'Added for HORDE-DEVEL' $APACHE_PATH/srm.conf >/dev/null 2>&1); then (echo '    - HORDE-DEVEL Alias should be o.k.'); else (echo '# Added for HORDE-DEVEL' >> $APACHE_PATH/srm.conf && echo 'Alias /horde-devel /usr/share/horde-devel' >> $APACHE_PATH/srm.conf && echo '    + HORDE-DEVEL Alias added.'); fi");
}

if ($module eq 'imp') {
        system("if (grep 'Added for IMP-DEVEL' $APACHE_PATH/srm.conf >/dev/null 2>&1); then (echo '    - IMP-DEVEL Alias should be o.k.'); else (echo '# Added for IMP-DEVEL' >> $APACHE_PATH/srm.conf && echo 'Alias /imp-devel /usr/share/horde-devel/imp' >> $APACHE_PATH/srm.conf && echo '    + IMP-DEVEL Alias added.'); fi ");
d204 24
a227 1
sub build_imp_libs
d231 1
a231 1
  
d236 1
a236 1
  config_title_bar( 'IMP Database Configuration.' );
d238 1
a238 1
  menu_option( '1', 'Mysql');
d241 2
a242 2
  if ( $command eq '0' ) { 
	$dbtype = 'postgres'; 
d244 2
a245 2
  if ( $command eq '1' ) { 
	$dbtype = 'mysql'; 
d248 9
a256 1
  system("echo 'database=$dbtype' >>/etc/horde-devel/build.opts");
d258 6
d265 6
a270 4
  system("cd /usr/share/horde-devel/imp/lib/src && ./build.pl --database=$dbtype >> /dev/null 2>&1");         
  system("chown -R www-data.root /usr/share/horde-devel >> /dev/null 2>&1");
  system("chmod -R 555 /usr/share/horde-devel/imp/lib/*.lib >> /dev/null 2>&1");

d275 1
a275 1
   open(OPTIONS, '/etc/horde-devel/build.opts') || return "";
a288 31
sub build_horde_libs 
{
  local $command;
  $dbtype=check_opts();

  if ($dbtype) {
    print "    - Database previously set to: $dbtype\n";
    if ( $dbtype eq 'postgres' ) {
        system("cp /etc/horde-devel/horde_phplib.inc.pgsql /etc/horde-devel/horde_phplib.inc");
    }
    if ( $dbtype eq 'mysql' ) {
        system("cp /etc/horde-devel/horde_phplib.inc.mysql /etc/horde-devel/horde_phplib.inc");
    }
  } else {
    print "\n\n";
    config_title_bar( 'HORDE Database Configuration.' );
    menu_option( '0', 'Postgresql');
    menu_option( '1', 'Mysql');
    $command = command_prompt();

    if ( $command eq '0' ) { 
	$dbtype = 'postgres'; 
        system("cp /etc/horde-devel/horde_phplib.inc.pgsql /etc/horde-devel/horde_phplib.inc");
	}
    if ( $command eq '1' ) { 
	$dbtype = 'mysql'; 
        system("cp /etc/horde-devel/horde_phplib.inc.pgsql /etc/horde-devel/horde_phplib.inc");
	}
    system("echo 'database=$dbtype' >>/etc/horde-devel/build.opts");
  }

d290 1
a290 10
  system("cd /usr/share/horde-devel/lib/src && ./build.pl >> /dev/null 2>&1");
  system("chown -R www-data.root /usr/share/horde-devel >> /dev/null 2>&1");
  system("chmod -R 555 /usr/share/horde-devel/lib/*.lib >> /dev/null 2>&1");
  system("chmod 000 /usr/share/horde-devel/setup.php3 >> /dev/null 2>&1");
  system("chmod 555 /etc/horde-devel/*.php3 /etc/horde-devel/*.txt /etc/horde-devel/*.html >> /dev/null 2>&1");


}

sub configure_database_imp
a291 1

d299 2
a300 2
  $com3 = '" | grep imp_pref';
  if (system("$com2$db_owner$com4$com1$com3 >/dev/null"))
d303 2
a304 2
    system("su - postgres -c '/usr/doc/imp-devel/scripts/pgsql_cuser.sh' >> /dev/null 2>&1");
    system("su - postgres -c '/usr/bin/psql template1 < /usr/doc/imp-devel/scripts/pgsql_create.sql' >> /dev/null 2>&1");
d308 6
a313 2
  print "  + Restarting PostgreSql\n";
  system("/etc/init.d/postgresql restart >> /dev/null 2>&1 ");
d317 12
a328 4
    print "     + Attempting to auto-config MySQL for you...\n";
    system("/usr/bin/mysql < /usr/doc/imp-devel/scripts/mysql_create.sql >> /dev/null 2>&1");
    print "   + Restarting MySql\n";
    system("/etc/init.d/mysql restart >> /dev/null 2>&1 ");
d332 85
a416 21
sub configure_database_horde
{
  print "  + Database Configuration\n";
 if ($dbtype eq "postgres") {
  print "    + Seeing if the Database needs to be configured...\n";
  $db_owner = "postgres";
  $com1 = "/usr/bin/psql -d imp -c '\\dt'";
  $com2 = "su - ";
  $com4 = ' -c "';
  $com3 = '" | grep active_sessions';
  if (system("$com2$db_owner$com4$com1$com3 >/dev/null"))
  {
    print "    + Attempting to auto-config PostgreSQL for you...\n";
    system("su - postgres -c '/usr/doc/horde-core-devel/scripts/pgsql_cuser.sh' > /dev/null 2>&1");
    system("su - postgres -c '/usr/bin/psql template1 < /usr/doc/horde-core-devel/scripts/pgsql_create.sql' > /dev/null 2>&1");
  } else {
    print "    - Postgres seems to be already configured\n";
  }
  print "  + Restarting PostgreSql\n";
  system("/etc/init.d/postgresql restart >> /dev/null 2>&1 ");
 }
d418 3
a420 6
 if ($dbtype eq "mysql") {
   print "    + Attempting to auto-config MySQL for you...\n";
   system("/usr/bin/mysql < /usr/doc/horde-core-devel/scripts/mysql_create.sql >/dev/null 2>&1");
   print "  + Restarting MySql\n";
   system("/etc/init.d/mysql restart >> /dev/null 2>&1 ");
 }
d423 1
d426 1
a426 1
$etc='/etc/horde-devel';
d444 2
a445 2
\$default->root_url                 = '/horde-devel';
\$default->graphics_url             = '/horde-devel/graphics';
d515 1
a515 1
$etc='/etc/imp-devel';
d556 1
a556 1
\$default->root_url                  = '/imp-devel';
d680 1
d682 6
a687 7

if ($module eq 'horde') {
  build_horde_libs();
   if ($dbtype eq "postgres") { system("cp /etc/horde-devel/prepend.pgsql /etc/horde-devel/prepend.php3 > /dev/null 2>&1"); }
    if ($dbtype eq "mysql") { system("cp /etc/horde-devel/prepend.mysql /etc/horde-devel/prepend.php3 > /dev/null 2>&1"); }
  configure_database_horde();
  if (-s "/etc/horde-devel/defaults.php3") {
d691 1
a691 1
    build_horde_defaults();
d693 4
a696 14
  system("chmod 555 /etc/horde-devel/*.php3 /etc/horde-devel/*.txt /etc/horde-devel/*.html >> /dev/null 2>&1 ");
} else {
  if ($module eq 'imp') { 
    build_imp_libs();
   if ($dbtype eq "postgres") { system("cp /etc/horde-devel/prepend.pgsql /etc/horde-devel/prepend.php3 > /dev/null 2>&1"); }
   if ($dbtype eq "mysql") { system("cp /etc/horde-devel/prepend.mysql /etc/horde-devel/prepend.php3 > /dev/null 2>&1"); }
    configure_database_imp();
  if (-s "/etc/imp-devel/defaults.php3") {
    print "  - Leaving existing defaults.php3 file alone\n";
  } else {
    print "  + Building generic defaults.php3 file.\n";
    build_imp_defaults();
  }
   system("chmod 555 /etc/imp-devel/*.php3 /etc/imp-devel/*.txt /etc/imp-devel/*.html >> /dev/null 2>&1 ");
d698 5
a702 3
  } elsif ($module eq 'clean') {
      print "\n\n";
  } else {
d704 1
a704 2
    print "\nModulenames are horde and imp currently\n\n";
  }
d707 8
a714 4
  if (($module eq 'imp') || ($module eq 'horde')) {
    print "  + Restarting Apache\n";
    system("/etc/init.d/apache restart >> /dev/null 2>&1 ");
    system("/etc/init.d/apache-ssl restart >> /dev/null 2>&1 ");
d716 1
@


1.3
log
@[IEM] wow...I forgot to commt my deb stuff too... :)

    1>  Updated italian locales (sync'ng up from -pre)
    2>  Updates to the debian stuff so that it can pseudo like co-exist
        with current horde install.
@
text
@@


1.2
log
@[IEM] Trying to bring the debian stuff up to speed for the devel tree
so that I can build packages for development purposes.  This is all
currently a mirror of what's in -pre right now.
@
text
@d9 5
a13 5
$IMP_DIR = '/usr/share/horde/imp';
$HORDE_DIR = '/usr/share/horde';
$IMP_CONFIG_DIR = '/etc/imp';
$HORDE_CONFIG_DIR = '/etc/horde';
$IMP_SCRIPTS_DIR = '/usr/doc/imp/scripts';
d96 1
a96 1
        system("if (grep 'Added for HORDE' $APACHE_PATH/srm.conf >/dev/null 2>&1); then (echo '    - HORDE Alias should be o.k.'); else (echo '# Added for HORDE' >> $APACHE_PATH/srm.conf && echo 'Alias /horde /usr/share/horde' >> $APACHE_PATH/srm.conf && echo '    + HORDE Alias added.'); fi");
d100 1
a100 1
        system("if (grep 'Added for IMP' $APACHE_PATH/srm.conf >/dev/null 2>&1); then (echo '    - IMP Alias should be o.k.'); else (echo '# Added for IMP' >> $APACHE_PATH/srm.conf && echo 'Alias /imp /usr/share/horde/imp' >> $APACHE_PATH/srm.conf && echo '    + IMP Alias added.'); fi ");
d195 1
a195 1
  system("echo 'database=$dbtype' >>/etc/horde/build.opts");
d198 3
a200 3
  system("cd /usr/share/horde/imp/lib/src && ./build.pl --database=$dbtype >> /dev/null 2>&1");         
  system("chown -R www-data.root /usr/share/horde >> /dev/null 2>&1");
  system("chmod -R 555 /usr/share/horde/imp/lib/*.lib >> /dev/null 2>&1");
d206 1
a206 1
   open(OPTIONS, '/etc/horde/build.opts') || return "";
d228 1
a228 1
        system("cp /etc/horde/horde_phplib.inc.pgsql /etc/horde/horde_phplib.inc");
d231 1
a231 1
        system("cp /etc/horde/horde_phplib.inc.mysql /etc/horde/horde_phplib.inc");
d242 1
a242 1
        system("cp /etc/horde/horde_phplib.inc.pgsql /etc/horde/horde_phplib.inc");
d246 1
a246 1
        system("cp /etc/horde/horde_phplib.inc.pgsql /etc/horde/horde_phplib.inc");
d248 1
a248 1
    system("echo 'database=$dbtype' >>/etc/horde/build.opts");
d252 5
a256 5
  system("cd /usr/share/horde/lib/src && ./build.pl >> /dev/null 2>&1");
  system("chown -R www-data.root /usr/share/horde >> /dev/null 2>&1");
  system("chmod -R 555 /usr/share/horde/lib/*.lib >> /dev/null 2>&1");
  system("chmod 000 /usr/share/horde/setup.php3 >> /dev/null 2>&1");
  system("chmod 555 /etc/horde/*.php3 /etc/horde/*.txt /etc/horde/*.html >> /dev/null 2>&1");
d275 2
a276 2
    system("su - postgres -c '/usr/doc/imp/scripts/pgsql_cuser.sh' >> /dev/null 2>&1");
    system("su - postgres -c '/usr/bin/psql template1 < /usr/doc/imp/scripts/pgsql_create.sql' >> /dev/null 2>&1");
d286 1
a286 1
    system("/usr/bin/mysql < /usr/doc/imp/scripts/mysql_create.sql >> /dev/null 2>&1");
d305 2
a306 2
    system("su - postgres -c '/usr/doc/horde-core/scripts/pgsql_cuser.sh' > /dev/null 2>&1");
    system("su - postgres -c '/usr/bin/psql template1 < /usr/doc/horde-core/scripts/pgsql_create.sql' > /dev/null 2>&1");
d316 1
a316 1
   system("/usr/bin/mysql < /usr/doc/horde-core/scripts/mysql_create.sql >/dev/null 2>&1");
d324 1
a324 1
$etc='/etc/horde';
d342 2
a343 2
\$default->root_url                 = '/horde';
\$default->graphics_url             = '/horde/graphics';
d413 1
a413 1
$etc='/etc/imp';
d454 1
a454 1
\$default->root_url                  = '/imp';
d582 2
a583 2
   if ($dbtype eq "postgres") { system("cp /etc/horde/prepend.pgsql /etc/horde/prepend.php3 > /dev/null 2>&1"); }
    if ($dbtype eq "mysql") { system("cp /etc/horde/prepend.mysql /etc/horde/prepend.php3 > /dev/null 2>&1"); }
d585 1
a585 1
  if (-s "/etc/horde/defaults.php3") {
d591 1
a591 1
  system("chmod 555 /etc/horde/*.php3 /etc/horde/*.txt /etc/horde/*.html >> /dev/null 2>&1 ");
d595 2
a596 2
   if ($dbtype eq "postgres") { system("cp /etc/horde/prepend.pgsql /etc/horde/prepend.php3 > /dev/null 2>&1"); }
   if ($dbtype eq "mysql") { system("cp /etc/horde/prepend.mysql /etc/horde/prepend.php3 > /dev/null 2>&1"); }
d598 1
a598 1
  if (-s "/etc/imp/defaults.php3") {
d604 1
a604 1
   system("chmod 555 /etc/imp/*.php3 /etc/imp/*.txt /etc/imp/*.html >> /dev/null 2>&1 ");
@


1.1
log
@file hordesetup was initially added on branch STABLE_1_2.
@
text
@d1 619
@


1.1.2.1
log
@[IEM] More updates and new stuff for debian packaging

     1>  New hordesetup script.  This script will be the core for building
anything horde related.  All module info stuff will be in there..currently
horde and imp.  Passing a module name to the setup script will cause
it to do all the configuration stuff for that module on a debian system.
Currently it handles configuring of the database, asking the user what
type of database they want if it doesn't know already (/etc/horde/build.opts),
verifying that php3 has teh proper modules loaded, verifying Alias settings
in apache.  It still needs 2 other things which I'll get to today. Apache
restart (just remembered that) and some small phplib tweaks to work with
the package in it's current state.

     2> updated changelog to reflect changes
     3> updated control to reflect new phplib package
     4> modified rules and postinst to take care of new hordesetup script
@
text
@a0 288
#!/usr/bin/perl
# Parts stolen from the phplibconfig scripts
# Hacked up by Ivan E. Moore II <rkrusty@@debian.org>
#
local( $HORDE_SETUP_VER )        = '1.2';
local $dbtype;
local $module = $ARGV[0];
$PHPLIB_DIR = '/usr/lib/phplib';
$IMP_DIR = '/usr/share/horde/imp';
$HORDE_DIR = '/usr/share/horde';
$IMP_CONFIG_DIR = '/etc/imp';
$HORDE_CONFIG_DIR = '/etc/horde';
$IMP_SCRIPTS_DIR = '/usr/doc/imp/scripts';
$PHPINI_PATH = '/etc/php3';
$APACHE_PATH = '/etc/apache';

print "\nHORDE Project Configurator - 1.2+ \n" . '-' x 33 . "\n\n";

if (($module eq 'horde') | ($module eq 'imp')) {

print "* Verify PHP3 configuration files\n";
foreach $i (split(/\n/, `find $PHPINI_PATH -name "*.ini" -print`)) {
    print "  + $i\n";
    $changed = 0;
    getinifile("$i", 'PHP_3', \%values);
    if ($values{'include_path'} =~ /$PHPLIB_DIR/) {
        if ($ARGV[0] ne '/clean') {
            print "    - include_path o.k.\n";
        } else {
            print "    + Removing PHPLib include path.\n";
            $values{'include_path'} =~ s/$PHPLIB_DIR://g;
            $values{'include_path'} =~ s/:$PHPLIB_DIR//g;
            $changed = 1;
        }
    } elsif ($ARGV[0] ne '/clean') {
        $values{'include_path'} = "$values{'include_path'}:" if ($values{'include_path'} ne '');
        $values{'include_path'} .= $PHPLIB_DIR;
        print "    + PHPLib path added to include_path.\n";
        $changed = 1;
    }
    if ($ARGV[0] ne '/clean') {
        if ($values{'magic_quotes_gpc'} =~ /on/i) {
            print "    - magic_quotes_gpc o.k.\n";
        } else {
            $values{'magic_quotes_gpc'} = 'On';
            print "    + magic_quotes_gpc changed to ON.\n";
            $changed = 1;
        }
	if ($values{'auto_prepend_file'} =~ '/usr/lib/phplib/phplibprepend.php3') {
          print "    - auto_prepend_file list o.k.\n";
        } else {
          $values{'auto_prepend_file'} = '/usr/lib/phplib/phplibprepend.php3';
          print "    + added phplibprepend.php3 to auto_prepend_file list.\n";
          $changed = 1;
        }
    if ($changed > 0) {
        setinifile($i, "$i.new", 'PHP_3', %values);
        @@filelist = split(/\n/, `ls -q1 $i*`);
        rename $i, "$i.phplibconfig.$#filelist";
        rename "$i.new", $i;
    }

        system("if (grep imap.so $i >/dev/null 2>&1); then (echo '    - imap extension o.k.'); else (echo 'extension=imap.so' >> $i && echo '    + imap extension added.'); fi ");
        system("if (grep ldap.so $i >/dev/null 2>&1); then (echo '    - ldap extension o.k.'); else (echo 'extension=ldap.so' >> $i && echo '    + ldap extension added.'); fi ");
        system("if (grep pgsql.so $i >/dev/null 2>&1); then (echo '    - pgsql extension o.k.'); else (echo 'extension=pgsql.so' >> $i && echo '    + pgsql extension added.'); fi ");
        system("if (grep mysql.so $i >/dev/null 2>&1); then (echo '    - mysql extension o.k.'); else (echo 'extension=mysql.so' >> $i && echo '    + mysql extension added.'); fi ");


    }

}
if ($module eq 'horde') {
    print "  + /etc/apache/srm.conf\n";
        system("if (grep 'Added for HORDE' /etc/apache/srm.conf >/dev/null 2>&1); then (echo '    - HORDE Alias should be o.k.'); else (echo '# Added for HORDE' >> /etc/apache/srm.conf && echo 'Alias /horde /usr/share/horde' >> /etc/apache/srm.conf && echo '    + HORDE Alias added.'); fi ");
}
if ($module eq 'imp') {
        system("if (grep 'Added for IMP' /etc/apache/srm.conf >/dev/null 2>&1); then (echo '    - IMP Alias should be o.k.'); else (echo '# Added for IMP' >> /etc/apache/srm.conf && echo 'Alias /imp /usr/share/horde/imp' >> /etc/apache/srm.conf && echo '    + IMP Alias added.'); fi ");
}

}

sub getinifile
{
    my ($filename, $section, $values) = @@_;
    my $found = 0;

    undef %$values;
    open(FILE, "< $filename");
    while(<FILE>) {
        if ($section ne '' and $found == 0) {
            $found = 1 if (/^\[$section\].*/);
            next;
        }
        next if ($found == 0);
        $values->{$1} = $2 if (/^\s*([\w-_]+)\s*=\s*(.*?)\s*(;.+)*$/);
    }
    close(FILE);
}

sub setinifile
{
    my ($infile, $outfile, $section, %newvalues) = @@_;
    my $found = $section eq '' ? 1 : 0;

    open(INFILE, "< $infile");
    open(OUTFILE, "> $outfile");
    while(<INFILE>) {
        if ($found == 0) {
            $found = 1 if (/^\[$section\].*/);
        }
        if ($found > 0 and /^\s*([\w-_]+)\s*=\s*(.*?)\s*(;.+)*$/ and $newvalues{$1} ne "$2") {
            print OUTFILE "$1 = $newvalues{$1} $3\n";
        }
        else {     
            print OUTFILE $_;
        }
    }
    close(OUTFILE);
    close(INFILE);
}

sub command_prompt {                     
   local $prompt        = shift;
   local $command;
   if ( ! $prompt ) {      
         print "\n\n" . 'Command : ';
   } else {                  
         print "\n\n" . $prompt;
   }
   $command = <STDIN>;
   $command =~ s/\n//g;
   $command =~ s/\r//g;
   return $command;
}

sub clear_screen() { system( "clear" ); }

sub config_title_bar {
   local $sub_menu = shift;
   print 'HORDE Setup - Version : ' . $HORDE_SETUP_VER . ' Configuration Menu.' . "\n";
   if ( $sub_menu ) { print $sub_menu . "\n"; }
   print '-' x 50 . "\n\n";
}

sub menu_option {                
   local $opt_num       = shift;
   local $text          = shift;
   print ' ' . $opt_num . ') ' . $text . "\n";
}

sub build_imp_libs
{
  local $command;
  $dbtype=check_opts();
  
  if ($dbtype) {
    print "    - Database previously set to: $dbtype\n";
  } else {
  print "\n\n";
  config_title_bar( 'IMP Database Configuration.' );
  menu_option( '0', 'Postgresql');
  menu_option( '1', 'Mysql');
  $command = command_prompt();

  if ( $command eq '0' ) { $dbtype = 'postgres'; }
  if ( $command eq '1' ) { $dbtype = 'mysql'; }

  system("echo 'database=$dbtype' >>/etc/horde/build.opts");
  }

  system("cd /usr/share/horde/imp/lib/src && ./build.pl --database=$dbtype >> /dev/null 2>&1");         
  system("chown -R www-data.root /usr/share/horde >> /dev/null 2>&1");
  system("chmod -R 555 /usr/share/horde/imp/lib/*.lib >> /dev/null 2>&1");
  system("chmod 555 /etc/imp/*.php3 /etc/imp/*.txt /etc/imp/*.html >> /dev/null 2>&1 ");
}

sub check_opts
{
   open(OPTIONS, '/etc/horde/build.opts') || return "";

   while(<OPTIONS>) {
     chomp();
     ($Option_Name, $Option_Value) = split('=', $_);
     $Options{$Option_Name} = $Option_Value;
    }
    close(OPTIONS);
    if(exists($Options{"database"})) { $db = $Options{"database"}; }
    else { $db = ""; }

return $db;
}

sub build_horde_libs 
{
  local $command;
  $dbtype=check_opts();

  if ($dbtype) {
    print "    - Database previously set to: $dbtype\n";
  } else {
    print "    - No horde database specific yet...\n";
  }

  system("cd /usr/share/horde/lib/src && ./build.pl >> /dev/null 2>&1");
  system("chown -R www-data.root /usr/share/horde >> /dev/null 2>&1");
  system("chmod -R 555 /usr/share/horde/lib/*.lib >> /dev/null 2>&1");
  system("chmod 000 /usr/share/horde/setup.php3 >> /dev/null 2>&1");
  system("chmod 555 /etc/horde/*.php3 /etc/horde/*.txt /etc/horde/*.html >> /dev/null 2>&1");


}

sub configure_database_imp
{

  print "  + Database Configuration\n";
 if ($dbtype eq "postgres") {
  print "    + Seeing if the Database needs to be configured...\n";
  $db_owner = "postgres";
  $com1 = "/usr/bin/psql -d imp -c '\\dt'";
  $com2 = "su - ";
  $com4 = ' -c "';
  $com3 = '" | grep imp_pref';
  if (system("$com2$db_owner$com4$com1$com3 >/dev/null"))
  {
    print "    + Attempting to auto-config PostgreSQL for you...\n";
    system("su - postgres -c '/usr/doc/imp/scripts/pgsql_cuser.sh' >> /dev/null 2>&1");
    system("su - postgres -c '/usr/bin/psql template1 < /usr/doc/imp/scripts/pgsql_create.sql' >> /dev/null 2>&1");
  } else {
    print "    - Postgres seems to be already configured\n";
  }
  print "  + Restarting PostgreSql\n";
  system("/etc/init.d/postgresql restart >> /dev/null 2>&1 ");
 }

  if ($dbtype eq "mysql") {
    print "     + Attempting to auto-config MySQL for you...\n";
    system("/usr/bin/mysql < /usr/doc/imp/scripts/mysql_create.sql >> /dev/null 2>&1");
    print "   + Restarting MySql\n";
    system("/etc/init.d/mysql restart >> /dev/null 2>&1 ");
  }
}

sub configure_database_horde
{
  print "  + Database Configuration\n";
 if ($dbtype eq "postgres") {
  print "    + Seeing if the Database needs to be configured...\n";
  $db_owner = "postgres";
  $com1 = "/usr/bin/psql -d horde -c '\\dt'";
  $com2 = "su - ";
  $com4 = ' -c "';
  $com3 = '" | grep horde_pref';
  if (system("$com2$db_owner$com4$com1$com3 >/dev/null"))
  {
    print "    + Attempting to auto-config PostgreSQL for you...\n";
    system("su - postgres -c '/usr/doc/horde-core/scripts/pgsql_cuser.sh' > /dev/null 2>&1");
    system("su - postgres -c '/usr/bin/psql template1 < /usr/doc/horde-core/scripts/pgsql_create.sql' > /dev/null 2>&1");
  } else {
    print "    - Postgres seems to be already configured\n";
  }
  print "  + Restarting PostgreSql\n";
  system("/etc/init.d/postgresql restart >> /dev/null 2>&1 ");
 }

 if ($dbtype eq "mysql") {
   print "    + Attempting to auto-config MySQL for you...\n";
   system("/usr/bin/mysql < /usr/doc/horde-core/scripts/mysql_create.sql >/dev/null 2>&1");
   print "  + Restarting MySql\n";
   system("/etc/init.d/mysql restart >> /dev/null 2>&1 ");
 }
}


if ($module eq 'horde') {
  build_horde_libs();
  configure_database_horde();
} else {
  if ($module eq 'imp') { 
    build_imp_libs();
    configure_database_imp();
  } else {
    print "Usage:  hordesetup modulename \n";
    print "\nModulenames are horde and imp currently\n\n";
  }
}

exit 0;
@


1.1.2.2
log
@[IEM] added apache restart and a undocumented man page to follow policy
@
text
@a287 3
  print "  + Restarting Apache\n";
  system("/etc/init.d/apache restart >> /dev/null 2>&1 ");

@


1.1.2.3
log
@[IEM] (crossing fingers) Horde should configure out of the .deb 100%, IMP
should once I update the post scripts.   stressing *should* :)

    1> Updated hordesetup script to handle building of a defaults.php3 file
for horde and imp if they don't exist.
    2> Replacing db_pgsql.inc file in phplib since it's missing a line and
I'm too lazy to do a add piece...it'll give fixed soon and I won't have to do
this.
    3> Adding in a custom prepend.php3 file.  Ack..I just remember I forgot
something...argg...oh well...I'll be back
@
text
@d49 1
a49 1
	if ($values{'auto_prepend_file'} =~ '/usr/lib/phplib/prepend.php3') {
d52 2
a53 2
          $values{'auto_prepend_file'} = '/usr/lib/phplib/prepend.php3';
          print "    + added prepend.php3 to auto_prepend_file list.\n";
d174 1
a174 1

a273 257
sub build_horde_defaults
{
$etc='/etc/horde';
$syshostname=`hostname --fqdn`;    
chop($syshostname=`hostname --fqdn`);

if ($dbtype eq 'postgres') {
  $impmgr='www-data';
  $impmgr_passwd='';
}
if ($dbtype eq 'mysql') {
  $impmgr='impmgr';
  $impmgr_passwd='impmgr';
}


    &setfile('defaults.php3',
'<?php',
"

\$default->root_url                 = '/horde';
\$default->graphics_url             = '/horde/graphics';
\$default->faq_url                  = 'http://faq.horde.org/';
\$default->horde_include_dir        = './templates';

/* Path to sendmail */
\$default->path_to_sendmail         = '/usr/sbin/sendmail';

\$default->cache_pages              = true;

/* database config */
\$default->use_db                    = true;
\$default->db_user_name              = '$impmgr';       
\$default->db_password               = '$impmgr_password';
\$default->db_name                   = 'horde';
\$default->db_server_name            = 'localhost';
\$default->db_signup_table           = 'horde_signup';
\$default->db_pref_table             = 'horde_pref';
\$default->db_connect_string         = '';
\$default->db_server_port            = '';
\$default->db_server_options         = '';
\$default->db_server_tty             = '';

?>
");    





sub setfileshort {
    local ($filename,$value) = @@_;
    push(@@files,$filename);
    $filecontents{$filename}= $value;
}

sub setfile {
    local ($filename,$value1,$value2,$d) = @@_;
    chop($d=`date`);
    $v=
"$value1\
$value2";
    push(@@files,$filename);
    $filecontents{$filename}=$v;
}

sub reswarn {
    print STDERR "$_[0]\n";
    return 0;
}

for $f (@@files) {
    open(N,">$etc/$f.postinstnew") || die "Error creating $etc/$f.postinstnew: $!\n";
    print(N $filecontents{$f}) || die "Error writing $etc/$f.postinstnew: $!\n";
    close(N) || die "Error closing $etc/$f.postinstnew: $!\n";
}

while (defined($f= pop(@@files))) {
    rename("$etc/$f.postinstnew","$etc/$f") || die "Error installing $etc/$f: $!\n";
}


while (defined($f= pop(@@files))) {
    rename("$etc/$f.postinstnew","$etc/$f") || die "Error installing $etc/$f: $!
\n";
}

}

sub build_imp_defaults
{
$etc='/etc/imp';
$syshostname=`hostname --fqdn`;    
chop($syshostname=`hostname --fqdn`);

if ($dbtype eq 'postgres') {
  $impmgr='www-data';
  $impmgr_passwd='';
}
if ($dbtype eq 'mysql') {
  $impmgr='impmgr';
  $impmgr_passwd='impmgr';
}

    &setfile('defaults.php3',
'<?php',
"

/* the session file (dbm file) */
\$default->session_file = './lib/sessions';

/* Email address to send problem reports */
\$default->problem_email             = 'root\@@localhost'; 
\$default->problem_reporting         = true;

/* For debugging purposes */
\$default->error_level               = 15;

/* The longest that things like file uploads and slow functions should be
 * allowed to run. 0 means run until termination (forever if infinite loop).
 * NOTE: you can't set this to 0 if safe_mode is on. */
\$default->max_execution_time        = 0;

/* Server Specific Configuration */
\$default->localhost                 = '$syshostname';

/* Imap Server Default */
\$default->server                    = '$syshostname';
\$default->from_server               = '$syshostname';
\$default->port                      = 143;

/* Web server configuration */
\$default->root_url                  = '/imp';
\$default->include_dir               = './templates';
\$default->graphics_url              = \$default->root_url . '/graphics';

/* Folder configuration */
\$default->folders                   = '';
\$default->use_imap_subscribe        = true;
\$default->show_dotfiles             = false;
\$default->sent_mail                 = 'sent-mail';
\$default->save_sent_mail            = true;
\$default->postponed                 = 'postponed-msgs';

/* Allow caching of the pages */
\$default->cache_pages               = false;

/* Ldap searching */
\$default->use_ldap_search           = true;

/* user is presented with an list of available imap servers */
\$default->use_server_list           = false;

/* User changable items */
\$default->user_change_server        = true;
\$default->user_change_folder        = true;
\$default->user_change_from          = true;
\$default->user_change_fullname      = true;
\$default->user_use_addressbook      = true;

/* New mail configuration */
/* Refresh between check for new mail */
\$default->refresh_delay                  = 300;
\$default->newmail_popup                  = true;

/* Cookie configuration */
\$default->session_enabled           = false;
\$default->session_timeout           = 300;
\$default->cookie_timeout            = 10000;

/* Path to sendmail */
\$default->path_to_sendmail          = '/usr/sbin/sendmail';

/* Ispell setup */
\$default->path_to_ispell            = '/usr/bin/ispell';

/* Mswordview setup */
\$default->path_to_mswordview        = '/usr/bin/mswordview -c';

/* path to tar so that tarballs can be listed */
\$default->path_to_tar               = '/bin/tar';

/* SSL Configuration block */
\$default->secure                    = true;

/* Cyrus configuration block */
\$default->personal_folders          = '';
// cyrus configs may look like this:
// \$default->personal_folders       = 'INBOX.';

/* Default Language */
\$default->language                  = 'en';

\$default->append_header             = true;
\$default->append_trailer            = true;

\$default->text_parts_inline         = true;

/* database config */
\$default->use_db                    = true;
\$default->db_user_name              = '$impmgr';
\$default->db_password               = '$impmgr_passwd';
\$default->db_name                   = 'imp';
\$default->db_server_name            = 'localhost';
\$default->db_pref_table             = 'imp_pref';
\$default->db_address_table          = 'imp_addr';
\$default->db_connect_string         = '';
\$default->db_server_port            = '';
\$default->db_server_options         = '';
\$default->db_server_tty             = '';

/* IMP Account Signup */
\$default->signup_email              = 'root\@@localhost';
\$default->signup                    = false;

?>
");    

sub setfileshort {
    local ($filename,$value) = @@_;
    push(@@files,$filename);
    $filecontents{$filename}= $value;
}

sub setfile {
    local ($filename,$value1,$value2,$d) = @@_;
    chop($d=`date`);
    $v=
"$value1\
$value2";
    push(@@files,$filename);
    $filecontents{$filename}=$v;
}

sub reswarn {
    print STDERR "$_[0]\n";
    return 0;
}
for $f (@@files) {
    open(N,">$etc/$f.postinstnew") || die "Error creating $etc/$f.postinstnew: $!\n";
    print(N $filecontents{$f}) || die "Error writing $etc/$f.postinstnew: $!\n";
    close(N) || die "Error closing $etc/$f.postinstnew: $!\n";
}

while (defined($f= pop(@@files))) {
    rename("$etc/$f.postinstnew","$etc/$f") || die "Error installing $etc/$f: $!\n";
}


while (defined($f= pop(@@files))) {
    rename("$etc/$f.postinstnew","$etc/$f") || die "Error installing $etc/$f: $!\n";
}


}


a277 7
  if (-s "/etc/horde/defaults.php3") {
    print "  - Leaving existing defaults.php3 file alone\n";
  } else {
    print "  + Building generic defaults.php3 file.\n";
    build_horde_defaults();
  }
  system("chmod 555 /etc/horde/*.php3 /etc/horde/*.txt /etc/horde/*.html >> /dev/null 2>&1 ");
a281 8
  if (-s "/etc/imp/defaults.php3") {
    print "  - Leaving existing defaults.php3 file alone\n";
  } else {
    print "  + Building generic defaults.php3 file.\n";
    build_imp_defaults();
  }
   system("chmod 555 /etc/imp/*.php3 /etc/imp/*.txt /etc/imp/*.html >> /dev/null 2>&1 ");

d288 3
a290 4
  if (($module eq 'imp') || ($module eq 'horde')) {
    print "  + Restarting Apache\n";
    system("/etc/init.d/apache restart >> /dev/null 2>&1 ");
  }
@


1.1.2.4
log
@[IEM] ok..fixed...no there's a prepend file for mysql and pgsql...and during
setup it will place the correct one in place.  I'll build a better way
to deal with this later.
@
text
@a157 2
    if ($dbtype eq "postgres") { system("cp /usr/lib/phplib/prepend.pgsql /usr/lib/phplib/prepend > /dev/null 2>&1"); }
    if ($dbtype eq "mysql") { system("cp /usr/lib/phplib/prepend.mysql /usr/lib/phplib/prepend > /dev/null 2>&1"); }
@


1.1.2.5
log
@[IEM] fixed broken preinst script (:))
umm...individual local.inc's for now..removed unneeded db_pgsql.inc script
since I can add the missing Port variable into the local file and it's happy
@
text
@d158 2
a201 1

a535 2
   if ($dbtype eq "postgres") { system("cp /usr/lib/phplib/prepend.pgsql /usr/lib/phplib/prepend.php3> /dev/null 2>&1"); }
    if ($dbtype eq "mysql") { system("cp /usr/lib/phplib/prepend.mysql /usr/lib/phplib/prepend.php3 > /dev/null 2>&1"); }
a546 2
   if ($dbtype eq "postgres") { system("cp /usr/lib/phplib/prepend.pgsql /usr/li/phplib/prepend.php3> /dev/null 2>&1 && cp /usr/lib/phplib/local.pgsql /usr/lib/phplib/local.inc"); }
   if ($dbtype eq "mysql") { system("cp /usr/lib/phplib/prepend.mysql /usr/lib/phplib/prepend.php3 > /dev/null 2>&1 && cp /usr/lib/phplib/local.mysql /usr/lib/phplib/local.inc"); }
@


1.1.2.6
log
@[IEM} one minor buglet fixed (in local.inc manipulatioN)
@
text
@d535 1
a535 4
   if ($dbtype eq "postgres") { system("cp /usr/lib/phplib/prepend.pgsql /usr/lib/phplib/prepend.php3 > /dev/null 2>&1"); }
    if ($dbtype eq "postgres") { system("cp /usr/lib/phplib/local.pgsql /usr/lib/phplib/local.inc > /dev/null 2>&1"); }
    if ($dbtype eq "mysql") { system("cp /usr/lib/phplib/local.mysql /usr/lib/phplib/local.inc > /dev/null 2>&1"); }

d548 2
a549 4
   if ($dbtype eq "postgres") { system("cp /usr/lib/phplib/prepend.pgsql /usr/li/phplib/prepend.php3 > /dev/null 2>&1"); }
    if ($dbtype eq "postgres") { system("cp /usr/lib/phplib/local.pgsql /usr/lib/phplib/local.inc > /dev/null 2>&1"); }
   if ($dbtype eq "mysql") { system("cp /usr/lib/phplib/prepend.mysql /usr/lib/phplib/prepend.php3 > /dev/null 2>&1"); }
    if ($dbtype eq "mysql") { system("cp /usr/lib/phplib/local.mysql /usr/lib/phplib/local.inc > /dev/null 2>&1"); }
@


1.1.2.7
log
@[IEM] getting rid of the imp database and moving to a single horde db
@
text
@d221 1
a221 1
  $com1 = "/usr/bin/psql -d horde -c '\\dt'";
d254 1
a254 1
  $com3 = '" | grep active_sessions';
@


1.1.2.8
log
@[IEM] changing to imp instead of horde for db name.  imp is existing and
I can't find information on how to copy existing records from one db to
another without losing data
@
text
@d221 1
a221 1
  $com1 = "/usr/bin/psql -d imp -c '\\dt'";
d251 1
a251 1
  $com1 = "/usr/bin/psql -d imp -c '\\dt'";
d309 1
a309 1
\$default->db_name                   = 'imp';
@


1.1.2.9
log
@[IEM] Moving all horde related phplib stuff into /etc/horde so as to
not conflict with any other phplib related packages.  Adding in a
remove script to *hopefully* cleanup phplib related items during a remove
@
text
@d5 1
a5 1
local( $HORDE_SETUP_VER )        = '1.3';
a15 2
$OLD_PREPEND_FILE = '/usr/lib/phplib/prepend.php3';
$PREPEND_FILE = '/etc/horde/prepend.php3';
a18 20
if ($module eq 'clean') {

 foreach $i (split(/\n/, `find $PHPINI_PATH -name "*.ini" -print`)) {
   print "  + $i\n";
   $changed = 0;
   getinifile("$i", 'PHP_3', \%values);
   print "    - Removing HORDE include path.\n";
   $values{'include_path'} =~ s/$HORDE_CONFIG_DIR://g;
   $values{'include_path'} =~ s/:$HORDE_CONFIG_DIR//g;
   print "    - Removing prepend.php3 statements.\n";
   $values{'auto_prepend_file'} =~ s/$PREPEND_FILE://g;
   $values{'auto_prepend_file'} =~ s/:$PREPEND_FILE//g;
   $changed = 1;
   setinifile($i, "$i.new", 'PHP_3', %values);
   @@filelist = split(/\n/, `ls -q1 $i*`);
   rename $i, "$i.phplibconfig.$#filelist";
   rename "$i.new", $i;
 }
}

d26 10
a35 3
    if ($values{'include_path'} =~ /$HORDE_CONFIG_DIR/) {
      print "    - include_path o.k.\n";
    } else {
d37 2
a38 2
        $values{'include_path'} .= $HORDE_CONFIG_DIR;
        print "    + HORDE path added to include_path.\n";
d41 1
d49 1
a49 1
	if ($values{'auto_prepend_file'} =~ /$PREPEND_FILE/) {
d52 1
a52 2
          $values{'auto_prepend_file'} = "$values{'auto_prepend_file'}:" if ($values{'auto_prepend_file'} ne '');
          $values{'auto_prepend_file'} .= $PREPEND_FILE;
a55 5
          $values{'auto_prepend_file'} =~ s/$OLD_PREPEND_FILE://g;
          $values{'auto_prepend_file'} =~ s/:$OLD_PREPEND_FILE//g;
          $changed = 1;


d69 1
d535 3
a537 3
   if ($dbtype eq "postgres") { system("cp /etc/horde/prepend.pgsql /etc/horde/prepend.php3 > /dev/null 2>&1"); }
    if ($dbtype eq "postgres") { system("cp /etc/horde/local.pgsql /etc/horde/horde.local.inc > /dev/null 2>&1"); }
    if ($dbtype eq "mysql") { system("cp /etc/horde/local.mysql /etc/horde/horde.local.inc > /dev/null 2>&1"); }
d539 1
a539 1
    if ($dbtype eq "mysql") { system("cp /etc/horde/prepend.mysql /etc/horde/prepend.php3 > /dev/null 2>&1"); }
d551 4
a554 4
   if ($dbtype eq "postgres") { system("cp /etc/horde/prepend.pgsql /etc/horde/prepend.php3 > /dev/null 2>&1"); }
    if ($dbtype eq "postgres") { system("cp /etc/horde/local.pgsql /etc/horde/horde.local.inc > /dev/null 2>&1"); }
   if ($dbtype eq "mysql") { system("cp /etc/horde/prepend.mysql /etc/horde/prepend.php3 > /dev/null 2>&1"); }
    if ($dbtype eq "mysql") { system("cp /etc/horde/local.mysql /etc/horde/horde.local.inc > /dev/null 2>&1"); }
a563 2
  } elsif ($module eq 'clean') {
      print "\n\n";
@


1.1.2.10
log
@[IEM] Fixing build issue with mysql.  Adding in a links file for symlinking
the config dir from /etc/horde to horde/config.  Adding in support for
other web servers besides stock apache.
@
text
@d15 1
a15 12
$have_apache='no';
if (-d '/etc/apache-ssl') {
  $APACHE_PATH = '/etc/apache-ssl';
  $have_apache='yes';
} else {
  if (-d '/etc/apache') {
    $APACHE_PATH = '/etc/apache';
    $have_apache='yes';
  } else {
    $have_apache='no';
  }
}
d19 1
a19 1
print "\nHORDE Project Configurator - 1.3+ \n" . '-' x 33 . "\n\n";
d25 1
a30 2
   $values{'auto_prepend_file'} =~ s/$OLD_PREPEND_FILE://g;
   $values{'auto_prepend_file'} =~ s/:$OLD_PREPEND_FILE//g;
d33 1
d56 7
d71 4
d83 4
a86 4
        system("if (grep 'extension=imap.so' /etc/php3/apache/php3.ini >/dev/null 2>&1); then (echo '    - imap extension o.k.'); else (echo 'extension=imap.so' >> /etc/php3/apache/php3.ini && echo '    + imap extension added.'); fi ");
        system("if (grep 'extension=ldap.so' /etc/php3/apache/php3.ini >/dev/null 2>&1); then (echo '    - ldap extension o.k.'); else (echo 'extension=ldap.so' >> /etc/php3/apache/php3.ini && echo '    + ldap extension added.'); fi ");
        system("if (grep 'extension=pgsql.so' /etc/php3/apache/php3.ini >/dev/null 2>&1); then (echo '    - pgsql extension o.k.'); else (echo 'extension=pgsql.so' >> /etc/php3/apache/php3.ini && echo '    + pgsql extension added.'); fi ");
        system("if (grep 'extension=mysql.so' /etc/php3/apache/php3.ini >/dev/null 2>&1); then (echo '    - mysql extension o.k.'); else (echo 'extension=mysql.so' >> /etc/php3/apache/php3.ini && echo '    + mysql extension added.'); fi ");
a87 2
  }
}
d90 1
a90 1
if ($have_apache eq 'yes') {
d92 2
a93 3

    print "  + $APACHE_PATH/srm.conf\n";
        system("if (grep 'Added for HORDE' $APACHE_PATH/srm.conf >/dev/null 2>&1); then (echo '    - HORDE Alias should be o.k.'); else (echo '# Added for HORDE' >> $APACHE_PATH/srm.conf && echo 'Alias /horde /usr/share/horde' >> $APACHE_PATH/srm.conf && echo '    + HORDE Alias added.'); fi");
a94 1

d96 1
a96 1
        system("if (grep 'Added for IMP' $APACHE_PATH/srm.conf >/dev/null 2>&1); then (echo '    - IMP Alias should be o.k.'); else (echo '# Added for IMP' >> $APACHE_PATH/srm.conf && echo 'Alias /imp /usr/share/horde/imp' >> $APACHE_PATH/srm.conf && echo '    + IMP Alias added.'); fi ");
d219 1
d221 1
a221 10
    print "\n\n";
    config_title_bar( 'HORDE Database Configuration.' );
    menu_option( '0', 'Postgresql');
    menu_option( '1', 'Mysql');
    $command = command_prompt();

    if ( $command eq '0' ) { $dbtype = 'postgres'; }
    if ( $command eq '1' ) { $dbtype = 'mysql'; }

    system("echo 'database=$dbtype' >>/etc/horde/build.opts");
a223 1

a593 1
    system("/etc/init.d/apache-ssl restart >> /dev/null 2>&1 ");
@


1.1.2.11
log
@[IEM] adding in phplib files to conffiles so they don't get overwritten if
customized.  Fixing up horde_phplib.inc so that there is no need for different
settings between databases.  Updated prepend files to match horde_phplib.inc
name.  Removing old local.* files.
@
text
@d568 3
d584 1
d586 1
@


1.1.2.12
log
@[IEM] taking out extra conffiles.  Fixing missing $Port in horde_phplib.inc
@
text
@d47 1
a47 1
   rename $i, "$i.old";
d79 1
a79 1
        rename $i, "$i.old";
d83 4
a86 4
        system("if (grep 'extension=imap.so' $i >/dev/null 2>&1); then (echo '    - imap extension o.k.'); else (echo 'extension=imap.so' >> $i && echo '    + imap extension added.'); fi ");
        system("if (grep 'extension=ldap.so' $i >/dev/null 2>&1); then (echo '    - ldap extension o.k.'); else (echo 'extension=ldap.so' >> $i && echo '    + ldap extension added.'); fi ");
        system("if (grep 'extension=pgsql.so' $i >/dev/null 2>&1); then (echo '    - pgsql extension o.k.'); else (echo 'extension=pgsql.so' >> $i && echo '    + pgsql extension added.'); fi ");
        system("if (grep 'extension=mysql.so' $i >/dev/null 2>&1); then (echo '    - mysql extension o.k.'); else (echo 'extension=mysql.so' >> $i && echo '    + mysql extension added.'); fi ");
@


1.1.2.13
log
@[IEM] Fixes the reported problem with mysql and not beign able to access
the db.  the username/password pair must be listed and correct in
horde_phplib.inc for mysql. (postgres doesn't seem to care)
@
text
@a180 7
    if ( $dbtype eq 'pgsql' ) { 
        system("cp /etc/horde/horde_phplib.inc.pgsql /etc/horde/horde_phplib.inc >/dev/null 2>&1");
    }
    if ( $dbtype eq 'mysql' ) { 
        system("cp /etc/horde/horde_phplib.inc.mysql /etc/horde/horde_phplib.inc >/dev/null 2>&1");
    }      

d188 2
a189 8
  if ( $command eq '0' ) { 
	$dbtype = 'postgres'; 
	system("cp /etc/horde/horde_phplib.inc.pgsql /etc/horde/horde_phplib.inc >/dev/null 2>&1");
  }
  if ( $command eq '1' ) { 
	$dbtype = 'mysql'; 
	system("cp /etc/horde/horde_phplib.inc.mysql /etc/horde/horde_phplib.inc >/dev/null 2>&1");
  }
@


1.1.2.14
log
@[IEM] debian updates

   Added note about new Italian locales to the Changes file
@
text
@d181 7
d197 1
d201 1
a235 6
    if ( $dbtype eq 'postgres' ) {
        system("cp /etc/horde/horde_phplib.inc.pgsql /etc/horde/horde_phplib.inc");
    }
    if ( $dbtype eq 'mysql' ) {
        system("cp /etc/horde/horde_phplib.inc.mysql /etc/horde/horde_phplib.inc");
    }
d243 3
a245 8
    if ( $command eq '0' ) { 
	$dbtype = 'postgres'; 
        system("cp /etc/horde/horde_phplib.inc.pgsql /etc/horde/horde_phplib.inc");
	}
    if ( $command eq '1' ) { 
	$dbtype = 'mysql'; 
        system("cp /etc/horde/horde_phplib.inc.pgsql /etc/horde/horde_phplib.inc");
	}
@


1.1.2.15
log
@[IEM] debian updates

   Added note about new Italian locales to the Changes file
@
text
@@


1.1.2.16
log
@[IEM] Adding in support for skattek module
@
text
@d5 1
a5 1
local( $HORDE_SETUP_VER )        = '1.4';
a13 2
$SKATTEK_SCRIPTS_DIR = '/usr/doc/skattek/scripts';
$SKATTEK_CONFIG_DIR = '/etc/skattek';
d30 1
a30 1
print "\nHORDE Project Configurator - 1.4+ \n" . '-' x 33 . "\n\n";
d52 1
a52 1
if (($module eq 'skattek') | ($module eq 'horde') | ($module eq 'imp')) {
a102 4
if ($module eq 'skattek') {
        system("if (grep 'Added for SKATTEK' $APACHE_PATH/srm.conf >/dev/null 2>&1); then (echo '    - Skattek Alias should be o.k.'); else (echo '# Added for SKATTEK' >> $APACHE_PATH/srm.conf && echo 'Alias /skattek /usr/share/horde/skattek' >> $APACHE_PATH/srm.conf && echo '    + Skattek Alias added.'); fi ");
}

a173 26
sub build_skattek_libs
{
  local $command;
  $dbtype=check_opts();

  if ($dbtype) {
    print "    - Database previously set to: $dbtype\n";
  } else {
  print "\n\n";
  config_title_bar( 'Skattek Database Configuration.' );
  menu_option( '0', 'Postgresql');
  $command = command_prompt();

  if ( $command eq '0' ) {
        $dbtype = 'postgres';
  }

  system("echo 'database=$dbtype' >>/etc/horde/build.opts");
  }

  system("chown -R www-data.root /usr/share/horde >> /dev/null 2>&1");
  system("chmod -R 555 /usr/share/horde/skattek/lib/*.lib >> /dev/null 2>&1");

}


a260 25
sub configure_database_skattek
{

  print "  + Database Configuration\n";
 if ($dbtype eq "postgres") {
  print "    + Seeing if the Database needs to be configured...\n";
  $db_owner = "postgres";
  $com1 = "/usr/bin/psql -d skattek -c '\\dt'";
  $com2 = "su - ";
  $com4 = ' -c "';
  $com3 = '" | grep rules';
  if (system("$com2$db_owner$com4$com1$com3 >/dev/null"))
  {
    print "    + Attempting to auto-config PostgreSQL for you...\n";
    system("su - postgres -c '/usr/doc/skattek/scripts/pgsql_cuser.sh' >> /dev/null 2>&1");
    system("su - postgres -c '/usr/bin/psql template1 < /usr/doc/skattek/scripts/pgsql_create.sql' >> /dev/null 2>&1");
  } else {
    print "    - Postgres seems to be already configured\n";
  }
  print "  + Restarting PostgreSql\n";
  system("/etc/init.d/postgresql restart >> /dev/null 2>&1 ");
 }
}


a321 92
sub build_skattek_defaults
{      
$etc='/etc/skattek';
$syshostname=`hostname --fqdn`;
chop($syshostname=`hostname --fqdn`);

if ($dbtype eq 'postgres') {
  $impmgr='www-data';       
  $impmgr_passwd='';
}

    &setfile('defaults.php3',
'<?php',
"

/* For debugging purposes */
\$default->error_level               = 15;

\$default->max_execution_time        = 0;

\$default->localhost                 = 'ruins.tdyc.com';

/* Web server configuration */
\$default->root_url                  = '/horde/skattek';
\$default->include_dir             = './templates';
\$default->graphics_url              = \$default->root_url . '/graphics';

\$default->cache_pages               = false;

\$default->path_to_ipchains          = '/sbin/ipchains';
\$default->path_to_ipfwadm           = '/sbin/ipfwadm';
\$default->path_to_ssh               = '/usr/bin/ssh';

\$default->cookie_timeout            = '10000';
\$default->secure                    = true;
\$default->language                  = 'en';

\$default->db_type                   = 'pgsql';
\$default->db_user_name              = 'www-data';
\$default->db_password               = '';
\$default->db_name                   = 'skattek';
\$default->db_server_name            = 'localhost';
\$default->db_objects_table          = 'objects';
\$default->db_fw_users_table         = 'fw_users';
\$default->db_policy_table           = 'policy';
\$default->db_fw_objects_table       = 'fw_objects';
\$default->db_services_table         = 'services';
\$default->db_connect_string         = '';
\$default->db_server_port            = '';
\$default->db_server_options         = '';
\$default->db_server_tty             = '';

?>
"); 

sub setfileshort {
    local ($filename,$value) = @@_;
    push(@@files,$filename);
    $filecontents{$filename}= $value;
}

sub setfile {
    local ($filename,$value1,$value2,$d) = @@_;
    chop($d=`date`);
    $v=
"$value1\
$value2";
    push(@@files,$filename);
    $filecontents{$filename}=$v;
}
sub reswarn {
    print STDERR "$_[0]\n";
    return 0;
}

for $f (@@files) {
    open(N,">$etc/$f.postinstnew") || die "Error creating $etc/$f.postinstnew: $!\n";
    print(N $filecontents{$f}) || die "Error writing $etc/$f.postinstnew: $!\n";
    close(N) || die "Error closing $etc/$f.postinstnew: $!\n";
}

while (defined($f= pop(@@files))) {
    rename("$etc/$f.postinstnew","$etc/$f") || die "Error installing $etc/$f: $!\n";
}


while (defined($f= pop(@@files))) {
    rename("$etc/$f.postinstnew","$etc/$f") || die "Error installing $etc/$f: $!\n";
}
}


d578 1
a578 1
$temp = '0';
d592 2
a593 4
  $temp = '1';
} 

if ($module eq 'imp') {
a604 2
  $temp = '1';
} 
d606 2
a607 6
if ($module eq 'skattek') {
    build_skattek_libs();
   if ($dbtype eq "postgres") { system("cp /etc/horde/prepend.pgsql /etc/horde/prepend.php3 > /dev/null 2>&1"); }
    configure_database_skattek();
  if (-s "/etc/skattek/defaults.php3") {
    print "  - Leaving existing defaults.php3 file alone\n";
d609 2
a610 2
    print "  + Building generic defaults.php3 file.\n";
    build_skattek_defaults();
a611 12
   system("chmod 555 /etc/skattek/*.php3 /etc/skattek/*.txt /etc/skattek/*.html >> /dev/null 2>&1 ");
  $temp = '1';

} 

if ($module eq 'clean') {
  print "\n\n";
  $temp = '1';
}
if ($temp eq '0') {
    print "Usage:  hordesetup modulename \n";
    print "\nModulenames are horde, imp, and skattek currently\n\n";
d614 1
a614 1
  if (($module eq 'imp') | ($module eq 'horde') | ($module eq 'skattek')) {
@


1.1.2.17
log
@[IEM] more updates...adding a -f to the mysql commands in my setup script
@
text
@d343 1
a343 1
    system("/usr/bin/mysql -f < /usr/doc/imp/scripts/mysql_create.sql >> /dev/null 2>&1");
d373 1
a373 1
   system("/usr/bin/mysql -f < /usr/doc/horde-core/scripts/mysql_create.sql >/dev/null 2>&1");
@


1.1.2.18
log
@[IEM] more updates...adding a -f to the mysql commands in my setup script
@
text
@@


1.1.2.19
log
@[IEM] updated hordesetup with change from hacking up php3.ini to hacking
up apache's access.conf file
@
text
@d5 1
a5 1
local( $HORDE_SETUP_VER )        = '1.5';
a7 1
$debian = 'yes';
a13 1
$HORDE_SCRIPTS_DIR = '/usr/doc/horde-core/scripts';
a16 1
$PREPEND_FILE = '/etc/horde/prepend.php3';
d29 2
d32 1
a32 1
print "\nHORDE Project Configurator - 1.5+ \n" . '-' x 33 . "\n\n";
d40 7
a46 3
   $values{'include_path'} = s/ //g;
   print "    - Removing old prepend.php3 statements.\n";
   $values{'auto_prepend_file'} = s/ //g;
d60 25
d93 1
a95 2
   print "  + $APACHE_PATH/access.conf\n";
   system("if (grep 'Added for HORDE' $APACHE_PATH/access.conf >/dev/null 2>&1); then (echo '    - HORDE Directory should be o.k.'); else (echo ' ' >> $APACHE_PATH/access.conf && echo '# Added for HORDE' >> $APACHE_PATH/access.conf && echo '<Directory /usr/share/horde>' >> $APACHE_PATH/access.conf && echo 'Options Indexes FollowSymLinks' >> $APACHE_PATH/access.conf && echo 'AllowOverride None' >> $APACHE_PATH/access.conf && echo 'order allow,deny' >> $APACHE_PATH/access.conf && echo 'allow from all' >> $APACHE_PATH/access.conf && echo 'php3_include_path $PHPLIB_DIR:$HORDE_CONFIG_DIR' >> $APACHE_PATH/access.conf && echo 'php3_auto_prepend_file $PREPEND_FILE' >> $APACHE_PATH/access.conf && echo '</Directory>' >> $APACHE_PATH/access.conf && echo '    + HORDE Directory added.'); fi");
d197 1
a197 1
  system("echo 'database=$dbtype' >> $HORDE_CONFIG_DIR/build.opts");
a203 19
sub set_value {   
   local $prompt        = shift;
   local $input_val     = shift;
   local $help_text     = shift;
   local $temp, $new_val;
   local $prompt_out;
   if ( $help_text ne '' ) {
      $prompt_out = $prompt . ' [ ' . $$input_val . ' ] ' . "\n" . $help_text . "\n: ";
   } else {
      $prompt_out = $prompt . ' [ ' . $$input_val . ' ] : ';
   }
   $temp = command_prompt( $prompt_out );
   if ( $temp ) {
      $$input_val = $temp;
      return $$input_val;
   } else {
      return $$input_val;
   }
}
d217 1
a217 1
  menu_option( '1', 'MySql');
d227 1
a227 9
  system("echo 'database=$dbtype' >> $HORDE_CONFIG_DIR/build.opts");
  }
 if ( $dbtype eq 'mysql' ) {
        print "\n\n";
        print "What is your MySql password? (type in \"none\" for no password)";
        $db_pass = command_prompt();
      if (! ($db_pass)) {
         $db_pass = 'none';
      }
d238 1
a238 1
   open(OPTIONS, "$HORDE_CONFIG_DIR/build.opts") || return "";
d260 1
a260 1
        system("cp $HORDE_CONFIG_DIR/horde_phplib.inc.pgsql $HORDE_CONFIG_DIR/horde_phplib.inc");
d263 1
a263 1
        system("cp $HORDE_CONFIG_DIR/horde_phplib.inc.mysql $HORDE_CONFIG_DIR/horde_phplib.inc");
d274 1
a274 1
        system("cp $HORDE_CONFIG_DIR/horde_phplib.inc.pgsql $HORDE_CONFIG_DIR/horde_phplib.inc");
d278 1
a278 1
        system("cp $HORDE_CONFIG_DIR/horde_phplib.inc.pgsql $HORDE_CONFIG_DIR/horde_phplib.inc");
d280 1
a280 1
    system("echo 'database=$dbtype' >> $HORDE_CONFIG_DIR/build.opts");
a282 8
 if ( $dbtype eq 'mysql' ) {
        print "\n\n";
        print "What is your MySql password? (type in \"none\" for no password)";
        $db_pass = command_prompt();
      if (! ($db_pass)) {
         $db_pass = 'none';
      }
  }
d288 1
a288 1
  system("chmod 555 $HORDE_CONFIG_DIR/*.php3 $HORDE_CONFIG_DIR/*.txt $HORDE_CONFIG_DIR/*.html >> /dev/null 2>&1");
d312 2
a313 6
  if ($debian eq 'yes') {
    print "  + Restarting PostgreSql\n";
    system("/etc/init.d/postgresql restart >> /dev/null 2>&1 ");
  } else {
    print "  + Please Restart PostgreSql\n";
  }
d337 2
a338 6
  if ($debian eq 'yes') {
    print "  + Restarting PostgreSql\n";
    system("/etc/init.d/postgresql restart >> /dev/null 2>&1 ");
  } else {
    print "  + Please Restart PostgreSql\n";
  }
d342 4
a345 12
    print "    + Attempting to auto-config MySQL for you...\n";
    if ($db_pass eq "none") {
      system("/usr/bin/mysql -f < $IMP_SCRIPTS_DIR/mysql_create.sql ");
    } else {
      system("/usr/bin/mysql -f --password=$db_pass < $IMP_SCRIPTS_DIR/mysql_create.sql");
    }
    if ($debian eq 'yes') {
      print "  + Restarting MySql\n";
      system("/etc/init.d/mysql restart >> /dev/null 2>&1 ");
    } else {
      print "  + Please Restart MySql\n";
    }
d373 1
a373 5
    if ($db_pass eq "none") {
      system("/usr/bin/mysql -f < $HORDE_SCRIPTS_DIR/mysql_create.sql ");
    } else {
      system("/usr/bin/mysql -f --password=$db_pass < $HORDE_SCRIPTS_DIR/mysql_create.sql");
    }
d731 2
a732 2
   if ($dbtype eq "postgres") { system("cp /etc/horde/prepend.pgsql $PREPEND_FILE > /dev/null 2>&1"); }
    if ($dbtype eq "mysql") { system("cp /etc/horde/prepend.mysql $PREPEND_FILE > /dev/null 2>&1"); }
d746 2
a747 2
   if ($dbtype eq "postgres") { system("cp /etc/horde/prepend.pgsql $PREPEND_FILE > /dev/null 2>&1"); }
   if ($dbtype eq "mysql") { system("cp /etc/horde/prepend.mysql $PREPEND_FILE > /dev/null 2>&1"); }
d761 1
a761 1
   if ($dbtype eq "postgres") { system("cp /etc/horde/prepend.pgsql $PREPEND_FILE > /dev/null 2>&1"); }
@


1.1.2.20
log
@[IEM] updating hordesetup file here as well
@
text
@a8 1

d10 8
d19 1
a19 66

if ($module eq 'horde-dev') {
  $HORDE_CONFIG_DIR = '/etc/horde-dev';
  $HORDE_DIR = '/usr/share/horde-dev';
  $MODULE_SCRIPTS_DIR = '/usr/doc/horde-core-dev/scripts';
  $MODULE_DIR = '/usr/share/horde-dev';
  $MODULE_CONF_DIR = '/etc/horde-dev';
  $PREPEND_FILE = '/etc/horde-dev/prepend.php3';
  $APACHE_LINE = 'Added for HORDE-DEV';
  $MODULE_TABLE = "active_sessions";
} 
if ($module eq 'horde') {
  $HORDE_CONFIG_DIR = '/etc/horde';
  $HORDE_DIR = '/usr/share/horde';
  $MODULE_SCRIPTS_DIR = '/usr/doc/horde-core/scripts';
  $MODULE_DIR = '/usr/share/horde';
  $MODULE_CONF_DIR = '/etc/horde';
  $PREPEND_FILE = '/etc/horde/prepend.php3';
  $APACHE_LINE = 'Added for HORDE';
  $MODULE_TABLE = "active_sessions";
}

if ($module eq 'imp-dev') {
  $MODULE_DIR = '/usr/share/horde-dev/imp';
  $MODULE_CONF_DIR = '/etc/imp-dev';
  $MODULE_SCRIPTS_DIR = '/usr/doc/imp-dev/scripts';
  $APACHE_LINE = 'Added for IMP-DEV';
  $HORDE_CONFIG_DIR = '/etc/horde-dev';
  $HORDE_DIR = '/usr/share/horde-dev';
  $PREPEND_FILE = '/etc/horde-dev/prepend.php3';
  $MODULE_TABLE = "imp_pref";
} 
if ($module eq 'imp') {
  $MODULE_DIR = '/usr/share/horde/imp';
  $MODULE_CONF_DIR = '/etc/imp';
  $MODULE_SCRIPTS_DIR = '/usr/doc/imp/scripts';
  $APACHE_LINE = 'Added for IMP';
  $HORDE_CONFIG_DIR = '/etc/horde';
  $HORDE_DIR = '/usr/share/horde';
  $PREPEND_FILE = '/etc/horde/prepend.php3';
  $MODULE_TABLE = "imp_pref";
}

if ($module eq 'skattek-dev') {
  $MODULE_CONF_DIR = '/etc/skattek-dev'; 
  $MODULE__DIR = '/usr/share/horde-dev/skattek';
  $MODULE_SCRIPTS_DIR = '/usr/doc/skattek-dev/scripts';
  $HORDE_DIR = '/usr/share/horde-dev';
  $HORDE_CONFIG_DIR = '/etc/horde-dev';
  $APACHE_LINE = 'Added for SKATTEK-DEV';
  $PREPEND_FILE = '/etc/horde-dev/prepend.php3';
  $MODULE_TABLE = "fw_users";
} 
if ($module eq 'skattek') {
  $MODULE_CONF_DIR = '/etc/skattek'; 
  $MODULE__DIR = '/usr/share/horde/skattek'; 
  $MODULE_SCRIPTS_DIR = '/usr/doc/skattek/scripts';
  $HORDE_DIR = '/usr/share/horde';
  $HORDE_CONFIG_DIR = '/etc/horde';
  $APACHE_LINE = 'Added for SKATTEK';
  $PREPEND_FILE = '/etc/horde/prepend.php3';
  $MODULE_TABLE = "fw_users";
}



d66 1
a66 1
if (($module eq 'horde') | ($module eq 'horde-dev')) {
d68 4
a71 1
   system("if (grep '$APACHE_LINE' $APACHE_PATH/access.conf >/dev/null 2>&1); then (echo '    - HORDE Directory should be o.k.'); else (echo ' ' >> $APACHE_PATH/access.conf && echo '# $APACHE_LINE' >> $APACHE_PATH/access.conf && echo '<Directory $HORDE_DIR>' >> $APACHE_PATH/access.conf && echo 'Options Indexes FollowSymLinks' >> $APACHE_PATH/access.conf && echo 'AllowOverride None' >> $APACHE_PATH/access.conf && echo 'order allow,deny' >> $APACHE_PATH/access.conf && echo 'allow from all' >> $APACHE_PATH/access.conf && echo 'php3_include_path $PHPLIB_DIR:$HORDE_CONFIG_DIR' >> $APACHE_PATH/access.conf && echo 'php3_auto_prepend_file $PREPEND_FILE' >> $APACHE_PATH/access.conf && echo '</Directory>' >> $APACHE_PATH/access.conf && echo '    + HORDE Directory added.'); fi");
d73 7
a79 3
if (($module eq 'horde') | ($module eq 'horde-dev') | ($module eq 'imp') | ($module eq 'imp-dev') | ($module eq 'skattek') | ($module eq 'skattek-dev')){
    print "  + $APACHE_PATH/srm.conf\n";
        system("if (grep '$APACHE_LINE' $APACHE_PATH/srm.conf >/dev/null 2>&1); then (echo '    - $module Alias should be o.k.'); else (echo '# $APACHE_LINE' >> $APACHE_PATH/srm.conf && echo 'Alias /$module $MODULE_DIR' >> $APACHE_PATH/srm.conf && echo '    + $module Alias added.'); fi");
d153 16
d170 2
d173 2
d176 1
d197 2
a198 1
sub build_libs
d202 1
a202 1

d207 1
a207 1
  config_title_bar( 'HORDE Database Configuration.' );
d212 2
a213 2
  if ( $command eq '0' ) {
        $dbtype = 'postgres';
d215 2
a216 2
  if ( $command eq '1' ) {
        $dbtype = 'mysql';
a228 6
 if ( $dbtype eq 'postgres' ) {
        system("cp $HORDE_CONFIG_DIR/horde_phplib.inc.pgsql $HORDE_CONFIG_DIR/horde_phplib.inc");
    }
    if ( $dbtype eq 'mysql' ) {
        system("cp $HORDE_CONFIG_DIR/horde_phplib.inc.mysql $HORDE_CONFIG_DIR/horde_phplib.inc");
    }
d230 4
a233 6
  system("cd $MODULE_DIR/lib/src && ./build.pl --database=$dbtype >> /dev/null 2>&1");         
  system("chown -R www-data.root $HORDE_DIR >> /dev/null 2>&1");
  system("chmod -R 555 $MODULE_DIR/lib/*.lib >> /dev/null 2>&1");
  system("chmod 000 $HORDE_DIR/setup.php3 >> /dev/null 2>&1");
  system("chmod 555 $MODULE_CONF_DIR/*.php3 $MODULE_CONF_DIR/*.txt $MODULE_CONF_DIR/*.html >> /dev/null 2>&1");
  
d252 30
d283 48
a330 1
sub configure_database
d332 1
d340 2
a341 2
  $com3 = '" | grep ';
  if (system("$com2$db_owner$com4$com1$com3$MODULE_TABLE >/dev/null"))
d344 2
a345 2
    system("su - postgres -c '$MODULE_SCRIPTS/pgsql_cuser.sh' >> /dev/null 2>&1");
    system("su - postgres -c '/usr/bin/psql template1 < $MODULE_SCRIPTS/pgsql_create.sql' >> /dev/null 2>&1");
d351 1
a351 1
    system("/etc/init.d/postgresql stop >> /dev/null 2>&1 ; /etc/init.d/postgresql start >> /dev/null 2>&1 ");
d360 1
a360 1
      system("/usr/bin/mysql -f < $MODULE_SCRIPTS_DIR/mysql_create.sql ");
d362 1
a362 1
      system("/usr/bin/mysql -f --password=$db_pass < $MODULE_SCRIPTS_DIR/mysql_create.sql");
d373 34
d409 1
a409 1
$etc="$MODULE_CONF_DIR";
d501 1
a501 1
$etc="$HORDE_CONFIG_DIR";
d590 1
a590 1
$etc="$IMP_CONF_DIR";
d757 35
a791 6
  if (($module eq 'imp') | ($module eq 'horde') | ($module eq 'skattek') | ($module eq 'imp-dev') | ($module eq 'horde-dev') | ($module eq 'skattek-dev')) {
  build_libs();
  if ($dbtype eq "postgres") { system("cp $HORDE_CONFIG_DIR/prepend.pgsql $PREPEND_FILE > /dev/null 2>&1"); }
  if ($dbtype eq "mysql") { system("cp $HORDE_CONFIG_DIR/prepend.mysql $PREPEND_FILE > /dev/null 2>&1"); }
  configure_database();
  if (-s "$MODULE_CONF_DIR/defaults.php3") {
d795 1
a795 1
    build_$module_defaults();
d797 1
a797 1
  system("chmod 555 $MODULE_CONF_DIR/*.php3 $MODULE_CONF_DIR/*.txt $MODULE_CONF_DIR/*.html >> /dev/null 2>&1 ");
a798 1
}
d800 1
d811 4
a814 8
  if (($module eq 'imp') | ($module eq 'horde') | ($module eq 'skattek') | ($module eq 'imp-dev') | ($module eq 'horde-dev') | ($module eq 'skattek-dev')) {
   if ($debian eq 'yes') {
      print "  + Restarting Apache\n";
      system("/etc/init.d/apache restart >> /dev/null 2>&1 ");
      system("/etc/init.d/apache-ssl restart >> /dev/null 2>&1 ");
   } else {
     print "  + Please restart Apache\n";
   }
a815 1

@


1.1.2.21
log
@[IEM] typo fix before I forget
@
text
@d57 1
a57 1
  $MODULE_DIR = '/usr/share/horde-dev/skattek';
d67 1
a67 1
  $MODULE_DIR = '/usr/share/horde/skattek'; 
@


1.1.2.22
log
@[IEM] adding in postgres configuration checking
@
text
@d5 1
a5 1
local( $HORDE_SETUP_VER )        = '1.6';
d12 1
a12 1
$POSTMASTER_INI_FILE = '/etc/postgresql/postmaster.init';
d91 1
a91 1
print "\nHORDE Project Configurator - 1.6+ \n" . '-' x 33 . "\n\n";
a249 4
  if ( $dbtype eq 'postgres' ) {
    system("sed -e 's#\# PGALLOWTCPIP=no#PGALLOWTCPIP=yes#' $POSTMASTER_INI_FILE > $POSTMASTER_INIT_FILE.tmp");
    system("mv $POSTMASTER_INI_FILE.tmp $POSTMASTER_INI_FILE");
  }
d710 2
a711 2
      system("/etc/init.d/apache reload >> /dev/null 2>&1 ");
      system("/etc/init.d/apache-ssl reload >> /dev/null 2>&1 ");
@


1.1.2.23
log
@[IEM] adding in a more robust postgres configuration piece into the hordesetup
proggie.  Now it checks for an imp database..if it exists, it check for a horde
databse...if it exists it says have a cookie...if one or the other is missing
it will eventually end up with a horde database with the proper stuff.
alas..finally a migration to the horde database for postgres...now to do
mysql.
@
text
@d5 1
a5 1
local( $HORDE_SETUP_VER )        = '2.0';
d91 1
a91 1
print "\nHORDE Project Configurator - 2.0+ \n" . '-' x 33 . "\n\n";
d250 4
a295 1
  $PSQL_QUERY = "create database horde";
d304 1
a304 1
  if (!(system("$com2$db_owner$com4$com1$com3$MODULE_TABLE >/dev/null")))
d306 5
a310 42
    print "    + imp database found...looking for horde database...\n";
    $db_owner = "postgres";  
    $com1 = "/usr/bin/psql -d horde -c '\\dt'";
    $com2 = "su - ";
    $com4 = ' -c "';
    $com3 = '" | grep ';
    if (system("$com2$db_owner$com4$com1$com3$MODULE_TABLE >/dev/null"))
    {
      print "\n\n    + Not found.  Attempting database migration for you...\n";
      print "      Your old database will not be removed...\n";
      print "\n\n";
      print "What is your horde database user password? (pick one if you don't have one) ";
      $db_pass = command_prompt('Password: ');
      system("su - postgres -c '$MODULE_SCRIPTS_DIR/pgsql_cuser.sh $db_pass >>/dev/null 2>&1'");
      system("su - postgres -c '/usr/bin/pg_dump imp -f /tmp/imp.out >>/dev/null 2>&1'");
      system("su - postgres -c '/usr/bin/psql -c \"$PSQL_QUERY\" template1 >>/dev/null 2>&1'");
      system("su - postgres -c '/usr/bin/psql -e horde </tmp/imp.out >>/dev/null 2>&1; rm /tmp/imp.out >>/dev/null 2>&1'");
      system("su - postgres -c '/usr/bin/psql template1 < $MODULE_SCRIPTS_DIR/pgsql_create.sql >>/dev/null 2>&1'");
    } else {
	  print "    - Postgres seems to be already configured\n";
          print "      You should get rid of the imp database once you are \n";
          print "      comfortable with the new horde database.\n";
    }
    } else {
      $db_owner = "postgres";
      $com1 = "/usr/bin/psql -d horde -c '\\dt'";
      $com2 = "su - ";
      $com4 = ' -c "';
      $com3 = '" | grep ';
      if (system("$com2$db_owner$com4$com1$com3$MODULE_TABLE >/dev/null"))
      {
      print "    + Attempting to auto-config PostgreSQL for you...\n";
      print "\n\n";
      print "What is your horde database user password? (Pick one if you don't have one) ";
      $db_pass = command_prompt('Password: ');
      system("su - postgres -c '$MODULE_SCRIPTS_DIR/pgsql_cuser.sh $db_pass >>/dev/null 2>&1'");
      system("su - postgres -c '/usr/bin/psql -c \"$PSQL_QUERY\" template1 >>/dev/null 2>&1'");
      system("su - postgres -c '/usr/bin/psql template1 < $MODULE_SCRIPTS_DIR/pgsql_create.sql' >>/dev/null 2>&1");
      } else {
       print "    - Postgres seems to be already configured\n";
       print "      Ignore any errors about missing imp database\n";
      }
a311 1

d343 1
a343 1
  $impmgr='hordemgr';       
d374 1
a374 1
\$default->db_user_name              = 'hordemgr';
d435 1
a435 1
  $impmgr='hordemgr';
d524 1
a524 1
  $impmgr='hordemgr';
d695 1
a695 19
    if ($module eq 'imp') {
      build_imp_defaults();
    }
    if ($module eq 'horde') {
      build_horde_defaults();
    }
    if ($module eq 'skattek') {
      build_skattek_defaults();
    }
    if ($module eq 'imp-dev') {
      build_imp_defaults();
    }
    if ($module eq 'horde-dev') {
      build_horde_defaults();
    }
    if ($module eq 'skattek-dev') {
      build_skattek_defaults();
    }

@


1.1.2.24
log
@[IEM] adding in php3_magic_quotes_gpc Off option to build process
@
text
@d126 1
a126 1
   system("if (grep '$APACHE_LINE' $APACHE_PATH/access.conf >/dev/null 2>&1); then (echo '    - HORDE Directory should be o.k.'); else (echo ' ' >> $APACHE_PATH/access.conf && echo '# $APACHE_LINE' >> $APACHE_PATH/access.conf && echo '<Directory $HORDE_DIR>' >> $APACHE_PATH/access.conf && echo 'Options Indexes FollowSymLinks' >> $APACHE_PATH/access.conf && echo 'AllowOverride None' >> $APACHE_PATH/access.conf && echo 'order allow,deny' >> $APACHE_PATH/access.conf && echo 'allow from all' >> $APACHE_PATH/access.conf && echo 'php3_include_path $PHPLIB_DIR:$HORDE_CONFIG_DIR' >> $APACHE_PATH/access.conf && echo 'php3_auto_prepend_file $PREPEND_FILE' >> $APACHE_PATH/access.conf && echo 'php3_magic_quotes_gpc Off' >> $APACHE_PATH/access.conf && echo '</Directory>' >> $APACHE_PATH/access.conf && echo '    + HORDE Directory added.'); fi");
@


1.1.2.25
log
@[IEM] Updating CHANGES and INSTALL (along with tons of debian stuff)

   Updated: documtation about database changes/creation
   Notes on magic_quotes and per directory phplib config
@
text
@d13 10
d34 10
d55 10
a106 4
   system("/bin/sed -e 's#/usr/lib/phplib:/etc/horde#/etc/horde:/usr/lib/phplib#' $APACHE_PATH/access.conf >$APACHE_PATH/access.conf.tmp");
   system("cp $APACHE_PATH/access.conf $APACHE_PATH/access.conf.back");
   system("if (grep 'HORDE' $APACHE_PATH/access.conf.tmp >/dev/null 2>&1); then (mv $APACHE_PATH/access.conf.tmp $APACHE_PATH/access.conf); fi");

d124 1
a124 1
if ($module eq 'horde') {
d126 1
a126 1
   system("if (grep '$APACHE_LINE' $APACHE_PATH/access.conf >/dev/null 2>&1); then (echo '    - HORDE Directory should be o.k.'); else (echo ' ' >> $APACHE_PATH/access.conf && echo '# $APACHE_LINE' >> $APACHE_PATH/access.conf && echo '<Directory $HORDE_DIR>' >> $APACHE_PATH/access.conf && echo 'Options Indexes FollowSymLinks' >> $APACHE_PATH/access.conf && echo 'AllowOverride None' >> $APACHE_PATH/access.conf && echo 'order allow,deny' >> $APACHE_PATH/access.conf && echo 'allow from all' >> $APACHE_PATH/access.conf && echo 'php3_include_path $HORDE_CONFIG_DIR:$PHPLIB_DIR' >> $APACHE_PATH/access.conf && echo 'php3_auto_prepend_file $PREPEND_FILE' >> $APACHE_PATH/access.conf && echo 'php3_magic_quotes_gpc Off' >> $APACHE_PATH/access.conf && echo '</Directory>' >> $APACHE_PATH/access.conf && echo '    + HORDE Directory added.'); fi");
d128 1
a128 1
if (($module eq 'horde') | ($module eq 'imp') | ($module eq 'skattek')){
d253 1
a253 1
        $db_pass = command_prompt('Password: ');
a295 1
  print "      *** Ignore any errors or warnings you see *** \n";
d411 1
a411 1
\$default->db_name                   = 'horde';
d497 1
a497 1
\$default->db_name                   = 'horde';
d554 1
a554 1
$etc="$MODULE_CONF_DIR";
d665 1
a665 1
\$default->db_name                   = 'horde';
d721 1
a721 1
  if (($module eq 'imp') | ($module eq 'horde') | ($module eq 'skattek')) {
d739 10
d764 1
a764 1
  if (($module eq 'imp') | ($module eq 'horde') | ($module eq 'skattek')) {
a771 14
      
     print "\n\n  *****   NOTE NOTE NOTE ***** \n\n";
     print "The database for postgresql users has moved from imp to horde \n";
     print "and the database user from www-data to hordemgr.  Please make \n";
     print "sure that your defaults.php3 file for horde and imp are set \n";
     print "properly if you are upgrading either.  MySql users will need \n";
     print "to be aware that this will happen to them once the conversion \n";
     print "has been written and tested.   \n\n";
     print "Also, if you have been using horde since prior to pre3-8 plase \n";
     print "make sure you have: \n\n";
     print "       php3_magic_quotes_gpc Off   \n";
     print "\nset in your /etc/apache/access.conf in the HORDE Directory statement\n\n";
     $foo = command_prompt('Press Return');
     print "\n\n";
a772 1

@


1.1.2.26
log
@[IEM] Documentation sweep for horde

    1> Walked through HELP/INSTALL/README redoing installation instructions
       where needed.
    2> Migrated the IMP DATABASE file into the HORDE tree making changes
       where necessary.  (will remove database pieces out of INSTALL
       soon enough.
    3> updated more debian junk
@
text
@d5 1
a5 1
local( $HORDE_SETUP_VER )        = '2.1';
d61 1
a61 1
print "\nHORDE Project Configurator - 2.1+ \n" . '-' x 33 . "\n\n";
a312 1
      system("su - postgres -c '/usr/bin/psql -c \"$PSQL_QUERY\" template1 >>/dev/null 2>&1'");
a446 1
  $db_name='horde';
a450 1
  $db_name='imp';
d472 1
a472 1
\$default->db_name                   = '$db_name';
a535 1
  $db_name='horde';
a539 1
  $db_name='imp';
d640 1
a640 1
\$default->db_name                   = '$db_name';
@


1.1.2.27
log
@[IEM] getting the version number back in line.  Adding in routines to verify
that .lib's are built. (removing existing libs before calling hordesetup)
@
text
@d5 1
a5 1
local( $HORDE_SETUP_VER )        = '2.2';
d61 1
a61 1
print "\nHORDE Project Configurator - 2.2+ \n" . '-' x 33 . "\n\n";
d65 12
d78 1
a78 1
   system("if ! test $APACHE_PATH/access.conf.horde.back; then (cp $APACHE_PATH/access.conf $APACHE_PATH/access.conf.horde.back); fi");
d109 40
d226 1
a226 2
        print "What is your MySql password? (type in \"none\" for no password)\n";
        print "(Will be show in clear text, but not stored) ";
a266 1
  $PSQL2_QUERY = "GRANT SELECT, INSERT, UPDATE ON active_sessions, auth_user, auth_user_md5 TO hordemgr";
d270 1
d272 1
a272 1
  $com1 = "/usr/bin/psql -d horde -c '\\dt'";
d276 1
a276 1
  if (system("$com2$db_owner$com4$com1$com3$MODULE_TABLE >>/dev/null 2>&1"))
d278 1
a278 1
    print "    + horde database tables not found...looking for imp database...\n";
d280 1
a280 1
    $com1 = "/usr/bin/psql -d imp -c '\\dt'";
d284 1
a284 1
    if (!(system("$com2$db_owner$com4$com1$com3$MODULE_TABLE >>/dev/null 2>&1")))
d286 1
a286 1
      print "\n\n    + Found.  Attempting database migration for you...\n";
d289 2
a290 4
      print "What is your horde database user password? (pick one if you don't have one)\n";
        print "(Will be show in clear text, but not stored) ";
        $db_pass = command_prompt('Password: ');
       print "\n";
d297 12
d311 1
a311 2
      print "What is your horde database user password? (Pick one if you don't have one) \n";
      print "(Will be show in clear text, but not stored) ";
d313 1
a313 1
      print "\n";
a316 1
      }
d318 2
a319 2
        system("su - postgres -c '/usr/bin/psql -c \"$PSQL2_QUERY\" template1 >>/dev/null 2>&1'");
       print "    - Horde Database tables found and Postgresql seems configured properly\n";
d321 1
d367 1
a367 1
\$default->localhost                 = '$syshostname';
d386 1
a386 1
\$default->db_password               = '$db_pass';
d475 1
a475 1
\$default->db_name                   = 'horde';
d554 4
a572 1
\$default->servtype                  = 'imap';
a597 2
\$default->user_change_port          = true;
\$default->user_change_servtype      = true;
a601 1
\$default->user_use_folders          = true;
d654 4
d742 2
a743 2
     system("sleep 4");     
     print "\n  *****   NOTE NOTE NOTE ***** \n\n";
d755 1
a755 1
     print "\n";
@


1.1.2.28
log
@[IEM] normal debian stuff...but...I also fixed a bug. :)

as reported by a debian user :

     Fatal error: mime_message is not a class in /usr/share/horde/signup.php3 on
+line 82.

well...problem's had already been fixed, but whoever forgot about poor ol'
signup.

in the process I found a bug in problem.  The nice little hack for getting
horde to send email without knowing about imp forgot about from_server. so
I fixed that as well.  no more errors and both work.

(yea..I'll do the same to -dev if it's brokerd too)

Ivan
@
text
@d4 9
a12 25


# Horde Setup variables
local( $HORDE_SETUP_VER )       = '2.5';
local( $module )                = $ARGV[0];
local( $HORDE_CONFIG_DIR )      = '/etc/horde';
local( $HORDE_DIR )             = '/usr/share/horde';
local( $PHPLIB_DIR )            = '/usr/lib/phplib';
local( $PHPINI_PATH )           = '/etc/php3';
local( $PREPEND_FILE )          = '/etc/horde/prepend.php3';
local( $dbtype )                = check_opts();
local( $debian)                 = 'yes';
local( $APACHE_PATH )           = '/etc/apache';
local( $APACHE_SSL_PATH )       = '/etc/apache-ssl';
local( $db_pass )               = 'none';
local( $MODULE_SCRIPTS_DIR )    = '/usr/doc/' . $ARGV[0] . '/scripts';
local( $MODULE_CONF_DIR )       = '/etc/' . $ARGV[0];
local $MODULE_DIR;              
local $MODULE_TABLE;
local $APACHE_LINE;
local $have_apache;
local $have_apache_ssl;

# Determine which module to setup and set module specific values

d14 3
d18 2
d26 2
d29 3
d36 1
d38 3
d42 1
a46 3
# Is either apache or apache-ssl installed?
if (-d $APACHE_SSL_PATH) { $have_apache_ssl='yes'; } else { $have_apache_ssl='no'; }
if (-d $APACHE_PATH) { $have_apache='yes'; } else { $have_apache='no'; }
d48 12
d61 1
a61 3
# Let's start this puppy

print "\nHORDE Project Configurator - 2.5+ \n" . '-' x 33 . "\n\n";
d63 1
d65 3
a67 8
sub clean {
   local $path        = shift;

  print "* Cleaning up configuration files\n";
   system("/bin/sed -e 's#/usr/lib/phplib:/etc/horde#/etc/horde:/usr/lib/phplib#' $path/access.conf >$path/access.conf.tmp");
   system("if ! test $path/access.conf.horde.back; then (cp $path/access.conf $path/access.conf.horde.back); fi");
   system("if (grep 'HORDE' $path/access.conf.tmp >/dev/null 2>&1); then (mv $path/access.conf.tmp $path/access.conf); fi");
  
d71 1
d73 2
a74 4
sub config_php3 {

  print "* Verify PHP3 configuration files\n";
  foreach $i (split(/\n/, `find $PHPINI_PATH -name "*.ini" -print`)) {
d85 1
a85 5
sub config_apache {
   local $path        = shift;

  print "* Verify Apache configuration files\n";

d87 7
a93 8
   print "  + $path/access.conf\n";
   system("if (grep '$APACHE_LINE' $path/access.conf >/dev/null 2>&1); then (echo '    - horde directory should be o.k.'); else (echo ' ' >> $path/access.conf && echo '# $APACHE_LINE' >> $path/access.conf && echo '<Directory $HORDE_DIR>' >> $path/access.conf && echo 'Options Indexes FollowSymLinks' >> $path/access.conf && echo 'AllowOverride None' >> $path/access.conf && echo 'order allow,deny' >> $path/access.conf && echo 'allow from all' >> $path/access.conf && echo 'php3_include_path $HORDE_CONFIG_DIR:$PHPLIB_DIR' >> $path/access.conf && echo 'php3_auto_prepend_file $PREPEND_FILE' >> $path/access.conf && echo 'php3_magic_quotes_gpc Off' >> $path/access.conf && echo '</Directory>' >> $path/access.conf && echo '    + horde directory added.'); fi");
   } 

  if (($module eq 'horde') | ($module eq 'imp') | ($module eq 'skattek')){
    print "  + $path/srm.conf\n";
        system("if (grep '$APACHE_LINE' $path/srm.conf >/dev/null 2>&1); then (echo '    - $module alias should be o.k.'); else (echo '# $APACHE_LINE' >> $path/srm.conf && echo 'Alias /$module $MODULE_DIR' >> $path/srm.conf && echo '    + $module alias added.'); fi");
  }
d97 1
a97 1
sub command_prompt { 
d152 2
a153 2
  
  print "*  Processing horde libraries\n";
d155 1
a155 1
    print "  - Database previously set to: $dbtype\n";
d172 9
a180 2
 
  print "    + installing custom horde phplib file\n";
d182 5
a186 5
   system("cp $HORDE_CONFIG_DIR/horde_phplib.inc.pgsql $HORDE_CONFIG_DIR/horde_phplib.inc");
 }
 if ( $dbtype eq 'mysql' ) {
   system("cp $HORDE_CONFIG_DIR/horde_phplib.inc.mysql $HORDE_CONFIG_DIR/horde_phplib.inc");
 }
a187 1
  print "    + building $module libraries...\n";
d189 5
a211 13
sub migrate_horde_db
{
  $PSQL_QUERY = "create database horde";

  print "          + Migrating database from imp to horde...\n";
  print "\n\n";
  print "What is your database password? (type in \"none\" for no password)\n";
  print "This is the password you want Horde to use.\n";
  print "(Will be show in clear text, but not stored) ";
  $db_pass = command_prompt('Password: ');
  if (! ($db_pass)) {
    $db_pass = 'none';
  }
d213 1
a213 10
  if ($db_pass eq 'none') { $db_pass = ''; }
  system("su - postgres -c '$MODULE_SCRIPTS_DIR/pgsql_cuser.sh $db_pass >>/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/pg_dump imp -f /tmp/imp.out >>/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/psql -c \"$PSQL_QUERY\" template1 >>/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/psql -e horde </tmp/imp.out >>/dev/null 2>&1; rm /tmp/imp.out >>/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/psql template1 < $MODULE_SCRIPTS_DIR/pgsql_create.sql >>/dev/null 2>&1'");

}

sub build_horde_db 
a214 1

d217 3
a219 22
  print "\n\n";
  print "What is your database password? (type in \"none\" for no password)\n";
  print "This is the password you want Horde to use.\n";
  print "(Will be show in clear text, but not stored) ";
  $db_pass = command_prompt('Password: ');
  if (! ($db_pass)) {
    $db_pass = 'none';
  }

  if ($db_pass eq 'none') { $db_pass = ''; }
  print "    + Creating horde database...\n";
  system("su - postgres -c '$MODULE_SCRIPTS_DIR/pgsql_cuser.sh $db_pass >>/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/psql -c \"$PSQL_QUERY\" template1 >>/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/psql template1 < $MODULE_SCRIPTS_DIR/pgsql_create.sql' >>/dev/null 2>&1");

}

sub check_horde_db
{
  local $database = shift;

  print "    + Checking $database database...\n";
d221 1
a221 1
  $com1 = "/usr/bin/psql -d $database -c '\\dt'";
d227 35
a261 5
    return('false');
  } else {
    return('true');
  }
}
d263 3
a265 14
sub configure_postgresql
{
  $PSQL2_QUERY = "GRANT SELECT, INSERT, UPDATE ON active_sessions, auth_user, auth_user_md5 TO hordemgr";
  print "  + Seeing if the Database needs to be configured...\n";
  if (!(check_horde_db('horde'))) {
    print "    + horde database not configured\n";
    if ((check_horde_db('imp'))) {
      print "\n\n  + imp database is configured.\n";
      print "    + Attempting database migration for you...\n";
      print "      - Your old database will not be removed...\n";
      migrate_horde_db();
    } else {
      build_horde_db();
    }
d267 1
a267 2
    system("su - postgres -c '/usr/bin/psql -c \"$PSQL2_QUERY\" template1 >>/dev/null 2>&1'");
    print "  - horde database seems configured properly\n";
d269 1
a269 4
}

sub configure_mysql
{
d271 2
a272 10
  print "  + Database Configuration\n";
  print "\n\n";
  print "What is your database password? (type in \"none\" for no password)\n";
  print "(Will be show in clear text, but not stored) ";
  $db_pass = command_prompt('Password: ');
  if (! ($db_pass)) {
    $db_pass = 'none';
  }

  print "    + Attempting to auto-config MySQL for you...\n";
d278 7
d324 1
a324 1
\$default->use_db                    = true;
d387 1
a387 1
  $impmgr_passwd='$db_pass';
d391 2
a392 2
  $impmgr='hordemgr';
  $impmgr_passwd='hordemgr';
d428 3
d478 1
a478 1
  $impmgr_passwd='$db_pass';
d482 2
a483 2
  $impmgr='hordemgr';
  $impmgr_passwd='hordemgr';
d632 1
d635 1
d637 1
a637 6
if (($module eq 'skattek') | ($module eq 'horde') | ($module eq 'imp')) {
  if ($have_apache eq 'yes') { config_php3($APACHE_PATH); }
  if ($have_apache_ssl eq 'yes') { config_php3($APACHE_SSL_PATH); }
  if ($have_apache eq 'yes') { config_apache($APACHE_PATH); }
  if ($have_apache_ssl eq 'yes') { config_apache($APACHE_SSL_PATH); }

a638 1
  print "    + installing custom prepend file\n";
d641 1
a641 6

  print "* Database Configuration\n";
  if ($dbtype eq 'postgres') { configure_postgresql(); }
  if ($dbtype eq 'mysql') { configure_mysql(); }

  print "* Checking horde specific configuration files\n";
a655 5

  print "  + fixing file permissions\n";
  system("chown -R www-data.root $HORDE_DIR >> /dev/null 2>&1");
  system("chmod -R 555 $MODULE_DIR/lib/*.lib >> /dev/null 2>&1");
  system("chmod 000 $HORDE_DIR/setup.php3 >> /dev/null 2>&1");
d657 2
a659 1
  print "* Restarting Affected Services\n";
d661 8
a668 1
  if ($debian eq 'yes') {
d670 3
a672 10
    if ($dbtype eq 'postgres') {
      print "  + PostgreSql\n";
      system("/etc/init.d/postgresql stop >> /dev/null 2>&1 ; /etc/init.d/postgresql start >> /dev/null 2>&1 ");
    }
    if ($dbtype eq 'mysql') {
      print "  + MySql\n";
      system("/etc/init.d/mysql restart >> /dev/null 2>&1 ");
    }
    if ($have_apache eq 'yes') { 
      print "  + Apache\n";
a673 3
    }
    if ($have_apache_ssl eq 'yes') {
      print "  + Apache-SSL\n";
d675 17
a691 6
    }
  } else {
    if ($have_apache eq 'yes') { print "  + Please restart Apache\n"; }
    if ($have_apache_ssl eq 'yes') { print "  + Please restart Apache-SSL\n"; }
    if ($dbtype eq 'postgres') { print "  + Please restart PostgreSql\n"; }
    if ($dbtype eq 'mysql') { print "  + Please restart MySql\n"; }
d695 1
a695 27
  system("sleep 4");
  print "\n         *****   NOTE NOTE NOTE ***** \n\n";
  print "The database for postgresql users has moved from imp to horde \n";
  print "and the database user from www-data to hordemgr.  Please make \n";
  print "sure that your defaults.php3 file for horde and imp are set \n";
  print "properly if you are upgrading either.  MySql users will need \n";
  print "to be aware that this will happen to them once the conversion \n";
  print "has been written and tested.   \n\n";
  print "Also, if you have been using horde since prior to pre3-8 plase \n";
  print "make sure you have: \n\n";
  print "       php3_magic_quotes_gpc Off   \n";
  print "\nset in your /etc/apache/access.conf in the HORDE Directory statement\n\n";
  $foo = command_prompt('Press Return');
  print "\n";
  exit 0;
}

if ($module eq 'clean') {
  if ($have_apache eq 'yes') { clean($APACHE_PATH); }
  if ($have_apache_ssl eq 'yes') { clean($APACHE_SSL_PATH); }
  print "\n\n";
  exit 0;
}

print "Usage:  hordesetup modulename \n";        
print "\nModulenames are horde, imp, and skattek currently\n\n";  
exit 1;  
@


1.1.2.29
log
@[IEM] bring the debian stuff in line with the recent changes to phplib (ie,
caching)
@
text
@d19 1
a19 1
local( $MODULE_SCRIPTS_DIR )    = '/usr/share/doc/' . $ARGV[0] . '/examples';
a30 1
  $MODULE_SCRIPTS_DIR = '/usr/share/doc/horde-core/examples';
d412 2
a413 2
  $impmgr='impmgr';
  $impmgr_passwd='impmgr';
d500 2
a501 2
  $impmgr='impmgr';
  $impmgr_passwd='impmgr';
@


1.1.2.30
log
@[IEM] fixing php3.ini file scan issue..now checks more accuratly for the
loading of proper php3 modules.
@
text
@d7 1
a7 1
local( $HORDE_SETUP_VER )       = '2.6';
d12 1
a12 1
local( $PHPINI_PATH )           = '/etc/php3/apache/php3.ini';
d56 1
a56 1
print "\nHORDE Project Configurator - 2.6+ \n" . '-' x 33 . "\n\n";
d71 1
a71 1
sub config_php3_pgsql {
d74 7
a80 4
  system("if (grep 'extension' $PHPINI_PATH | grep 'imap.so'>/dev/null 2>&1); then (echo '    - imap extension o.k.'); else (echo 'extension=imap.so' >> $PHPINI_PATH && echo '    + imap extension added.'); fi ");
  system("if (grep 'extension' $PHPINI_PATH | grep 'ldap.so'>/dev/null 2>&1); then (echo '    - ldap extension o.k.'); else (echo 'extension=ldap.so' >> $PHPINI_PATH && echo '    + ldap extension added.'); fi ");
  system("if (grep 'extension' $PHPINI_PATH | grep 'pgsql.so'>/dev/null 2>&1); then (echo '    - pgsql extension o.k.'); else (echo 'extension=pgsql.so' >> $PHPINI_PATH && echo '    + pgsql extension added.'); fi ");
}
d82 1
a82 6
sub config_php3_mysql {

  print "* Verify PHP3 configuration files\n";
  system("if (grep 'extension' $PHPINI_PATH | grep 'imap.so'>/dev/null 2>&1); then (echo '    - imap extension o.k.'); else (echo 'extension=imap.so' >> $PHPINI_PATH && echo '    + imap extension added.'); fi ");
  system("if (grep 'extension' $PHPINI_PATH | grep 'ldap.so'>/dev/null 2>&1); then (echo '    - ldap extension o.k.'); else (echo 'extension=ldap.so' >> $PHPINI_PATH && echo '    + ldap extension added.'); fi ");
  system("if (grep 'extension' $PHPINI_PATH | grep 'mysql.so'>/dev/null 2>&1); then (echo '    - mysql extension o.k.'); else (echo 'extension=mysql.so' >> $PHPINI_PATH && echo '    + mysql extension added.'); fi ");
a84 1

d655 1
a662 2
  if ($dbtype eq "postgres") { config_php3_pgsql($APACHE_PATH); }
  if ($dbtype eq "mysql") { config_php3_mysql($APACHE_PATH); }
@


1.1.2.31
log
@[IEM] Preliminary changes for new configuration routines.  Trying to clean
up build process using new debconf option.  Getting rid of extra configuration
files for both postgres and mysql and will instead use a selection bit to
figure out what type of container the user will use and setup phplib and
horde related files on the fly based on choices.  (and upgrades after that
will use existing choices)  This sweep adds to files required by debconf
and specific to debconf working with horde.  horde.php3 and defaults.php3
will be build on the fly.  (really need to get rid of root_url and graphics_url
for the horde module and use the ones supplied in horde.php3 to cut down
on redundancy...adding to my todo)
@
text
@d7 1
a7 1
local( $HORDE_SETUP_VER )       = '3.1';
d56 1
a56 1
print "\nHORDE Project Configurator - 3.1+ \n" . '-' x 33 . "\n\n";
d66 1
a67 16
if ($module eq 'horde-clean') {
  system("cat $path/srm.conf | grep -v HORDE | grep -v horde > $path/srm.conf.tmp");
  system("cp $path/srm.conf $path/srm.conf.horde.save > /dev/null 2>&1");
  system("cp $path/srm.conf.tmp $path/srm.conf > /dev/null 2>&1");
}

if ($module eq 'imp-clean') {
 system("cat $path/srm.conf | grep -v IMP | grep -v imp> $path/srm.conf.tmp");      
 system("cp $path/srm.conf $path/srm.conf.imp.save > /dev/null 2>&1");      
 system("cp $path/srm.conf.tmp $path/srm.conf > /dev/null 2>&1");      
}

if ($module eq 'skattek-clean') {
 system("cat $path/srm.conf | grep -v SKATTEK | grep -v skattek > $path/srm.conf.tmp");      
 system("cp $path/srm.conf $path/srm.conf.skattek.save > /dev/null 2>&1");      
 system("cp $path/srm.conf.tmp $path/srm.conf > /dev/null 2>&1");      
a69 1
}
a87 16
sub config_postmaster {

  print "* Verify Postgresql configuration files\n";

  print "  + /etc/postgresql/postmaster.init \n";

  system("/bin/sed -e 's#\\# PGALLOWTCPIP=no#PGALLOWTCPIP=yes#;#\\# PGALLOWTCPIP=yes#PGALLOWTCPIP=yes#' /etc/postgresql/postmaster.init >/etc/postgresql/postmaster.init.tmp");
   system("cp /etc/postgresql/postmaster.init /etc/postgresql/postmaster.init.horde.back > /dev/null 2>&1"); 
   system("if (grep 'PGALLOWTCPIP=yes' /etc/postgresql/postmaster.init.tmp >/dev/null 2>&1); then (mv /etc/postgresql/postmaster.init.tmp /etc/postgresql/postmaster.init > /dev/null 2>&1); fi");

  print "  + Restarting Postgresql\n";
  system("/etc/init.d/postgresql reload > /dev/null 2>&1");

}


d94 2
a95 8
   print "  + $path/httpd.conf  (Verifying php3 is being loaded as a module)\n";

   system("/bin/sed -e 's#\\# LoadModule php3_module#LoadModule php3_module#' $path/httpd.conf >$path/httpd.conf.tmp");
   system("cp $path/httpd.conf $path/httpd.conf.horde.back > /dev/null 2>&1");
   system("if (grep 'php3_module' $path/httpd.conf.tmp >/dev/null 2>&1); then (mv $path/httpd.conf.tmp $path/httpd.conf); fi");

   print "  + $path/access.conf (Verifying Horde Specific Directories)\n";
   system("if (grep '$APACHE_LINE' $path/access.conf >/dev/null 2>&1); then (echo '    - horde directory should be o.k.'); else (echo ' ' >> $path/access.conf && echo '# $APACHE_LINE' >> $path/access.conf && echo '<Directory $HORDE_DIR>' >> $path/access.conf && echo 'Options Indexes FollowSymLinks' >> $path/access.conf && echo 'AllowOverride None' >> $path/access.conf && echo 'order allow,deny' >> $path/access.conf && echo 'allow from all' >> $path/access.conf && echo 'php3_include_path $HORDE_CONFIG_DIR:$PHPLIB_DIR' >> $path/access.conf && echo 'php3_auto_prepend_file $PREPEND_FILE' >> $path/access.conf && echo 'php3_magic_quotes_gpc Off' >> $path/access.conf && echo '</Directory>' >> $path/access.conf && echo '# End HORDE Configuration Block' >> $path/access.conf && echo '    + horde directory added.'); fi");
d99 1
a99 1
    print "  + $path/srm.conf  (Verifying Horde Related Aliases)\n";
d248 2
a249 2
  system("su - postgres -c '$MODULE_SCRIPTS_DIR/pgsql_cuser.sh $db_pass >/dev/null 2>&1'");
  system("su - postgres -c '/usr/bin/psql template1 -c \"$PSQL_QUERY\" >/dev/null 2>&1'");
d264 1
a264 1
  if (!(system("$com2$db_owner$com4$com1$com3$MODULE_TABLE >/dev/null 2>&1")))
d266 2
a268 2
  } else {
    return('false');
d276 1
a276 2
  $dbok = check_horde_db('horde');
  if ($dbok eq "false") {
d278 1
a278 2
    $db2ok = check_horde_db('imp');
    if ($db2ok eq "true") {
d287 1
a287 1
    system("su - postgres -c '/usr/bin/psql template1 -c \"$PSQL2_QUERY\" >/dev/null 2>&1'");
d513 2
a514 2
/* true = put the compose window in the main frame; false = use a popup window for compose windows */
\$default->minimum_popups = false;
d544 1
a544 1
\$default->drafts                    = 'drafts';
a586 4
/* poppasswd support */
\$default->poppassd_server           = '/dev/null';
\$default->poppassd_port             = '0';

d658 1
d661 1
a661 1
  
d665 2
a666 4
  if (($dbtype eq "postgres") && ($have_apache eq 'yes')) { config_php3_pgsql($APACHE_PATH); }
  if (($dbtype eq "mysql") && ($have_apache eq 'yes')) { config_php3_mysql($APACHE_PATH); }
  if (($dbtype eq "postgres") && ($have_apache_ssl eq 'yes')) { config_php3_pgsql($APCHE_SSL_PATH); }                                 
  if (($dbtype eq "mysql") && ($have_apache_ssl eq 'yes')) { config_php3_mysql($APACHE_SSL_PATH); }  
d668 1
a668 3
  if ($module eq 'horde') {
    if ($dbtype eq "postgres") { config_postmaster(); }
  }
a734 2
  print "\n   NOTE: READ /usr/share/doc/horde-core/README.Debian !!! \n\n";

d740 1
a740 1
if ( ($module eq 'horde-clean') || ($module eq 'imp-clean') || ($module eq 'skattek-clean') || ($module eq 'clean') ) {
@


1.1.2.32
log
@[IEM] final touches to the debconf changes.  Now horde is tied into
debocnf so that one will have a one time config option (ala debconf)...now
to finish up the none install configure script that will interact with
debconf...

(2 weeks +/- away from Debian 2.2 freeze)
@
text
@d7 1
a7 1
local( $HORDE_SETUP_VER )       = '3.2';
d29 7
d42 7
d56 1
a56 1
print "\nHORDE Project Configurator - 3.2+ \n" . '-' x 33 . "\n\n";
d79 38
d125 11
d216 1
d219 7
d352 180
d707 9
d728 6
d770 16
@


1.1.2.33
log
@[IEM] more tweaks...fixing some problems with horde_phplib.inc configuration
@
text
@@


