View | Details | Raw Unified | Return to bug 254565 | Differences between
and this patch

Collapse All | Expand All

(-)sysutils/byobu/Makefile (-2 / +1 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	byobu
4
PORTNAME=	byobu
5
PORTVERSION=	5.133
5
PORTVERSION=	5.133
6
PORTREVISION=	1
6
CATEGORIES=	sysutils
7
CATEGORIES=	sysutils
7
MASTER_SITES=	http://launchpad.net/${PORTNAME}/trunk/${PORTVERSION}/+download/
8
MASTER_SITES=	http://launchpad.net/${PORTNAME}/trunk/${PORTVERSION}/+download/
8
DISTNAME=	${PORTNAME}_${PORTVERSION}.orig
9
DISTNAME=	${PORTNAME}_${PORTVERSION}.orig
Lines 50-56 Link Here
50
			-e "s@/usr/bin/python@${PYTHON_CMD}@"
51
			-e "s@/usr/bin/python@${PYTHON_CMD}@"
51
	${REINPLACE_CMD} -e 's,@sysconfdir@/profile.d,$$(datadir)/@PACKAGE@,' \
52
	${REINPLACE_CMD} -e 's,@sysconfdir@/profile.d,$$(datadir)/@PACKAGE@,' \
52
		${WRKSRC}/etc/profile.d/Makefile.am
53
		${WRKSRC}/etc/profile.d/Makefile.am
53
	${FIND} ${WRKSRC}/usr/lib/byobu -type f -maxdepth 1 | ${XARGS} \
54
		${REINPLACE_CMD} -e 's:/proc:/compat/linux/proc:g'
55
54
56
.include <bsd.port.mk>
55
.include <bsd.port.mk>
(-)sysutils/byobu/files/patch-usr_lib_byobu_cpu__count (+18 lines)
Line 0 Link Here
1
--- usr/lib/byobu/cpu_count.orig	2016-04-07 22:05:52 UTC
2
+++ usr/lib/byobu/cpu_count
3
@@ -24,9 +24,11 @@ __cpu_count_detail() {
4
 }
5
 
6
 __cpu_count() {
7
-	local c
8
-	c=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo)
9
+	if [ $(uname) = "FreeBSD" ]; then
10
+		c=$(sysctl -n hw.ncpu)
11
+	else
12
+		local c
13
+		c=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo)
14
+	fi
15
 	[ "$c" = "1" ] || printf "%sx" "$c"
16
 }
17
-
18
-# vi: syntax=sh ts=4 noexpandtab
(-)sysutils/byobu/files/patch-usr_lib_byobu_cpu__freq (+21 lines)
Line 0 Link Here
1
--- usr/lib/byobu/cpu_freq.orig	2016-04-07 22:05:52 UTC
2
+++ usr/lib/byobu/cpu_freq
3
@@ -25,7 +25,11 @@ __cpu_freq_detail() {
4
 
5
 __cpu_freq() {
6
 	local hz freq count
7
-	if [ -r "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" ]; then
8
+	if [ $(uname) = "FreeBSD" ]; then
9
+		hz=$(sysctl -n machdep.tsc_freq)
10
+		fpdiv $hz "1000000000" 1
11
+		freq="$_RET"
12
+	elif [ -r "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" ]; then
13
 		read hz < /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
14
 		fpdiv $hz "1000000" 1 # 1Ghz
15
 		freq="$_RET"
16
@@ -45,5 +49,3 @@ __cpu_freq() {
17
 	[ -n "$freq" ] || return
18
 	color b c W; printf "%s" "$freq"; color -; color c W; printf "%s" "$ICON_GHz"; color --
19
 }
20
-
21
-# vi: syntax=sh ts=4 noexpandtab
(-)sysutils/byobu/files/patch-usr_lib_byobu_disk (-10 / +19 lines)
Lines 1-25 Link Here
1
--- usr/lib/byobu/disk.orig	2016-04-07 22:05:52 UTC
1
--- usr/lib/byobu/disk.orig	2020-02-09 16:40:29 UTC
2
+++ usr/lib/byobu/disk
2
+++ usr/lib/byobu/disk
3
@@ -20,7 +20,7 @@
3
@@ -20,7 +20,11 @@
4
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
4
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
5
 
5
 
6
 __disk_detail() {
6
 __disk_detail() {
7
-	df -h -P
7
-	df -h -P
8
+	df -h
8
+	if [ $(uname) = "FreeBSD" ]; then
9
+		df -h
10
+	else
11
+		df -h -P
12
+	fi
9
 }
13
 }
10
 
14
 
11
 __disk() {
15
 __disk() {
12
@@ -28,11 +28,11 @@ __disk() {
16
@@ -32,7 +36,11 @@ __disk() {
13
 	# Default to /, but let users override
14
 	[ -z "$MONITORED_DISK" ] && MP="/" || MP="$MONITORED_DISK"
15
 	case $MP in
16
-		/dev/*) MP=$(awk '$1 == m { print $2; exit(0); }' "m=$MP" /proc/mounts);;
17
+		/dev/*) MP=$(awk '$1 == m { print $2; exit(0); }' "m=$MP" /compat/linux/proc/mounts);;
18
 	esac
17
 	esac
19
 	# this could be done faster with 'stat --file-system --format'
18
 	# this could be done faster with 'stat --file-system --format'
20
 	# but then we'd have to do blocks -> human units ourselves
19
 	# but then we'd have to do blocks -> human units ourselves
21
-	out=$({ df -h -P "$MP" 2>/dev/null || df -h "$MP"; } | awk 'END { printf("%s %s", $2, $5); }')
20
-	out=$({ df -h -P "$MP" 2>/dev/null || df -h "$MP"; } | awk 'END { printf("%s %s", $2, $5); }')
22
+	out=$({ df -h "$MP" 2>/dev/null || df -h "$MP"; } | awk 'END { printf("%s %s", $2, $5); }')
21
+	if [ $(uname) = "FreeBSD" ]; then
22
+		out=$({ df -h "$MP" 2>/dev/null || df -h "$MP"; } | awk 'END { printf("%s %s", $2, $5); }')
23
+	else
24
+		out=$({ df -h -P "$MP" 2>/dev/null || df -h "$MP"; } | awk 'END { printf("%s %s", $2, $5); }')
25
+	fi
23
 	set -- ${out}
26
 	set -- ${out}
24
 	size=${1}; pct=${2};
27
 	size=${1}; pct=${2};
25
 	unit=${size#${size%?}} # get the unit (last char)
28
 	unit=${size#${size%?}} # get the unit (last char)
29
@@ -48,5 +56,3 @@ __disk() {
30
 	color b m W; printf "%s" "$size"; color -; color m W; printf "%s" "$unit"; color -;
31
 	color b m W; printf "%s" "$pct";  color -; color m W; printf "%s" "$PCT"; color --;
32
 }
33
-
34
-# vi: syntax=sh ts=4 noexpandtab
(-)sysutils/byobu/files/patch-usr_lib_byobu_load__average (+16 lines)
Line 0 Link Here
1
--- usr/lib/byobu/load_average.orig	2016-04-07 22:05:52 UTC
2
+++ usr/lib/byobu/load_average
3
@@ -26,11 +26,11 @@ __load_average_detail() {
4
 __load_average() {
5
 	if [ -r "/proc/loadavg" ]; then
6
 		read one five fifteen other < /proc/loadavg
7
+	elif [ $(uname) = "FreeBSD" ]; then
8
+		one=$(uptime | sed -En 's:.*averages\: ([[:digit:]]+\.[[:digit:]]+),.*:\1:p')
9
 	else
10
 		one=$(uptime | sed -e "s/.*://" | awk '{print $1}')
11
 	fi
12
 	[ -n "$one" ] || return
13
 	color Y k; printf "$one"; color --
14
 }
15
-
16
-# vi: syntax=sh ts=4 noexpandtab
(-)sysutils/byobu/files/patch-usr_lib_byobu_memory (-7 / +76 lines)
Lines 1-11 Link Here
1
--- usr/lib/byobu/memory.orig	2019-08-23 17:23:09 UTC
1
--- usr/lib/byobu/memory.orig	2016-09-15 19:22:48 UTC
2
+++ usr/lib/byobu/memory
2
+++ usr/lib/byobu/memory
3
@@ -52,7 +52,7 @@ __memory() {
3
@@ -26,16 +26,35 @@ __memory_detail() {
4
         buffers_plus_cached=$(($buffers+$cached))
4
 __memory() {
5
         # "free output" buffers and cache (output from 'free')
5
 	local free="" total="" buffers="" cached=""
6
         fo_buffers=$(($kb_main_used - $buffers_plus_cached))
6
 	local kb_main_used=0 buffers_plus_cached=0 fo_buffers=0 fo_cached=0
7
-	if [ -r /proc/meminfo ]; then
8
-		while read tok val unit; do
9
-			case "$tok" in
10
-				MemTotal:) total=${val};;
11
-				MemFree:) free=${val};;
12
-				Buffers:) buffers=${val};;
13
-				Cached:) cached=${val};;
14
-			esac
15
-			[ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;
16
-		done < /proc/meminfo
17
+
18
+	if [ $(uname) = "Linux" ]; then
19
+		if [ -r /proc/meminfo ]; then
20
+			while read tok val unit; do
21
+				case "$tok" in
22
+					MemTotal:) total=${val};;
23
+					MemFree:) free=${val};;
24
+					Buffers:) buffers=${val};;
25
+					Cached:) cached=${val};;
26
+				esac
27
+				[ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;
28
+			done < /proc/meminfo
29
+		fi
30
+	elif [ $(uname) = "FreeBSD" ]; then
31
+		# FreeBSD support
32
+		mem_phys=$(sysctl -n hw.physmem)
33
+		page_size=$(sysctl -n hw.pagesize)
34
+		mem_inactive=$(($(sysctl -n vm.stats.vm.v_inactive_count)*$page_size))
35
+		mem_cache=$(($(sysctl -n vm.stats.vm.v_cache_count)*$page_size))
36
+		mem_free=$(($(sysctl -n vm.stats.vm.v_free_count)*$page_size))
37
+
38
+		mem_avail=$(($mem_inactive+$mem_cache+$mem_free))
39
+		mem_used=$(($mem_phys-$mem_avail))
40
+
41
+		total=$(($mem_phys/1024))
42
+		free=$(($mem_avail/1024))
43
+
44
+		buffers=0
45
+		cached=0
46
 	elif eval $BYOBU_TEST vm_stat >/dev/null 2>&1; then
47
 		# MacOS support
48
 		# calculation borrowed from http://apple.stackexchange.com/a/48195/18857
49
@@ -44,16 +63,18 @@ __memory() {
50
 		speculative_blocks=$(vm_stat | grep speculative | awk '{ print $3 }' | sed -e 's/\.//')
51
 		free=$((($free_blocks+speculative_blocks)*4))
52
 		inactive=$(($inactive_blocks*4))
53
-		total=$((($free+$inactive)))
54
+		total=$(($free+$inactive))
55
 		buffers=0
56
 		cached=0
57
 	fi
58
-        kb_main_used=$(($total-$free))
59
-        buffers_plus_cached=$(($buffers+$cached))
60
-        # "free output" buffers and cache (output from 'free')
61
-        fo_buffers=$(($kb_main_used - $buffers_plus_cached))
7
-        fpdiv $((100*${fo_buffers})) "${total}" 0;
62
-        fpdiv $((100*${fo_buffers})) "${total}" 0;
8
+        fpdiv $((100*${kb_main_used})) "${total}" 0;
63
-        usage=${_RET}
9
         usage=${_RET}
64
+
65
+	kb_main_used=$(($total-$free))
66
+	buffers_plus_cached=$(($buffers+$cached))
67
+	# "free output" buffers and cache (output from 'free')
68
+	fo_buffers=$(($kb_main_used - $buffers_plus_cached))
69
+	fpdiv $((100*${fo_buffers})) "${total}" 0;
70
+	usage=${_RET}
71
+
10
 	if [ $total -ge 1048576 ]; then
72
 	if [ $total -ge 1048576 ]; then
11
 		fpdiv "$total" 1048567 1
73
 		fpdiv "$total" 1048567 1
74
 		total=${_RET}
75
@@ -74,5 +95,3 @@ __memory() {
76
 	[ -n "$total" ] || return
77
 	color b g W; printf "%s" "$total"; color -; color g W; printf "%s" "$unit"; color -; color b g "$fg"; printf "%s" "$usage"; color -; color g "$fg"; printf "%s" "$PCT"; color --
78
 }
79
-
80
-# vi: syntax=sh ts=4 noexpandtab
(-)sysutils/byobu/files/patch-usr_lib_byobu_uptime (+18 lines)
Line 0 Link Here
1
--- usr/lib/byobu/uptime.orig	2016-05-31 14:48:13 UTC
2
+++ usr/lib/byobu/uptime
3
@@ -30,6 +30,9 @@ __uptime() {
4
 	if [ -r /proc/uptime ]; then
5
 		read u idle < /proc/uptime
6
 		u=${u%.*}
7
+	elif [ $(uname) = "FreeBSD" ]; then
8
+		u=$(sysctl -n kern.boottime | sed -En 's:.*sec = ([[:digit:]]+),.*:\1:p')
9
+		u=$(($(date +%s) - $u))
10
 	elif [ -x /usr/sbin/sysctl ]; then
11
 		# MacOS support
12
 		u=$(/usr/sbin/sysctl -n kern.boottime | cut -f4 -d' ' | cut -d',' -f1)
13
@@ -52,5 +55,3 @@ __uptime() {
14
 	[ -n "$str" ] || return
15
 	color w b; printf "%s" "${str}"; color --
16
 }
17
-
18
-# vi: syntax=sh ts=4 noexpandtab
(-)sysutils/byobu/files/patch-usr_lib_byobu_users (+8 lines)
Line 0 Link Here
1
--- usr/lib/byobu/users.orig	2019-06-01 20:40:30 UTC
2
+++ usr/lib/byobu/users
3
@@ -40,5 +40,3 @@ __users() {
4
 		rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"*
5
 	fi
6
 }
7
-
8
-# vi: syntax=sh ts=4 noexpandtab
(-)sysutils/byobu/pkg-message (-16 lines)
Lines 1-16 Link Here
1
[
2
{ type: install
3
  message: <<EOM
4
byobu requires linprocfs(5) mounted on /compat/linux/proc
5
6
If you have not done it yet, please do the following:
7
8
	mkdir -p /compat/linux/proc
9
	mount -t linprocfs linproc /compat/linux/proc
10
11
To make it permanent, you need the following line in /etc/fstab:
12
13
	linproc  /compat/linux/proc  linprocfs  rw,late  0 0
14
EOM
15
}
16
]

Return to bug 254565