Masato Taruishi
taru****@users*****
2004年 10月 31日 (日) 21:55:57 JST
=================================================================== RCS file: ultrapossum/tools/ultramigration,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- ultrapossum/tools/ultramigration 2004/06/16 05:02:43 1.8 +++ ultrapossum/tools/ultramigration 2004/10/31 12:55:57 1.9 @@ -55,12 +55,7 @@ } my ( $tmpfh, $tmp ) = tempfile(); -my ( $conffh, $conf ) = tempfile(); -my ( $addfh, $add ) = tempfile(); -my ( $modfh, $mod ) = tempfile(); - -close( $addfh ); -close( $modfh ); +my ( $dirfh, $dirtmp ) = tempfile(); my ( $master, $suffix, $rootdn, $rootpw ); @@ -86,72 +81,6 @@ print STDERR "master: $master, suffix: $suffix, rootdn: $rootdn\n"; -print $conffh <<EOF; -[global] -ldaphost: $master -ldapport: 389 -rootdn: $rootdn -rootpw: $rootpw -modfile: $mod -addfile: $add -onlineupdate: no -offlineupdate: yes -onlineerrfatal: yes -plugin: no -#pluginfile: /usr/local/src/ldapdiff-0.7.0/plugins/ldapskeleton.so -pluginfile: no -pluginfunction: ldifskeleton -iconv: yes -ldifcharset: ISO-8859-1 -ldapcharset: UTF-8 -schemacheck: yes -schemabase: cn=subschema -schemafilter: objectClass=* -schemaattribute: attributetypes -schemahack: yes - -[ou] -basedn: $suffix -filter: ou -group: objectClass=organizationalUnit -ignore: none -multi: none -noequality: none -mapalias: none=none -deleteentry: no -deleteattribute: no -profilebasedn: none - -[passwd] -basedn: ou=People,$suffix -filter: uid -group: objectClass=posixAccount -ignore: none -multi: none -noequality: none -mapalias: none=none -deleteentry: no -deleteattribute: no -basedn: none -profilebasedn: none - -[group] -basedn: ou=Group,$suffix -filter: cn -group: objectClass=posixGroup -ignore: none -multi: none -noequality: none -mapalias: none=none -deleteentry: no -deleteattribute: no -basedn: none -profilebasedn: none - -EOF - -close( $conffh ); - print $tmpfh <<EOF; dn: ou=People,$suffix objectClass: organizationalUnit @@ -162,25 +91,17 @@ ou: Group EOF -close( $tmpfh ); - -sub modify -{ - system( "cat $add | ldapadd -x -h $master -D $rootdn -w $rootpw" ) == 0 or die; - system( "cat $mod | ldapmodify -x -h $master -D $rootdn -w $rootpw" ) == 0 or die; -} -system( "ldapdiff -f $tmp -p ou -c $conf" ) == 0 or die "ldapdiff error\n"; -modify(); +close( $tmpfh ); +close( $dirfh ); chdir "/usr/share/migrationtools"; $ENV{LDAP_BASEDN} = $suffix; +system( "./migrate_passwd.pl /etc/passwd >> $tmp ") == 0 or die; +system( "./migrate_group.pl /etc/group >> $tmp" ) == 0 or die; -system( "./migrate_passwd.pl /etc/passwd > $tmp ") == 0 or die; -system( "ldapdiff -f $tmp -p passwd -c $conf" ) == 0 or die; -modify(); - -system( "./migrate_group.pl /etc/group > $tmp" ) == 0 or die; -system( "ldapdiff -f $tmp -p group -c $conf") == 0 or die; -modify(); +system( "ldapsearch -x -D $rootdn -w $rootpw -h $master -b ou=People,$suffix -LLL > $dirtmp" ); +system( "ldapsearch -x -D $rootdn -w $rootpw -h $master -b ou=Group,$suffix -LLL >> $dirtmp" ); +#system( "cat $dirtmp 1>&2 "); +system( "ldifdiff $dirtmp $tmp | ldapmodify -x -h $master -D $rootdn -w $rootpw" );