aboutsummaryrefslogtreecommitdiff
path: root/sysutils/byobu/files/patch-usr_lib_byobu_disk
blob: 7d8e86a147b53d825a03a12e383e25c071ddf6a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- usr/lib/byobu/disk.orig	2020-02-09 16:40:29 UTC
+++ usr/lib/byobu/disk
@@ -20,7 +20,11 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 __disk_detail() {
-	df -h -P
+	if [ $(uname) = "FreeBSD" ]; then
+		df -h
+	else
+		df -h -P
+	fi
 }
 
 __disk() {
@@ -32,7 +36,11 @@ __disk() {
 	esac
 	# this could be done faster with 'stat --file-system --format'
 	# but then we'd have to do blocks -> human units ourselves
-	out=$({ df -h -P "$MP" 2>/dev/null || df -h "$MP"; } | awk 'END { printf("%s %s", $2, $5); }')
+	if [ $(uname) = "FreeBSD" ]; then
+		out=$({ df -h "$MP" 2>/dev/null || df -h "$MP"; } | awk 'END { printf("%s %s", $2, $5); }')
+	else
+		out=$({ df -h -P "$MP" 2>/dev/null || df -h "$MP"; } | awk 'END { printf("%s %s", $2, $5); }')
+	fi
 	set -- ${out}
 	size=${1}; pct=${2};
 	unit=${size#${size%?}} # get the unit (last char)