1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-30 01:15:52 +00:00

sysutils/byobu: add patches to use linprocfs

PR:		202367
Submitted by:	Justin Coffman <coffmanjk@gmail.com>
Approved by:	maintainer timeout (amutu@amutu.com, >10 months)
This commit is contained in:
Steve Wills 2018-06-16 22:51:22 +00:00
parent 2daed13623
commit 22d6bb1a6a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=472574
20 changed files with 349 additions and 0 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= byobu
PORTVERSION= 5.119
PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= http://launchpad.net/${PORTNAME}/trunk/${PORTVERSION}/+download/
DISTNAME= ${PORTNAME}_${PORTVERSION}.orig

View File

@ -0,0 +1,29 @@
--- usr/lib/byobu/battery.orig 2016-09-15 19:22:48 UTC
+++ usr/lib/byobu/battery
@@ -22,7 +22,7 @@
__battery_detail() {
local bat
- for bat in /proc/acpi/battery/*; do
+ for bat in /compat/linux/proc/acpi/battery/*; do
cat "$bat/info"
cat "$bat/state"
done
@@ -33,7 +33,7 @@ __battery() {
local bat line present sign state percent full rem color bcolor
# Linux support
present=""; full="0"; rem="0"; state=""
- for bat in $BATTERY /sys/class/power_supply/* /proc/acpi/battery/*; do
+ for bat in $BATTERY /sys/class/power_supply/* /compat/linux/proc/acpi/battery/*; do
case "$bat" in
/sys/*)
if [ -r "$bat/uevent" ]; then
@@ -51,7 +51,7 @@ __battery() {
[ "$POWER_SUPPLY_STATUS" != "Unknown" ] && state="$POWER_SUPPLY_STATUS"
fi
;;
- /proc/*)
+ /compat/linux/proc/*)
[ -f "$bat/info" ] || continue
while read line; do
set -- ${line}

View File

@ -0,0 +1,17 @@
--- usr/lib/byobu/cpu_count.orig 2016-04-07 22:05:52 UTC
+++ usr/lib/byobu/cpu_count
@@ -20,12 +20,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__cpu_count_detail() {
- grep -i "^model name" /proc/cpuinfo
+ grep -i "^model name" /compat/linux/proc/cpuinfo
}
__cpu_count() {
local c
- c=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo)
+ c=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /compat/linux/proc/cpuinfo)
[ "$c" = "1" ] || printf "%sx" "$c"
}

View File

@ -0,0 +1,30 @@
--- usr/lib/byobu/cpu_freq.orig 2016-04-07 22:05:52 UTC
+++ usr/lib/byobu/cpu_freq
@@ -20,7 +20,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__cpu_freq_detail() {
- cat /proc/cpuinfo
+ cat /compat/linux/proc/cpuinfo
}
__cpu_freq() {
@@ -29,13 +29,13 @@ __cpu_freq() {
read hz < /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
fpdiv $hz "1000000" 1 # 1Ghz
freq="$_RET"
- elif [ -r "/proc/cpuinfo" ]; then
- if egrep -q -s -i -m 1 "^cpu MHz|^clock" /proc/cpuinfo; then
- freq=$(egrep -i -m 1 "^cpu MHz|^clock" /proc/cpuinfo | awk -F"[:.]" '{ printf "%01.1f", $2 / 1000 }')
+ elif [ -r "/compat/linux/proc/cpuinfo" ]; then
+ if egrep -q -s -i -m 1 "^cpu MHz|^clock" /compat/linux/proc/cpuinfo; then
+ freq=$(egrep -i -m 1 "^cpu MHz|^clock" /compat/linux/proc/cpuinfo | awk -F"[:.]" '{ printf "%01.1f", $2 / 1000 }')
else
# Must scale frequency by number of processors, if counting bogomips
- count=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo)
- freq=$(egrep -i -m 1 "^bogomips" /proc/cpuinfo | awk -F"[:.]" '{ print $2 }')
+ count=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /compat/linux/proc/cpuinfo)
+ freq=$(egrep -i -m 1 "^bogomips" /compat/linux/proc/cpuinfo | awk -F"[:.]" '{ print $2 }')
freq=$(printf "%s %s" "$freq" "$count" | awk '{printf "%01.1f\n", $1/$2/1000}')
fi
elif hz=$(sysctl -n hw.cpufrequency 2>/dev/null); then

View File

@ -0,0 +1,20 @@
--- usr/lib/byobu/cpu_temp.orig 2016-07-29 16:53:37 UTC
+++ usr/lib/byobu/cpu_temp
@@ -21,7 +21,7 @@
__cpu_temp_detail() {
local i
- for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal /proc/acpi/thermal_zone/*/temperature /sys/class/thermal/thermal_zone*/temp; do
+ for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /compat/linux/proc/acpi/ibm/thermal /compat/linux/proc/acpi/thermal_zone/*/temperature /sys/class/thermal/thermal_zone*/temp; do
[ -r "$i" ] || continue
printf "%s\n" "$i:"
cat "$i"/*
@@ -30,7 +30,7 @@ __cpu_temp_detail() {
__cpu_temp() {
local i t unit
- for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal /proc/acpi/thermal_zone/*/temperature /sys/class/thermal/thermal_zone*/temp; do
+ for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /compat/linux/proc/acpi/ibm/thermal /compat/linux/proc/acpi/thermal_zone/*/temperature /sys/class/thermal/thermal_zone*/temp; do
case "$i" in
*temp*_input|*thermal_zone*/temp)
[ -s "$i" ] && read t < "$i" && t=$(($t/1000))

View File

@ -0,0 +1,25 @@
--- usr/lib/byobu/disk.orig 2016-04-07 22:05:52 UTC
+++ usr/lib/byobu/disk
@@ -20,7 +20,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__disk_detail() {
- df -h -P
+ df -h
}
__disk() {
@@ -28,11 +28,11 @@ __disk() {
# Default to /, but let users override
[ -z "$MONITORED_DISK" ] && MP="/" || MP="$MONITORED_DISK"
case $MP in
- /dev/*) MP=$(awk '$1 == m { print $2; exit(0); }' "m=$MP" /proc/mounts);;
+ /dev/*) MP=$(awk '$1 == m { print $2; exit(0); }' "m=$MP" /compat/linux/proc/mounts);;
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); }')
+ out=$({ df -h "$MP" 2>/dev/null || df -h "$MP"; } | awk 'END { printf("%s %s", $2, $5); }')
set -- ${out}
size=${1}; pct=${2};
unit=${size#${size%?}} # get the unit (last char)

View File

@ -0,0 +1,22 @@
--- usr/lib/byobu/ec2_cost.orig 2016-04-07 22:05:52 UTC
+++ usr/lib/byobu/ec2_cost
@@ -56,8 +56,8 @@ __ec2_cost() {
file_to_stat="/etc/hostname"
hours=$(((`date +%s` - `stat --printf %Y $file_to_stat`) / 60 / 60 + 1))
# Auto detect network interface
- [ -r "/proc/net/route" ] || return
- interface=$(tail -n1 /proc/net/route | awk '{print $1}')
+ [ -r "/compat/linux/proc/net/route" ] || return
+ interface=$(tail -n1 /compat/linux/proc/net/route | awk '{print $1}')
local iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed
while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do
case "$iface" in
@@ -78,7 +78,7 @@ __ec2_cost() {
rx_gb=${rbytes}
break
fi
- done < /proc/net/dev
+ done < /compat/linux/proc/net/dev
tx_gb=$(printf "%s" ${tx_gb} | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }')
rx_gb=$(printf "%s" ${rx_gb} | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }')
network_cost=`printf "%s %s %s %s" "$tx_gb" "$TX_RATE" "$rx_gb" "$RX_RATE" | awk '{printf "%f %f", $1*$2, $3*$4}' | awk '{printf "%f", $1 + $2}'`

View File

@ -0,0 +1,18 @@
--- usr/lib/byobu/entropy.orig 2016-04-07 22:05:52 UTC
+++ usr/lib/byobu/entropy
@@ -19,12 +19,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__entropy_detail() {
- cat /proc/sys/kernel/random/entropy_avail 2>/dev/null
+ cat /compat/linux/proc/sys/kernel/random/entropy_avail 2>/dev/null
}
__entropy() {
- if [ -r /proc/sys/kernel/random/entropy_avail ]; then
- local e=$(cat /proc/sys/kernel/random/entropy_avail)
+ if [ -r /compat/linux/proc/sys/kernel/random/entropy_avail ]; then
+ local e=$(cat /compat/linux/proc/sys/kernel/random/entropy_avail)
[ -n "$e" ] || return
color K Y; printf "e%s" "$e"; color --
fi

View File

@ -0,0 +1,14 @@
--- usr/lib/byobu/fan_speed.orig 2016-04-07 22:05:52 UTC
+++ usr/lib/byobu/fan_speed
@@ -38,9 +38,9 @@ __fan_speed() {
done
# But others (e.g. Dell Inspirons) seem to be here:
- if [ -r /proc/i8k ]; then
+ if [ -r /compat/linux/proc/i8k ]; then
local line=""
- read line < /proc/i8k
+ read line < /compat/linux/proc/i8k
set -- $line
for speed in $7 $8; do
if [ -n "$speed" ] && [ "$speed" -gt 0 ]; then

View File

@ -0,0 +1,11 @@
--- usr/lib/byobu/ip_address.orig 2016-09-15 19:22:48 UTC
+++ usr/lib/byobu/ip_address
@@ -34,7 +34,7 @@ __ip_address() {
interface="$MONITORED_NETWORK"
else
case "$IPV6" in
- 1|true|yes) interface=$(awk '$10 != "lo" { iface=$10 ; }; END { print iface; }' /proc/net/ipv6_route);;
+ 1|true|yes) interface=$(awk '$10 != "lo" { iface=$10 ; }; END { print iface; }' /compat/linux/proc/net/ipv6_route);;
*) get_network_interface; interface="$_RET";;
esac
fi

View File

@ -0,0 +1,18 @@
--- usr/lib/byobu/load_average.orig 2016-04-07 22:05:52 UTC
+++ usr/lib/byobu/load_average
@@ -20,12 +20,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__load_average_detail() {
- cat /proc/loadavg
+ cat /compat/linux/proc/loadavg
}
__load_average() {
- if [ -r "/proc/loadavg" ]; then
- read one five fifteen other < /proc/loadavg
+ if [ -r "/compat/linux/proc/loadavg" ]; then
+ read one five fifteen other < /compat/linux/proc/loadavg
else
one=$(uptime | sed -e "s/.*://" | awk '{print $1}')
fi

View File

@ -0,0 +1,20 @@
--- usr/lib/byobu/memory.orig 2016-09-15 19:22:48 UTC
+++ usr/lib/byobu/memory
@@ -26,7 +26,7 @@ __memory_detail() {
__memory() {
local free="" total="" buffers="" cached=""
local kb_main_used=0 buffers_plus_cached=0 fo_buffers=0 fo_cached=0
- if [ -r /proc/meminfo ]; then
+ if [ -r /compat/linux/proc/meminfo ]; then
while read tok val unit; do
case "$tok" in
MemTotal:) total=${val};;
@@ -35,7 +35,7 @@ __memory() {
Cached:) cached=${val};;
esac
[ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;
- done < /proc/meminfo
+ done < /compat/linux/proc/meminfo
elif eval $BYOBU_TEST vm_stat >/dev/null 2>&1; then
# MacOS support
# calculation borrowed from http://apple.stackexchange.com/a/48195/18857

View File

@ -0,0 +1,11 @@
--- usr/lib/byobu/network.orig 2016-04-07 22:05:52 UTC
+++ usr/lib/byobu/network
@@ -41,7 +41,7 @@ __network() {
cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/network.$i"
[ -r "$cache" ] && read x1 < "$cache" || tx1=0
local iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed
- cat /proc/net/dev > "$cache".dev
+ cat /compat/linux/proc/net/dev > "$cache".dev
while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do
case "$iface" in
${interface}:)

View File

@ -0,0 +1,13 @@
--- usr/lib/byobu/processes.orig 2016-04-07 22:05:52 UTC
+++ usr/lib/byobu/processes
@@ -25,8 +25,8 @@ __processes_detail() {
__processes() {
local count=
- if [ -r /proc ]; then
- count=$(ls -d /proc/[0-9]* 2>/dev/null| wc -l)
+ if [ -r /compat/linux/proc ]; then
+ count=$(ls -d /compat/linux/proc/[0-9]* 2>/dev/null| wc -l)
else
count=$(ps -ef | wc -l | awk '{print $1}')
fi

View File

@ -0,0 +1,20 @@
--- usr/lib/byobu/raid.orig 2016-04-07 22:05:52 UTC
+++ usr/lib/byobu/raid
@@ -20,7 +20,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__raid_detail() {
- [ -r /proc/mdstat ] && cat /proc/mdstat || true
+ [ -r /compat/linux/proc/mdstat ] && cat /compat/linux/proc/mdstat || true
}
__raid() {
@@ -37,7 +37,7 @@ __raid() {
msg="$msg,$p"
;;
esac
- done < /proc/mdstat
+ done < /compat/linux/proc/mdstat
if [ -n "$msg" ]; then
color B w r; printf "%s" "$msg"; color --
elif [ -e "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/raid" ]; then

View File

@ -0,0 +1,22 @@
--- usr/lib/byobu/rcs_cost.orig 2016-01-14 12:15:11 UTC
+++ usr/lib/byobu/rcs_cost
@@ -40,7 +40,7 @@ __rcs_cost() {
# 15872MB $0.960/h
# Instance memory
- memory=`grep "^MemTotal:" /proc/meminfo | awk '{print $2}'`
+ memory=`grep "^MemTotal:" /compat/linux/proc/meminfo | awk '{print $2}'`
# Round memory down to the nearest multiple of 64MB
memory=$((${memory} - (${memory} % (64 * 1024))))
@@ -59,8 +59,8 @@ __rcs_cost() {
TX_RATE="0.22"
# Auto detect network interface
- [ -r "/proc/net/route" ] || return
- IF=$(tail -n1 /proc/net/route | awk '{print $1}')
+ [ -r "/compat/linux/proc/net/route" ] || return
+ IF=$(tail -n1 /compat/linux/proc/net/route | awk '{print $1}')
ifconfig_out=`LC_ALL=C /sbin/ifconfig "$IF"`

View File

@ -0,0 +1,11 @@
--- usr/lib/byobu/reboot_required.orig 2016-06-13 11:26:23 UTC
+++ usr/lib/byobu/reboot_required
@@ -46,7 +46,7 @@ __reboot_required() {
break
;;
esac
- done < /proc/modules
+ done < /compat/linux/proc/modules
if [ -e "$REBOOT_FLAG" ]; then
if [ "$livepatched" = "1" ]; then
color k G; printf "$ICON_REBOOT"; color --;

View File

@ -0,0 +1,20 @@
--- usr/lib/byobu/swap.orig 2016-04-07 22:05:52 UTC
+++ usr/lib/byobu/swap
@@ -20,7 +20,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__swap_detail() {
- cat /proc/meminfo
+ cat /compat/linux/proc/meminfo
}
__swap() {
@@ -34,7 +34,7 @@ __swap() {
continue
fi
[ -n "$stotal" -a -n "$sfree" ] && break;
- done < /proc/meminfo
+ done < /compat/linux/proc/meminfo
if [ "${stotal:-0}" = "0" ]; then
printf ""
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/swap"

View File

@ -0,0 +1,13 @@
--- usr/lib/byobu/uptime.orig 2016-05-31 14:48:13 UTC
+++ usr/lib/byobu/uptime
@@ -27,8 +27,8 @@ __uptime_detail() {
__uptime() {
local u= idle= str=
- if [ -r /proc/uptime ]; then
- read u idle < /proc/uptime
+ if [ -r /compat/linux/proc/uptime ]; then
+ read u idle < /compat/linux/proc/uptime
u=${u%.*}
elif [ -x /usr/sbin/sysctl ]; then
# MacOS support

View File

@ -0,0 +1,14 @@
======================================================================
byobu requires linprocfs(5) mounted on /compat/linux/proc
If you have not done it yet, please do the following:
mkdir -p /compat/linux/proc
mount -t linprocfs linproc /compat/linux/proc
To make it permanent, you need the following line in /etc/fstab:
linproc /compat/linux/proc linprocfs rw,late 0 0
======================================================================