Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 230191 Details for
Bug 287241
fedora-ds-base update breaks previous installs
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
upgrade11.pl - upgrade script
upgrade11.pl (text/plain), 3.66 KB, created by
Rich Megginson
on 2007-10-17 18:39:18 UTC
(
hide
)
Description:
upgrade11.pl - upgrade script
Filename:
MIME Type:
Creator:
Rich Megginson
Created:
2007-10-17 18:39:18 UTC
Size:
3.66 KB
patch
obsolete
>#!/usr/bin/env perl > ># load perldap >use Mozilla::LDAP::Conn; >use Mozilla::LDAP::Utils qw(normalizeDN); >use Mozilla::LDAP::API qw(ldap_explode_dn); >use Mozilla::LDAP::LDIF; > >use Carp; > >use strict; > >my @oldinstances = glob("/etc/fedora-ds/slapd-*"); > >if (!@oldinstances) { > print "You have no old instances in /etc/fedora-ds to upgrade\n"; > exit 1; >} > ># first, upgrade config files > >for (@oldinstances) { > my $instdir = $_; > my $newinst = $instdir; > $newinst =~ s/fedora-ds/dirsrv/; > > if (-d $newinst) { > print "There is already a new instance directory $newinst - skipping\n"; > next; > } > # just move the directory > rename $instdir, $newinst; > > # next, fix the dse.ldif > my $newdse = "$newinst/dse.ldif"; > # save properties of old dse to apply to new one > my ($dev, $ino, $mode, $nlink, $uid, $gid, @rest) = stat $newdse; > open( MYLDIF, "$newdse" ) || confess "Can't open dse.ldif $newdse: $!"; > my $in = new Mozilla::LDAP::LDIF(*MYLDIF); > my @entries = (); > my $ent; > while ($ent = readOneEntry $in) { > foreach my $attr (keys %{$ent}) { > my @vals = $ent->getValues($attr); > # we're only concerned about paths that contain fedora-ds > map { s,/fedora-ds/,/dirsrv/,g } @vals; > map { s,fedora-ds/,dirsrv/,g } @vals; > map { s,/fedora-ds,/dirsrv,g } @vals; > $ent->setValues($attr, @vals); > } > push @entries, $ent; > } > close( MYLDIF ); > > # write out changes > open( MYLDIF, ">$newdse" ) || confess "Can't write new dse.ldif $newdse: $!"; > for $ent (@entries) { > if (!$ent->getDN()) { # rootDSE requires special hack around perldap bug > my $ary = $ent->getLDIFrecords(); > shift @$ary; # remove "dn" > shift @$ary; # remove the empty dn value > print MYLDIF "dn:\n"; > print MYLDIF (Mozilla::LDAP::LDIF::pack_LDIF (78, $ary), "\n"); > } else { > Mozilla::LDAP::LDIF::put_LDIF(\*MYLDIF, 78, $ent); > } > } > close( MYLDIF ); > chown $uid, $gid, $newdse; > chmod $mode, $newdse; >} > ># next, move/rename the other instance specific directories >for my $dir (qw(/var/log/fedora-ds /var/lock/fedora-ds /var/run/fedora-ds /var/tmp/fedora-ds /var/lib/fedora-ds)) { > my $newdir = $dir; > $newdir =~ s/fedora-ds/dirsrv/; > rename $dir, $newdir; >} > ># next, move the script instance dir >my $instdir = "/usr/lib64/fedora-ds"; >if (! -d $instdir) { > $instdir = "/usr/lib/fedora-ds"; >} > >@oldinstances = glob("$instdir/slapd-*"); >for (@oldinstances) { > $instdir = $_; > my $newinst = $instdir; > $newinst =~ s/fedora-ds/dirsrv/; > > if (-d $newinst) { > print "There is already a new instance directory $newinst - skipping\n"; > next; > } > # just move the directory > rename $instdir, $newinst; > > # next, fix all of the scripts > for my $script (glob("$newinst/*")) { > # save properties of old script to apply to new one > my ($dev, $ino, $mode, $nlink, $uid, $gid, @rest) = stat $script; > my @lines; > my $line; > open MYSCRIPT, $script or confess "Can't open script $script: $!"; > while ($line = <MYSCRIPT>) { > $line =~ s,/fedora-ds/,/dirsrv/,g; > $line =~ s,fedora-ds/,dirsrv/,g; > $line =~ s,/fedora-ds,/dirsrv,g; > push @lines, $line; > } > close MYSCRIPT; > > open MYSCRIPT, ">$script" or confess "Can't write script $script: $!"; > for $line (@lines) { > print MYSCRIPT $line; > } > close MYSCRIPT; > chown $uid, $gid, $script; > chmod $mode, $script; > } >} > >print "Done. Type 'service dirsrv start' to start your servers.\n";
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 287241
: 230191