2006-12-25 23:10:49 by steve
Copy the group memberships too.
This commit is contained in:
parent
7fd127d79c
commit
52a4dca26e
@ -58,6 +58,12 @@ foreach my $account ( sort keys( %host ) )
|
||||
{
|
||||
print "Adding: $account\n";
|
||||
addAccount( $account );
|
||||
|
||||
#
|
||||
# Find any groups the user is member of on the host
|
||||
# and add them on the guest system
|
||||
#
|
||||
addGroups( $account );
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,3 +148,30 @@ sub addAccount
|
||||
}
|
||||
close( SHADOW );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Find the groups a user is member of on the host, and add them to
|
||||
# those groups on the new guest.
|
||||
#
|
||||
sub addGroups
|
||||
{
|
||||
my( $username ) = ( @_ );
|
||||
|
||||
#
|
||||
# Get the groups.
|
||||
#
|
||||
my $groups = `groups $username`;
|
||||
# split off the usernmame.
|
||||
if ( $groups =~ /^([^:]+):(.*)/ )
|
||||
{
|
||||
$groups = $2;
|
||||
print "User: $username is member of the groups: $groups\n";
|
||||
}
|
||||
|
||||
foreach my $g ( split( / /, $groups ) )
|
||||
{
|
||||
system( "chroot $prefix /usr/sbin/adduser $username $group" );
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +58,12 @@ foreach my $account ( sort keys( %host ) )
|
||||
{
|
||||
print "Adding: $account\n";
|
||||
addAccount( $account );
|
||||
|
||||
#
|
||||
# Find any groups the user is member of on the host
|
||||
# and add them on the guest system
|
||||
#
|
||||
addGroups( $account );
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,3 +148,30 @@ sub addAccount
|
||||
}
|
||||
close( SHADOW );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Find the groups a user is member of on the host, and add them to
|
||||
# those groups on the new guest.
|
||||
#
|
||||
sub addGroups
|
||||
{
|
||||
my( $username ) = ( @_ );
|
||||
|
||||
#
|
||||
# Get the groups.
|
||||
#
|
||||
my $groups = `groups $username`;
|
||||
# split off the usernmame.
|
||||
if ( $groups =~ /^([^:]+):(.*)/ )
|
||||
{
|
||||
$groups = $2;
|
||||
print "User: $username is member of the groups: $groups\n";
|
||||
}
|
||||
|
||||
foreach my $g ( split( / /, $groups ) )
|
||||
{
|
||||
system( "chroot $prefix /usr/sbin/adduser $username $group" );
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +58,12 @@ foreach my $account ( sort keys( %host ) )
|
||||
{
|
||||
print "Adding: $account\n";
|
||||
addAccount( $account );
|
||||
|
||||
#
|
||||
# Find any groups the user is member of on the host
|
||||
# and add them on the guest system
|
||||
#
|
||||
addGroups( $account );
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,3 +148,30 @@ sub addAccount
|
||||
}
|
||||
close( SHADOW );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Find the groups a user is member of on the host, and add them to
|
||||
# those groups on the new guest.
|
||||
#
|
||||
sub addGroups
|
||||
{
|
||||
my( $username ) = ( @_ );
|
||||
|
||||
#
|
||||
# Get the groups.
|
||||
#
|
||||
my $groups = `groups $username`;
|
||||
# split off the usernmame.
|
||||
if ( $groups =~ /^([^:]+):(.*)/ )
|
||||
{
|
||||
$groups = $2;
|
||||
print "User: $username is member of the groups: $groups\n";
|
||||
}
|
||||
|
||||
foreach my $g ( split( / /, $groups ) )
|
||||
{
|
||||
system( "chroot $prefix /usr/sbin/adduser $username $group" );
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +58,12 @@ foreach my $account ( sort keys( %host ) )
|
||||
{
|
||||
print "Adding: $account\n";
|
||||
addAccount( $account );
|
||||
|
||||
#
|
||||
# Find any groups the user is member of on the host
|
||||
# and add them on the guest system
|
||||
#
|
||||
addGroups( $account );
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,3 +148,30 @@ sub addAccount
|
||||
}
|
||||
close( SHADOW );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Find the groups a user is member of on the host, and add them to
|
||||
# those groups on the new guest.
|
||||
#
|
||||
sub addGroups
|
||||
{
|
||||
my( $username ) = ( @_ );
|
||||
|
||||
#
|
||||
# Get the groups.
|
||||
#
|
||||
my $groups = `groups $username`;
|
||||
# split off the usernmame.
|
||||
if ( $groups =~ /^([^:]+):(.*)/ )
|
||||
{
|
||||
$groups = $2;
|
||||
print "User: $username is member of the groups: $groups\n";
|
||||
}
|
||||
|
||||
foreach my $g ( split( / /, $groups ) )
|
||||
{
|
||||
system( "chroot $prefix /usr/sbin/adduser $username $group" );
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +58,12 @@ foreach my $account ( sort keys( %host ) )
|
||||
{
|
||||
print "Adding: $account\n";
|
||||
addAccount( $account );
|
||||
|
||||
#
|
||||
# Find any groups the user is member of on the host
|
||||
# and add them on the guest system
|
||||
#
|
||||
addGroups( $account );
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,3 +148,30 @@ sub addAccount
|
||||
}
|
||||
close( SHADOW );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Find the groups a user is member of on the host, and add them to
|
||||
# those groups on the new guest.
|
||||
#
|
||||
sub addGroups
|
||||
{
|
||||
my( $username ) = ( @_ );
|
||||
|
||||
#
|
||||
# Get the groups.
|
||||
#
|
||||
my $groups = `groups $username`;
|
||||
# split off the usernmame.
|
||||
if ( $groups =~ /^([^:]+):(.*)/ )
|
||||
{
|
||||
$groups = $2;
|
||||
print "User: $username is member of the groups: $groups\n";
|
||||
}
|
||||
|
||||
foreach my $g ( split( / /, $groups ) )
|
||||
{
|
||||
system( "chroot $prefix /usr/sbin/adduser $username $group" );
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user