diff options
author | jlam <jlam@pkgsrc.org> | 2005-01-28 18:00:28 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2005-01-28 18:00:28 +0000 |
commit | b9257c8664b7ac16b73d64cea2d451a888ea4f33 (patch) | |
tree | 4f23363bb628643a3295916df1cf71a290f25907 /mk/install | |
parent | 1aea3c3add46fd0cd0d02e2b1d04a73bde07b883 (diff) | |
download | pkgsrc-b9257c8664b7ac16b73d64cea2d451a888ea4f33.tar.gz |
Pretty-print the users and groups that may need to be removed during
CHECK-REMOVE. The users and groups are now printed on the same line
with whitespace separating the entries (for easy copy-and-pasting info
commands), and wrapping to successive lines if we overflow the length
of the current line.
Diffstat (limited to 'mk/install')
-rw-r--r-- | mk/install/usergroup | 65 |
1 files changed, 41 insertions, 24 deletions
diff --git a/mk/install/usergroup b/mk/install/usergroup index 32dacfb5abf..1b811880488 100644 --- a/mk/install/usergroup +++ b/mk/install/usergroup @@ -92,6 +92,29 @@ user_exists() return 1 } +listwrap() +{ + length=$1 + buffer= + while read line; do + set -- $line + for word; do + case $buffer in + "") buffer="$word" ;; + *) buffer="$buffer $word" ;; + esac + if ${TEST} ${#buffer} -gt $length; then + ${ECHO} " $buffer" + buffer= + fi + done + done + case $buffer in + "") ;; + *) ${ECHO} " $buffer" ;; + esac +} + exitcode=0 case $ACTION in ADD) @@ -301,19 +324,16 @@ CHECK-REMOVE) esac shadow_dir="${PKG_REFCOUNT_USERS_DBDIR}/$user" ${TEST} -d "$shadow_dir" && continue # refcount isn't zero - case "$printed_header" in - yes) ;; - *) printed_header=yes - ${ECHO} "===========================================================================" - ${ECHO} "The following users are no longer being used by ${PKGNAME}," - ${ECHO} "and they can be removed if no other packages are using them:" - ${ECHO} "" - ;; - esac - ${ECHO} " ${user}" + existing_users="$existing_users $user" done - case "$printed_header" in - yes) ${ECHO} "" + case $existing_users in + "") ;; + *) ${ECHO} "===========================================================================" + ${ECHO} "The following users are no longer being used by ${PKGNAME}," + ${ECHO} "and they can be removed if no other packages are using them:" + ${ECHO} "" + ${ECHO} "$existing_users" | listwrap 40 + ${ECHO} "" ${ECHO} "===========================================================================" exit 1 ;; @@ -331,19 +351,16 @@ CHECK-REMOVE) esac shadow_dir="${PKG_REFCOUNT_GROUPS_DBDIR}/$group" ${TEST} -d "$shadow_dir" && continue # refcount isn't zero - case "$printed_header" in - yes) ;; - *) printed_header=yes - ${ECHO} "===========================================================================" - ${ECHO} "The following groups are no longer being used by ${PKGNAME}," - ${ECHO} "and they can be removed if no other packages are using them:" - ${ECHO} "" - ;; - esac - ${ECHO} " $group" + existing_groups="$existing_groups $group" done - case "$printed_header" in - yes) ${ECHO} "" + case $existing_groups in + "") ;; + *) ${ECHO} "===========================================================================" + ${ECHO} "The following groups are no longer being used by ${PKGNAME}," + ${ECHO} "and they can be removed if no other packages are using them:" + ${ECHO} "" + ${ECHO} "$existing_groups" | listwrap 40 + ${ECHO} "" ${ECHO} "===========================================================================" exit 1 ;; |