From e6c99d33380d19882897a729f662a227d3277d00 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 29 Apr 2016 02:29:46 -0700 Subject: [PATCH] update-pwd-db: be more robust Ignore chmod failures and force remove master.passwd before regenerating it to avoid spurious failures. Signed-off-by: Kyle J. McKay --- bin/update-pwd-db | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/update-pwd-db b/bin/update-pwd-db index 25cabe7..4e3914a 100755 --- a/bin/update-pwd-db +++ b/bin/update-pwd-db @@ -24,6 +24,12 @@ set -e cd "$cfg_chroot" user_only= [ -z "$2" ] || user_only="-u $2" -trap 'chmod 0664 etc/master.passwd etc/pwd.db etc/spwd.db' EXIT +cleanup() { + chmod 0664 etc/master.passwd etc/pwd.db etc/spwd.db || : + return 0 +} >/dev/null 2>&1 +trap cleanup EXIT +rm -f etc/master.passwd awk -F ':' '{ print $1 ":" $2 ":" $3 ":" $4 "::0:0:" $5 ":" $6 ":" $7 }' < "$1" > etc/master.passwd PW_SCAN_BIG_IDS=1 pwd_mkdb -d etc $user_only etc/master.passwd 2>/dev/null +exit 0 -- 2.11.4.GIT