summaryrefslogtreecommitdiff
path: root/mk/install
diff options
context:
space:
mode:
authorjlam <jlam>2005-01-28 18:00:28 +0000
committerjlam <jlam>2005-01-28 18:00:28 +0000
commitcbc557b90f8460ad615c64297bb502839a875caa (patch)
tree4f23363bb628643a3295916df1cf71a290f25907 /mk/install
parentde6e2c8574a0273e6d511ee0308775d032b57435 (diff)
downloadpkgsrc-cbc557b90f8460ad615c64297bb502839a875caa.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/usergroup65
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
;;