[Pkg-libvirt-commits] [libguestfs] 54/384: sysprep: user-account: mark "changed file" if users were removed
Hilko Bengen
bengen at moszumanska.debian.org
Sun Mar 29 16:55:20 UTC 2015
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch experimental
in repository libguestfs.
commit d4ffaad98390141f1830c1aa41425e79c23ecb02
Author: Pino Toscano <ptoscano at redhat.com>
Date: Fri Dec 5 15:23:28 2014 +0100
sysprep: user-account: mark "changed file" if users were removed
Removing an user causes /etc/passwd, /etc/shadow, and /etc/group to
change, so mark the side effects as such if any user has been removed.
---
sysprep/sysprep_operation_user_account.ml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sysprep/sysprep_operation_user_account.ml b/sysprep/sysprep_operation_user_account.ml
index bda6331..e53e5cc 100644
--- a/sysprep/sysprep_operation_user_account.ml
+++ b/sysprep/sysprep_operation_user_account.ml
@@ -55,6 +55,7 @@ let check_remove_user user =
let user_account_perform ~verbose ~quiet g root side_effects =
let typ = g#inspect_get_type root in
+ let changed = ref false in
if typ <> "windows" then (
g#aug_init "/" 0;
let uid_min = g#aug_get "/files/etc/login.defs/UID_MIN" in
@@ -72,6 +73,7 @@ let user_account_perform ~verbose ~quiet g root side_effects =
String.sub userpath (i+1) (String.length userpath -i-1) in
if uid >= uid_min && uid <= uid_max
&& check_remove_user username then (
+ changed := true;
(* Get the home before removing the passwd entry. *)
let home_dir =
try Some (g#aug_get (userpath ^ "/home"))
@@ -90,7 +92,9 @@ let user_account_perform ~verbose ~quiet g root side_effects =
)
) users;
g#aug_save ();
- )
+ );
+ if !changed then
+ side_effects#changed_file ()
let op = {
defaults with
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list