[pkg-kolab] r95 - trunk/kolabd/debian/patches
Noel Koethe
noel at costa.debian.org
Wed Jan 4 17:28:50 UTC 2006
Author: noel
Date: 2006-01-04 17:28:49 +0000 (Wed, 04 Jan 2006)
New Revision: 95
Added:
trunk/kolabd/debian/patches/30-bootstrap.dpatch
Modified:
trunk/kolabd/debian/patches/00list
Log:
patch bootstrap to get it running on Debian; just the first change of paths, need to be changed better like remove all the absolute paths
Modified: trunk/kolabd/debian/patches/00list
===================================================================
--- trunk/kolabd/debian/patches/00list 2006-01-04 17:23:22 UTC (rev 94)
+++ trunk/kolabd/debian/patches/00list 2006-01-04 17:28:49 UTC (rev 95)
@@ -1,2 +1,3 @@
10-perl-path-fixes
20-kolabquotawarn-issue851
+30-bootstrap.dpatch
Added: trunk/kolabd/debian/patches/30-bootstrap.dpatch
===================================================================
--- trunk/kolabd/debian/patches/30-bootstrap.dpatch 2006-01-04 17:23:22 UTC (rev 94)
+++ trunk/kolabd/debian/patches/30-bootstrap.dpatch 2006-01-04 17:28:49 UTC (rev 95)
@@ -0,0 +1,366 @@
+#!/bin/sh -e
+## 30-bootstrap.dpatch by Noèl Köthe <noel at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: This is the patch from the rpm
+
+if [ $# -lt 1 ]; then
+echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
+
+case "$1" in
+ -patch) patch $patch_opts -p1 < $0;;
+ -unpatch) patch $patch_opts -p1 -R < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1;;
+esac
+
+exit 0
+
+ at DPATCH@
+--- kolabd-1.9.4/kolab_bootstrap.orig 2006-01-04 16:46:52.000000000 +0100
++++ kolabd-1.9.4/kolab_bootstrap 2006-01-04 18:23:40.000000000 +0100
+@@ -76,7 +76,7 @@
+ print ("Error: Found $name running on Port $port\n");
+ print ("Check your installation!\n");
+ print ("You must stop the service $name before running Kolab\n");
+- print ("You may try to execute \"$kolab_prefix/bin/openpkg rc all stop\" initially\n");
++ print ("You may try to execute \"/etc/init.d/\$DAEMON stop\" initially\n");
+ exit 1;
+ }
+ }
+@@ -84,7 +84,7 @@
+ # Hash a password
+ sub hashPassword {
+ my $pw = shift;
+- my $hashcmd = $kolab_prefix."/sbin/slappasswd -s '".$pw."'";
++ my $hashcmd = $kolab_prefix."/usr/sbin/slappasswd -s '".$pw."'";
+ (my $hashpw = `$hashcmd`) or die $@;
+ chomp($hashpw);
+ return $hashpw;
+@@ -190,7 +190,7 @@
+
+ print ("Excellent all required Ports are available!\n");
+
+-system($kolab_prefix."/sbin/slapcat >/dev/null 2>&1");
++system($kolab_prefix."/usr/sbin/slapcat >/dev/null 2>&1");
+ if ($?==0) {
+ print ("\nFound existing configuration\n");
+ print "\nBootstrapping Kolab will overwrite old configuration\n";
+@@ -204,21 +204,21 @@
+ my $backupdir=$kolab_prefix."/etc/kolab/backup".$epochseconds;
+ mkdir($backupdir,0700) || die "cannot mkdir : $!";
+ print "creating backup of LDAP repository\n";
+- system("cp -pRP ".$kolab_prefix."/var/openldap/openldap-data/ ".$backupdir."/openldap-data");
+- system("rm -f ".$kolab_prefix."/var/openldap/openldap-data/*");
++ system("cp -pRP ".$kolab_prefix."/var/lib/ldap/ ".$backupdir."/ldap-data");
++ system("rm -f ".$kolab_prefix."/var/lib/ldap/*");
+ print "creating backup of CA data\n";
+ system("mv ".$kolab_prefix."/etc/kolab/ca ".$backupdir);
+ system("mv ".$kolab_prefix."/etc/kolab/*.pem ".$backupdir);
+ system("mv $kolab_config $backupdir");
+ print "Cleaning up LDAP\n";
+- system("rm -f ".$kolab_prefix."/var/openldap/openldap-data/*");
++ system("rm -f ".$kolab_prefix."/var/lib/ldap/*");
+ } else {
+ print "LDAP repository is empty - assuming fresh install\n";
+ }
+
+
+ # fetch fresh template
+-copy($kolab_prefix."/etc/kolab/templates/kolab.conf.template", $kolab_config);
++copy($kolab_prefix."/usr/share/doc/kolabd/templates/kolab.conf.template", $kolab_config);
+
+ my $fd = IO::File->new($kolab_config, "r")
+ || die "could not open $kolab_config";
+@@ -302,7 +302,7 @@
+ print " bind_dn : $bind_dn\n";
+ }
+ if ($bind_pw =~ /\@\@\@/) {
+- $bind_pw = `$kolab_prefix/bin/openssl rand -base64 12`;
++ $bind_pw = `/usr/bin/openssl rand -base64 12`;
+ chomp $bind_pw;
+ $bind_pw = getUserInput("Please choose a manager password", $bind_pw);
+ print " bind_pw : $bind_pw\n";
+@@ -314,7 +314,7 @@
+ $php_dn =~ s/\@\@\@kolab_basedn\@\@\@/$base_dn/g;
+ }
+ if ($php_pw =~ /\@\@\@/) {
+- $php_pw = `$kolab_prefix/bin/openssl rand -base64 30`;
++ $php_pw = `/usr/bin/openssl rand -base64 30`;
+ chomp $php_pw;
+ }
+ if ($calendar_dn =~ /\@\@\@/) {
+@@ -322,7 +322,7 @@
+ chomp $calendar_dn;
+ }
+ if ($calendar_pw =~ /\@\@\@/) {
+- $calendar_pw = `$kolab_prefix/bin/openssl rand -base64 30`;
++ $calendar_pw = `/usr/bin/openssl rand -base64 30`;
+ chomp $calendar_pw;
+ }
+
+@@ -342,7 +342,7 @@
+ undef $fd;
+ print "done modifying $kolab_config\n\n";
+ chmod 0600, $kolab_config;
+- kolab_chown "@l_musr@","@l_mgrp@",$kolab_config;
++ kolab_chown "kolab","kolab",$kolab_config;
+ print "IMPORTANT NOTE:\n";
+ print "use login=manager and passwd=$bind_pw when you log into the webinterface!\n\n";
+ }
+@@ -361,8 +361,8 @@
+ }
+ };
+
+- my $confname = "$kolab_prefix/etc/sasl/apps/smtpd.conf";
+- copy("$kolab_prefix/etc/kolab/templates/smtpd.conf.template", $confname) || die "could not write to $confname";
++ my $confname = "/etc/postfix/sasl/smtpd.conf";
++ copy("/usr/share/doc/kolabd/templates/smtpd.conf.template", $confname) || die "could not write to $confname";
+
+ getopts('b');
+
+@@ -386,9 +386,9 @@
+ }
+
+ # Creating slapd.conf from template
+- my $tmpl = IO::File->new("$kolab_prefix/etc/kolab/templates/slapd.conf.template", "r") || die "could not read $kolab_prefix/etc/kolab/templates/slapd.conf.template";
+- my $slpd = IO::File->new("$kolab_prefix/etc/openldap/slapd.conf","w+") || die "could not write to $kolab_prefix/etc/openldap/slapd.conf";
+- chmod (0640,"$kolab_prefix/etc/openldap/slapd.conf");
++ my $tmpl = IO::File->new("/usr/share/doc/kolabd/templates/slapd.conf.template", "r") || die "could not read /usr/share/doc/kolabd/templates/slapd.conf.template";
++ my $slpd = IO::File->new("/etc/ldap/slapd.conf","w+") || die "could not write to /etc/ldap/slapd.conf";
++ chmod (0640,"/etc/ldap/slapd.conf");
+ foreach (<$tmpl>) {
+ s/\@\@\@base_dn\@\@\@/$base_dn/g;
+ s/\@\@\@bind_dn\@\@\@/$bind_dn/g;
+@@ -399,13 +399,13 @@
+ undef $slpd;
+ undef $tmpl;
+
+- $confname = "$kolab_prefix/etc/openldap/slapd.replicas";
+- copy( "$kolab_prefix/etc/kolab/templates/slapd.replicas.template", $confname ) || die "Could not write $confname";
++ $confname = "/etc/ldap/slapd.replicas";
++ copy( "/usr/share/doc/kolabd/templates/slapd.replicas.template", $confname ) || die "Could not write $confname";
+ chmod (0640,$confname );
+ # now we must startup slapd
+ print "temporarily starting slapd\n";
+ $ldap_uri = "ldap://127.0.0.1:389/";
+- (system("$kolab_prefix/libexec/openldap/slapd -h ldap://127.0.0.1:389/ -f $kolab_prefix/etc/openldap/slapd.conf") == 0 ) || die( "Could not start temporary slapd" );
++ (system("/usr/sbin/slapd -h ldap://127.0.0.1:389/ -f $kolab_prefix/etc/ldap/slapd.conf") == 0 ) || die( "Could not start temporary slapd" );
+ print ("Waiting for OpenLDAP to start\n");
+ sleep 10;
+
+@@ -537,27 +537,27 @@
+ print "Create initial config files for postfix, apache, proftpd, cyrus imap, saslauthd\n";
+
+ my $cfg;
+- open(FH, "<$kolab_prefix/etc/rc.conf") || die;
++ open(FH, "</etc/kolab/rc.conf") || die;
+ $cfg .= $_ while (<FH>);
+ close(FH);
+
+ $cfg =~ s/\n((openldap_url|sasl_authmech)\S*=[^\n]*)/#$1\n/sg;
+ $cfg .= "openldap_url=\"ldap:// ldaps://\"\nsasl_authmech=\"ldap\"\n";
+
+- open(FH, ">$kolab_prefix/etc/rc.conf") || die;
++ open(FH, ">/etc/kolab/rc.conf") || die;
+ print FH $cfg;
+ close(FH);
+ undef $cfg;
+
+ #print " running $kolab_prefix/etc/kolab/kolab -v -o -l$ldap_uri\n";
+- print "running $kolab_prefix/sbin/kolabconf -n\n";
++ print "running /usr/sbin/kolabconf -n\n";
+
+ #system("$kolab_prefix/etc/kolab/kolab -v -o -l$ldap_uri");
+- system("$kolab_prefix/sbin/kolabconf -n");
++ system("/usr/sbin/kolabconf -n");
+
+ if ($ldap_uri =~ /127\.0\.0\.1/ || $ldap_uri =~ /localhost/) {
+ print "\nkill temporary slapd\n\n";
+- system("$kolab_prefix/etc/rc openldap stop");
++ system("/etc/init.d/sldap stop");
+ sleep 5;
+ system("killall -9 slapd >/dev/null 2>&1");
+ }
+@@ -565,8 +565,8 @@
+
+ # Create key-pair for resource password encryption
+ # if they dont exist already
+- my $pubreskey = "$kolab_prefix/etc/kolab/res_pub.pem";
+- my $privreskey = "$kolab_prefix/etc/kolab/res_priv.pem";
++ my $pubreskey = "/etc/kolab/res_pub.pem";
++ my $privreskey = "/etc/kolab/res_priv.pem";
+ if( ! -e $pubreskey || ! -e $privreskey ) {
+ my $oldmask = umask 0077;
+ #print "Creating DSA keypair for resource password encryption\n";
+@@ -574,9 +574,9 @@
+ #system("/kolab/bin/openssl gendsa -out $privreskey dsa-params");
+ #system("/kolab/bin/openssl dsa -in $privreskey -pubout -out $pubreskey");
+ print "Creating RSA keypair for resource password encryption\n";
+- kolab_system("/kolab/bin/openssl genrsa -out $privreskey 1024");
+- kolab_system("/kolab/bin/openssl rsa -in $privreskey -pubout -out $pubreskey");
+- kolab_system("chown @l_musr@:@l_ngrp@ $pubreskey $privreskey");
++ kolab_system("/usr/bin/openssl genrsa -out $privreskey 1024");
++ kolab_system("/usr/bin/openssl rsa -in $privreskey -pubout -out $pubreskey");
++ kolab_system("chown kolab:kolab $pubreskey $privreskey");
+ chmod 0660, $privreskey, $pubreskey;
+ #unlink( "dsa-params" );
+ umask $oldmask;
+@@ -603,14 +603,14 @@
+ certificate. You will be prompted for a passphrase for the CA.
+ ################################################################################
+ EOS
+- kolab_system("$kolab_prefix/etc/kolab/kolab_ca.sh -newca $fqdn");
+- kolab_system("$kolab_prefix/etc/kolab/kolab_ca.sh -newkey $fqdn $kolab_prefix/etc/kolab/key.pem");
+- kolab_system("$kolab_prefix/etc/kolab/kolab_ca.sh -newreq $fqdn $kolab_prefix/etc/kolab/key.pem $kolab_prefix/etc/kolab/newreq.pem ");
+- kolab_system("$kolab_prefix/etc/kolab/kolab_ca.sh -sign $kolab_prefix/etc/kolab/newreq.pem $kolab_prefix/etc/kolab/cert.pem");
+- kolab_system("chgrp @l_rusr@ $kolab_prefix/etc/kolab/key.pem;");
+- kolab_system("chmod 0640 $kolab_prefix/etc/kolab/key.pem;");
+- kolab_system("chgrp @l_rusr@ $kolab_prefix/etc/kolab/cert.pem;");
+- kolab_system("chmod 0640 $kolab_prefix/etc/kolab/cert.pem;");
++ kolab_system("/usr/sbin/kolab_ca.sh -newca $fqdn");
++ kolab_system("/usr/sbin/kolab_ca.sh -newkey $fqdn /etc/kolab/key.pem");
++ kolab_system("/usr/sbin/kolab_ca.sh -newreq $fqdn /etc/kolab/key.pem /etc/kolab/newreq.pem ");
++ kolab_system("/usr/sbin/kolab_ca.sh -sign /etc/kolab/newreq.pem /etc/kolab/cert.pem");
++ kolab_system("chgrp kolab-r /etc/kolab/key.pem;");
++ kolab_system("chmod 0640 /etc/kolab/key.pem;");
++ kolab_system("chgrp kolab-r /etc/kolab/cert.pem;");
++ kolab_system("chmod 0640 /etc/kolab/cert.pem;");
+ print <<'EOS';
+ ################################################################################
+ CA and certificate creation complete.
+@@ -624,9 +624,9 @@
+ ##### Slave server setup
+
+ print "stop running slapd (if any)\n";
+- kolab_system("$kolab_prefix/bin/openpkg rc openldap stop");
++ kolab_system("/etc/init.d/slapd stop");
+ sleep 1;
+- kolab_system("$kolab_prefix/bin/openpkg rc openldap stop");
++ kolab_system("/etc/init.d/slapd stop");
+ sleep 1;
+
+ # Make sure that no rogue demons are running
+@@ -657,8 +657,8 @@
+ $bind_pw = getUserInput("Manager password");
+ $bind_pw_hash = hashPassword($bind_pw);
+
+- my $confname = "$kolab_prefix/etc/sasl/apps/smtpd.conf";
+- copy("$kolab_prefix/etc/kolab/templates/smtpd.conf.template", $confname) || die "could not write to $confname";
++ my $confname = "/etc/postfix/sasl/smtpd.conf";
++ copy("/usr/share/doc/kolabd/templates/smtpd.conf.template", $confname) || die "could not write to $confname";
+
+ print "Checking server info...\n";
+ my $ldap = Net::LDAP->new($ldap_uri, verify => 'none', onerror => 'undef' );
+@@ -709,7 +709,7 @@
+ my $master_host = $ldapuri->host();
+
+ print "Reading nobody and calendar passwords from master, please type in master's root-password when asked\n";
+- open( CONF, "ssh -C $master_host 'cat $kolab_prefix/etc/kolab/kolab.conf'|");
++ open( CONF, "ssh -C $master_host 'cat /etc/kolab/kolab.conf'|");
+ my $conf;
+ $conf .= $_ while(<CONF>);
+ close(CONF);
+@@ -737,20 +737,20 @@
+ undef $fd;
+ print "done modifying $kolab_config\n\n";
+ chmod 0600, $kolab_config;
+- kolab_chown "@l_musr@","@l_mgrp@",$kolab_config;
++ kolab_chown "kolab","kolab",$kolab_config;
+
+ print << 'EOS';
+ Now the master server needs to be stopped briefly while the contents of the LDAP database
+ is copied over to this slave. Please make sure that this slave is entered into the list
+ of kolabhosts on the master before proceeding.
+ EOS
+- kolab_system("ssh -CA $master_host $kolab_prefix/bin/openpkg rc openldap stop");
+- kolab_system("ssh -CA $master_host $kolab_prefix/lib/openpkg/tar -C $kolab_prefix/var/openldap -pcf - openldap-data | $kolab_prefix/lib/openpkg/tar -C $kolab_prefix/var/openldap -pxf -");
+- kolab_system("ssh -CA $master_host $kolab_prefix/bin/openpkg rc openldap start");
++ kolab_system("ssh -CA $master_host /etc/init.d/slapd stop");
++ kolab_system("ssh -CA $master_host /bin/tar -C /var/lib/ -pcf - ldap | /bin/tar -C /var/lib/ -pxf -");
++ kolab_system("ssh -CA $master_host /etc/init.d/slapd start");
+
+ print "Updating configuration, please ignore any initial errors from kolabconf\n\n";
+ my $cfg;
+- open(FH, "<$kolab_prefix/etc/rc.conf") || die;
++ open(FH, "</etc/kolab/rc.conf") || die;
+ $cfg .= $_ while (<FH>);
+ close(FH);
+
+@@ -758,7 +758,7 @@
+ # $cfg .= "openldap_enable=\"no\"\nopenldap_url=\"\"\nsasl_authmech=\"ldap\"\n";
+ $cfg .= "\nopenldap_url=\"ldap:// ldaps://\"\nsasl_authmech=\"ldap\"\n";
+
+- open(FH, ">$kolab_prefix/etc/rc.conf") || die;
++ open(FH, ">/etc/kolab/rc.conf") || die;
+ print FH $cfg;
+ close(FH);
+ undef $cfg;
+@@ -788,18 +788,18 @@
+ EOS
+
+ # Create cert req
+- kolab_system("$kolab_prefix/etc/kolab/kolab_ca.sh -newkey $fqdn $kolab_prefix/etc/kolab/key.pem");
+- kolab_system("$kolab_prefix/etc/kolab/kolab_ca.sh -newreq $fqdn $kolab_prefix/etc/kolab/key.pem $kolab_prefix/etc/kolab/newreq.pem ");
++ kolab_system("/usr/sbin/kolab_ca.sh -newkey $fqdn /etc/kolab/key.pem");
++ kolab_system("/usr/sbin/kolab_ca.sh -newreq $fqdn /etc/kolab/key.pem /etc/kolab/newreq.pem ");
+ # Log into master and sign cert request
+- kolab_system("scp $kolab_prefix/etc/kolab/newreq.pem $master_host:$kolab_prefix/etc/kolab/$fqdn-req.pem");
+- kolab_system("ssh -CA $master_host \"$kolab_prefix/etc/kolab/kolab_ca.sh -sign $kolab_prefix/etc/kolab/$fqdn-req.pem $kolab_prefix/etc/kolab/$fqdn.pem;\"");
+- kolab_system("scp $master_host:$kolab_prefix/etc/kolab/$fqdn.pem $kolab_prefix/etc/kolab/cert.pem");
+- kolab_system("ssh -CA $master_host \"rm $kolab_prefix/etc/kolab/$fqdn.pem $kolab_prefix/etc/kolab/$fqdn-req.pem\"");
+- die("Creation of $kolab_prefix/etc/kolab/cert.pem failed") unless -f "$kolab_prefix/etc/kolab/cert.pem";
+- kolab_system("chgrp @l_rgrp@ $kolab_prefix/etc/kolab/key.pem;");
+- kolab_system("chmod 0640 $kolab_prefix/etc/kolab/key.pem;");
+- kolab_system("chgrp @l_rgrp@ $kolab_prefix/etc/kolab/cert.pem;");
+- kolab_system("chmod 0640 $kolab_prefix/etc/kolab/cert.pem;");
++ kolab_system("scp /etc/kolab/newreq.pem $master_host:/etc/kolab/$fqdn-req.pem");
++ kolab_system("ssh -CA $master_host \"/usr/sbin/kolab_ca.sh -sign /etc/kolab/$fqdn-req.pem /etc/kolab/$fqdn.pem;\"");
++ kolab_system("scp $master_host:/etc/kolab/$fqdn.pem /etc/kolab/cert.pem");
++ kolab_system("ssh -CA $master_host \"rm /etc/kolab/$fqdn.pem /etc/kolab/$fqdn-req.pem\"");
++ die("Creation of /etc/kolab/cert.pem failed") unless -f "/etc/kolab/cert.pem";
++ kolab_system("chgrp kolab /etc/kolab/key.pem;");
++ kolab_system("chmod 0640 /etc/kolab/key.pem;");
++ kolab_system("chgrp kolab-r /etc/kolab/cert.pem;");
++ kolab_system("chmod 0640 /etc/kolab/cert.pem;");
+
+ print <<'EOS';
+ ################################################################################
+@@ -812,14 +812,14 @@
+ To be able to encrypt and decrypt passwords for group and resource accounts
+ we need to copy the RSA keypair used for that purpose from the master server.
+ EOS
+- my $privreskey = "$kolab_prefix/etc/kolab/res_priv.pem";
+- my $pubreskey = "$kolab_prefix/etc/kolab/res_pub.pem";
++ my $privreskey = "/etc/kolab/res_priv.pem";
++ my $pubreskey = "/etc/kolab/res_pub.pem";
+ kolab_system("scp $master_host:$privreskey "
+ ."$master_host:$pubreskey "
+- ."$kolab_prefix/etc/kolab/");
+- kolab_system("chown @l_musr@:@l_ngrp@ $pubreskey $privreskey");
++ ."/etc/kolab/");
++ kolab_system("chown kolab:kolab-n $pubreskey $privreskey");
+ chmod 0660, $privreskey, $pubreskey;
+- kolab_system("$kolab_prefix/sbin/kolabconf -n");
++ kolab_system("/usr/sbin/kolabconf -n");
+
+ $fd = IO::File->new($kolab_config, "w+") || die "could not open $kolab_config";
+ print $fd "fqdnhostname : $fqdn\n";
+@@ -838,8 +838,9 @@
+ chmod 0600, $kolab_config;
+ }
+
+-#system("$kolab_prefix/etc/kolab/kolab_sslcert.sh $fqdn");
++#system("/usr/sbin/kolab_sslcert $fqdn");
+ print "kolab is now ready to run!\n";
+-print "please run '$kolab_prefix/bin/openpkg rc all start'\n";
++print "please run '/etc/init.d/$DAEMONs start'\n";
+ print ("Use login=manager and passwd=$bind_pw when you log into\n");
+ print ("the webinterface https://$fqdn/admin !\n");
++
Property changes on: trunk/kolabd/debian/patches/30-bootstrap.dpatch
___________________________________________________________________
Name: svn:executable
+ *
More information about the pkg-kolab-devel
mailing list