1
0
mirror of synced 2026-01-19 01:07:28 +00:00

2006-12-25 23:10:49 by steve

Copy the group memberships too.
This commit is contained in:
steve 2006-12-25 23:10:50 +00:00
parent 7fd127d79c
commit 52a4dca26e
5 changed files with 165 additions and 0 deletions

View File

@ -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" );
}
}

View File

@ -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" );
}
}

View File

@ -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" );
}
}

View File

@ -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" );
}
}

View File

@ -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" );
}
}