Kill all user procs before unmounting home
This commit is contained in:
parent
778a2c67ef
commit
f0de07c655
@ -245,6 +245,19 @@ sub call_chezmoi
|
||||
}
|
||||
}
|
||||
|
||||
sub get_uid
|
||||
{
|
||||
my $user = shift;
|
||||
my $s = `userinfo $user`;
|
||||
|
||||
if ( $s =~ /uid\t([0-9]+)/s ) {
|
||||
my $uid = $1;
|
||||
return $uid;
|
||||
} else {
|
||||
trap_error("ERROR: userinfo did not return uid");
|
||||
}
|
||||
}
|
||||
|
||||
sub main
|
||||
{
|
||||
|
||||
@ -332,6 +345,8 @@ sub main
|
||||
}
|
||||
|
||||
if ( $stop && is_mounted($impermanence_home) ) {
|
||||
my $uid = get_uid( $opts{u} );
|
||||
system( "pkill", "-U $uid" );
|
||||
my $status = system( "umount", $impermanence_home );
|
||||
if ( $status != 0 ) {
|
||||
trap_error("umount did exit with status $status");
|
||||
|
Loading…
Reference in New Issue
Block a user