diff --git a/usr/lib/byobu/cpu_count b/usr/lib/byobu/cpu_count index 5c06f4a4..43b8e828 100755 --- a/usr/lib/byobu/cpu_count +++ b/usr/lib/byobu/cpu_count @@ -24,9 +24,11 @@ __cpu_count_detail() { } __cpu_count() { - local c - c=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo) + if [ $(uname) = "FreeBSD" ]; then + c=$(sysctl -n hw.ncpu) + else + local c + c=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo) + fi [ "$c" = "1" ] || printf "%sx" "$c" -} - -# vi: syntax=sh ts=4 noexpandtab +} \ No newline at end of file diff --git a/usr/lib/byobu/cpu_freq b/usr/lib/byobu/cpu_freq index ba618184..a29a1609 100755 --- a/usr/lib/byobu/cpu_freq +++ b/usr/lib/byobu/cpu_freq @@ -25,7 +25,11 @@ __cpu_freq_detail() { __cpu_freq() { local hz freq count - if [ -r "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" ]; then + if [ $(uname) = "FreeBSD" ]; then + hz=$(sysctl -n machdep.tsc_freq) + fpdiv $hz "1000000000" 1 + freq="$_RET" + elif [ -r "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" ]; then read hz < /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq fpdiv $hz "1000000" 1 # 1Ghz freq="$_RET" @@ -44,6 +48,4 @@ __cpu_freq() { fi [ -n "$freq" ] || return color b c W; printf "%s" "$freq"; color -; color c W; printf "%s" "$ICON_GHz"; color -- -} - -# vi: syntax=sh ts=4 noexpandtab +} \ No newline at end of file diff --git a/usr/lib/byobu/disk b/usr/lib/byobu/disk index 75f759ab..a94c5d56 100755 --- a/usr/lib/byobu/disk +++ b/usr/lib/byobu/disk @@ -20,7 +20,11 @@ # along with this program. If not, see . __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) @@ -47,6 +55,4 @@ __disk() { [ -n "$size" ] || return color b m W; printf "%s" "$size"; color -; color m W; printf "%s" "$unit"; color -; color b m W; printf "%s" "$pct"; color -; color m W; printf "%s" "$PCT"; color --; -} - -# vi: syntax=sh ts=4 noexpandtab +} \ No newline at end of file diff --git a/usr/lib/byobu/load_average b/usr/lib/byobu/load_average index 5eaf7b96..b466acdd 100755 --- a/usr/lib/byobu/load_average +++ b/usr/lib/byobu/load_average @@ -33,6 +33,4 @@ __load_average() { fi [ -n "$one" ] || return color Y k; printf "$one"; color -- -} - -# vi: syntax=sh ts=4 noexpandtab +} \ No newline at end of file diff --git a/usr/lib/byobu/users b/usr/lib/byobu/users index 0d8dd21f..b42f396b 100755 --- a/usr/lib/byobu/users +++ b/usr/lib/byobu/users @@ -39,6 +39,4 @@ __users() { else rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"* fi -} - -# vi: syntax=sh ts=4 noexpandtab +} \ No newline at end of file