openwrt-packages/utils/byobu/patches/007-count-dropbear-users.patch

25 lines
708 B
Diff

--- a/usr/lib/byobu/users
+++ b/usr/lib/byobu/users
@@ -26,7 +26,12 @@ __users_detail() {
}
__users() {
- local count=0
+ local count=0 f pid
+ for f in /var/run/dropbear.*.pid; do
+ read pid < "$f"
+ count=$(($count + $(pgrep -P "$pid" | wc -l)))
+ done
+ if [ $count -eq 0 ]; then
if [ "$USERS_DISTINCT" = "1" ]; then
count=$(pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l)
else
@@ -34,6 +39,7 @@ __users() {
# busybox and some distro's pgrep (and it doesn't exit non-zero).
count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l) || return
fi
+ fi
if [ $count -gt 0 ]; then
color b w r; printf "%d" "$count"; color -; color w r; printf "##"; color --
else