File: /home/boxelikax/public_html/demoltec.com/byobu.zip
PK �]��-1� � datenu ȯ�� #!/bin/sh -e
#
# date: print the date in YYYY-MM-DD format
#
# Copyright (C) 2008 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__date_detail() {
date
}
__date() {
case "$BYOBU_BACKEND" in
screen)
color none; printf "\005Y-\005m-\005d"; color --
;;
esac
}
# vi: syntax=sh ts=4 noexpandtab
PK �]�t�S S logonu ȯ�� #!/bin/sh -e
#
# logo: determine which logo to use
#
# Copyright (C) 2008 Canonical Ltd.
# Copyright (C) 2011-2023 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__logo_detail() {
MARKUP="false"
__logo
}
__logo() {
local logo=
if [ -n "$LOGO" ]; then
# Allow users to define their own logo in $BYOBU_CONFIG_DIR/status
printf "%s" "$LOGO"
return
fi
local distro="$(printf "%s" "$BYOBU_DISTRO" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"
case "$distro" in
*ubuntu*)
if $MARKUP; then
if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
if [ ! "$VTE_CJK_WIDTH" = "1" ] && [ ! "$VTE_CJK_WIDTH" = "wide" ] ; then
# color "colour202" "colour255" ; printf " u "; color -
# Ubuntu's logo doesn't display anywhere, except for on Ubuntu itself, which has the Ubuntu font with the logo
# which breaks when you ssh into Ubuntu from elsewhere (Windows, Debian, Mac)
color "colour202" "colour255" ; printf " u "; color -
else
color m W; printf " u "; color -
fi
else
color m W; printf " u "; color -
fi
else
printf " u "
fi
;;
*alpine*)
logo=" /\\\\\\\\ "
$MARKUP && printf "$(color b b W)%s$(color -)" "$logo" || printf "$logo"
;;
*altlinux*)
logo="alt"
$MARKUP && printf "$(color Y k)%s$(color -)" "$logo" || printf "$logo"
;;
*arch*)
logo=" A "
$MARKUP && printf "$(color b w b)%s$(color -)" "$logo" || printf "$logo"
;;
*centos*)
if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
logo="※ "
$MARKUP && printf "$(color w m)※ $(color -)" || printf "$logo"
else
$MARKUP && printf "$(color g w)*$(color -)$(color m w)*$(color -)$(color y w)*$(color -)$(color b w)*$(color -)" || printf "$logo"
fi
;;
*debian*)
logo=" @ "
$MARKUP && printf "$(color w r)%s$(color -)" "$logo" || printf "$logo"
;;
*fedora*)
logo=" f "
$MARKUP && printf "$(color b w)%s$(color -)" "$logo" || printf "$logo"
;;
*foresight*)
logo="<@>"
$MARKUP && printf "$(color b W g)%s$(color -)" "$logo" || printf "$logo"
;;
*gentoo*)
logo=" > "
$MARKUP && printf "$(color b c w)%s$(color -)" "$logo" || printf "$logo"
;;
*glinux*)
logo=" G "
# Green: 3cba54=71, Yellow: f4c20d=214, Red: db3236=167, Blue: 4885ed=69
$MARKUP && printf "$(color colour0 colour69)██$(color colour0 colour167)■$(color colour0 colour214)■$(color colour0 colour69)▄$(color colour0 colour71)█$(color colour0 colour167)■$(color -)" || printf "$logo"
;;
*mac*|*darwin*)
if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
# The Apple option character
#logo=" ⌘ "
# The Apple logo -- only visible from Mac terminals
logo=" "
else
logo=" X "
fi
$MARKUP && printf "$(color w k)%s$(color -)" "$logo" || printf "$logo"
;;
*mandriva*)
logo=" (* "
$MARKUP && printf "$(color b k c) ($(color -)$(color b k y)*$(color -) " || printf "$logo"
;;
*mint*)
logo=" lm "
$MARKUP && printf "$(color g w)$logo$(color -)$(color g w)$(color -) " || printf "$logo"
;;
*openwrt*)
logo="OWrt"
$MARKUP && printf "$(color b colour66 W)%s$(color -)" "$logo" || printf "$logo"
;;
*raspbian*)
logo=" @ "
$MARKUP && printf "$(color colour125 colour15)%s$(color -)" "$logo" || printf "$logo"
;;
*red*hat*|*rhel*)
logo=" RH "
$MARKUP && printf "$(color R k)%s$(color -)" "$logo" || printf "$logo"
;;
*rockhopper*)
logo="palm"
$MARKUP && printf "$(color k w)%s$(color -)" "$logo" || printf "$logo"
;;
*slackware*)
logo=".S "
$MARKUP && printf "$(color u B k)%s$(color -)" "$logo" || printf "$logo"
;;
*suse*)
logo="SUSE"
$MARKUP && printf "$(color W g)%s$(color -)" "$logo" || printf "$logo"
;;
*wolfi*)
logo=" * "
$MARKUP && printf "$(color m W)%s$(color -)" "$logo" || printf "$logo"
;;
*xandros*)
logo=" X "
$MARKUP && printf "$(color W r)%s$(color -)" "$logo" || printf "$logo"
;;
*)
if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
logo="〣"
else
logo="[B]"
fi
$MARKUP && printf "$(color b k W)%s$(color -)" "$logo" || printf " $logo "
;;
esac
printf " "
}
# vi: syntax=sh ts=4 noexpandtab
PK �]��&�� � hostnamenu ȯ�� #!/bin/sh -e
#
# hostname: report a host's name
#
# Copyright (C) 2008-2011 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__hostname_detail() {
hostname -f 2>/dev/null
}
__hostname() {
local h=
if eval $BYOBU_TEST hostname >/dev/null 2>&1; then
h=$(hostname -s 2>/dev/null || hostname)
elif [ -r /proc/sys/kernel/hostname ]; then
read h < /proc/sys/kernel/hostname
fi
if metadata_available; then
local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/hostname"
# Background a retrieval of our public hostname
timeout 0.2 wget -q -O- http://169.254.169.254/latest/meta-data/public-hostname </dev/null >"$cache" 2>/dev/null &
sleep 0.02
[ -s "$cache" ] && read h < "$cache"
fi
[ -n "$h" ] || return
color bold2; printf "%s" "$h"; color --
}
# vi: syntax=sh ts=4 noexpandtab
PK �]fQ9 9 mailnu ȯ�� #!/bin/sh -e
#
# mail: notify the user if they have system mail
#
# Copyright (C) 2009 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
MAILFILE="/var/spool/mail/$USER"
__mail_detail() {
[ ! -d "$MAILFILE" ] && [ -s "$MAILFILE" ] && ls -alF "$MAILFILE" 2>&1
[ -d "$MAILFILE/new" ] && ls -AlF "$MAILFILE/new" 2>&1
}
__mail() {
if [ -f "$MAILFILE" ] && [ -s "$MAILFILE" ]; then
color b; printf "%s" "$ICON_MAIL"; color --
elif [ -d "$MAILFILE/new" ] && "$(ls -A "$MAILFILE/new" 2>/dev/null)"; then
color b; printf "%s" "$ICON_MAIL"; color --
else
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/mail"*
fi
}
# vi: syntax=sh ts=4 noexpandtab
PK �]h��� swapnu ȯ�� #!/bin/sh -e
#
# mem_swap: show the current swap available and used
#
# Copyright (C) 2010 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__swap_detail() {
cat /proc/meminfo
}
__swap() {
local stotal="" sfree="" name="" val="" unit="" mem="" f="";
while read name val unit; do
if [ "$name" = "SwapTotal:" ]; then
stotal="$val"
elif [ "$name" = "SwapFree:" ]; then
sfree="$val"
else
continue
fi
[ -n "$stotal" -a -n "$sfree" ] && break;
done < /proc/meminfo
if [ "${stotal:-0}" = "0" ]; then
printf ""
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/swap"
else
mem=${stotal}
f=$(((100*($stotal-$sfree))/$stotal))
if [ $mem -ge 1048576 ]; then
fpdiv "${mem}" 1048576 1
mem=${_RET}
unit="$ICON_GB"
elif [ $mem -ge 1024 ]; then
fpdiv "${mem}" 1024 0
mem=${_RET}
unit="$ICON_MB"
else
mem="$mem"
unit="$ICON_KB"
fi
[ -n "$mem" ] || return
color b G k; printf "s%s" "$mem"; color -; color G k; printf "%s" "$unit"; color -;
color b G k; printf "%s" "$f"; color -; color G k; printf "%s" "$PCT"; color --
fi
}
# vi: syntax=sh ts=4 noexpandtab
PK �]"��� � customnu ȯ�� #!/bin/sh -e
#
# custom: run the user's custom status scripts
#
# Copyright (C) 2009 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__custom_detail() {
return
}
__custom() {
local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/custom"
local i= output=
for i in "$BYOBU_CONFIG_DIR/bin/"[0-9]*_*; do
# Loop over custom scripts
# Ensure executable
[ -x "$i" ] || continue
# Ignore vim backup files ending in ~
case "$i" in
*~) continue ;;
esac
local now="$(date +%s)"
local script=${i##*/}
local freq=${script%%_*}
freq=${freq#0}
local lastrun=
[ -r "$cache.$script.last" ] && read lastrun < "$cache.$script.last" || lastrun=0
local expiration=$(($lastrun+$freq))
if [ $now -ge $expiration ]; then
"$i" > "$cache.$script" 2>/dev/null
printf "%s\n" "${now}" > "$cache.$script.last"
fi
readfile < "$cache.$script"
local str="${_RET}"
case "$str" in
*"$ESC{"*)
# User has formatted the colors
output="$output$(printf "$str")"
;;
*)
# Default coloring
output="$output$str "
;;
esac
done
if [ -z "$output" ]; then
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/custom"*
return
fi
printf "$output" | $BYOBU_SED ':a;N;$!ba;s/\n//g'
}
# vi: syntax=sh ts=4 noexpandtab
PK �]��!,� � time_utcnu ȯ�� #!/bin/sh -e
#
# time_utc: print UTC time in HH:MM
#
# Copyright (C) 2010 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__time_utc_detail() {
date -u
}
__time_utc() {
d=$(date -u +%H:%M)
color invert; printf "%sUTC" "$d"; color --
}
# vi: syntax=sh ts=4 noexpandtab
PK �]c3�x� � packagesnu ȯ�� #!/bin/sh -e
#
# packages: count the number of packages installed
#
# Copyright (C) 2023 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__packages_detail() {
if eval $BYOBU_TEST dpkg >/dev/null 2>&1; then
dpkg -l | grep ^ii
fi
if eval $BYOBU_TEST snap >/dev/null 2>&1; then
snap list
fi
if eval $BYOBU_TEST apk >/dev/null 2>&1; then
apk info
fi
return
}
__packages() {
local packages=0
if eval $BYOBU_TEST dpkg >/dev/null 2>&1; then
count=$(dpkg -l | grep -c ^ii)
packages=$((packages+count))
fi
if eval $BYOBU_TEST snap >/dev/null 2>&1; then
count=$(snap list | grep -c -v "^Name\s")
packages=$((packages+count))
fi
if eval $BYOBU_TEST apk >/dev/null 2>&1; then
count=$(apk info | wc -l)
packages=$((packages+count))
fi
[ -n "$packages" ] || return
color w y; printf "[%s]" "$count"; color --;
}
# vi: syntax=sh ts=4 noexpandtab
PK �]�Q��9 9 timenu ȯ�� #!/bin/sh -e
#
# time: print the time in HH:MM:SS format
#
# Copyright (C) 2008 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__time_detail() {
date
}
__time() {
local secs=1
[ -n "$TIME_SECONDS" ] && secs=$TIME_SECONDS
case "$BYOBU_BACKEND" in
screen)
format="\0050c"
[ "$secs" != "0" ] && format="$format:\005s"
printf $format
;;
esac
}
# vi: syntax=sh ts=4 noexpandtab
PK �]U�7j� � trashnu ȯ�� #!/bin/sh -e
#
# trash: show icon (and optionally count) if entries in trash.
#
# Copyright (C) 2011 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: James Hunt <james.hunt@canonical.com>
# Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
TRASH_DIR="$HOME/.local/share/Trash/files"
__trash_detail() {
find "$TRASH_DIR"
}
__trash() {
local count
[ -d "$TRASH_DIR" ] || return
count=$(ls $dir|wc -l)
[ "$count" = "0" ] && return
printf "%s[%s]" "$ICON_TRASH" "$count"
}
# vi: syntax=sh ts=4 noexpandtab
PK �]Ĩ �s
s
memorynu ȯ�� #!/bin/sh -e
#
# mem_available: grab the current memory and usage
#
# Copyright (C) 2008 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__memory_detail() {
free
}
__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
while read tok val unit; do
case "$tok" in
MemTotal:) total=${val};;
MemFree:) free=${val};;
Buffers:) buffers=${val};;
Cached:) cached=${val};;
esac
[ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;
done < /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
free_blocks=$(vm_stat | grep free | awk '{ print $3 }' | sed -e 's/\.//')
inactive_blocks=$(vm_stat | grep inactive | awk '{ print $3 }' | sed -e 's/\.//')
speculative_blocks=$(vm_stat | grep speculative | awk '{ print $3 }' | sed -e 's/\.//')
free=$((($free_blocks+speculative_blocks)*4))
inactive=$(($inactive_blocks*4))
total=$((($free+$inactive)))
buffers=0
cached=0
fi
kb_main_used=$(($total-$free))
buffers_plus_cached=$(($buffers+$cached))
# "free output" buffers and cache (output from 'free')
fo_buffers=$(($kb_main_used - $buffers_plus_cached))
fpdiv $((100*${fo_buffers})) "${total}" 0;
usage=${_RET}
if [ $total -ge 1048576 ]; then
fpdiv "$total" 1048567 1
total=${_RET}
unit="$ICON_GB"
elif [ $total -ge 1024 ]; then
fpdiv "$total" 1024 0
total=${_RET}
unit="$ICON_MB"
else
unit="$ICON_KB"
fi
if [ $usage -gt 90 ]; then
# Change foreground to yellow, if usage over 90%
fg="Y"
else
fg="W"
fi
[ -n "$total" ] || return
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 --
}
# vi: syntax=sh ts=4 noexpandtab
PK �]�oyg cpu_countnu ȯ�� #!/bin/sh -e
#
# cpu_count: count cpu's on a systems
#
# Copyright (C) 2008 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__cpu_count_detail() {
grep -i "^model name" /proc/cpuinfo
}
__cpu_count() {
local c
c=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo)
[ "$c" = "1" ] || printf "%sx" "$c"
}
# vi: syntax=sh ts=4 noexpandtab
PK �]�� � � disk_ionu ȯ�� #!/bin/sh -e
#
# disk_io: calculate the disk io rate
#
# Copyright (C) 2010 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__disk_io_detail() {
if eval $BYOBU_TEST iostat >/dev/null; then
iostat -d -m -h
else
printf "%s\n" "Please install iostat if you want detailed information on your disk throughput"
fi
}
getdisk() {
local t=""
if [ -L "${1}" ]; then
t=$($BYOBU_READLINK -f "$1")
else
t="$1"
fi
t="${t##*/}";
[ -h "/sys/block/$t" ] && _RET="$t" || rtrim "$t" "0-9"
}
__disk_io() {
local part= i=
# Default to disk providing /, but let users override with MONITORED_DISK
[ -z "$MONITORED_DISK" ] && mount_point="/" || mount_point="$MONITORED_DISK"
# By default, we won't bug the user with the display of network traffic
# below DISK_IO_THRESHOLD in kB/s; override in $BYOBU_CONFIG_DIR/status
[ -n "$DISK_IO_THRESHOLD" ] || DISK_IO_THRESHOLD=50
case "$mount_point" in
/dev/*) part="${mount_point}";;
*) part=$(awk '$2 == mp { print $1 ; exit(0); }' "mp=$mount_point" /etc/mtab);;
esac
[ -e "$part" ] || return
getdisk "$part"
local disk=${_RET}
local t2=$(date +%s) t1=
for i in "read" "write"; do
local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/disk.$i"
t1=$(stat -c %Y "$cache") 2>/dev/null || t1=0
local unit="kB/s"
local rate=0 x1=0 x2=0 symbol= unit=
if [ $t2 -le $t1 ]; then
rate=0
else
[ -r "$cache" ] && read x1 < "$cache"
local a1= a2= a3= a4= a5= a6= a7= a8= a9= a10=
read a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 other < "/sys/block/$disk/stat"
if [ "$i" = "read" ]; then
symbol="$ICON_RD"
[ -n "$a3" ] && x2="$a3" || x2=0
else
symbol="$ICON_WR"
[ -n "$a7" ] && x2="$a7" || x2=0
fi
printf "%s" "$x2" > "$cache"
rate=$((($x2 - $x1) / ($t2 - $t1) * 512 / 1024))
if [ $rate -lt $DISK_IO_THRESHOLD ]; then
# Below threshold, don't print
continue
elif [ "$rate" -lt 0 ]; then
rate=0
elif [ "$rate" -gt 1048576 ]; then
unit="GB/s"
fpdiv "$rate" 1048576 0
rate=${_RET}
elif [ "$rate" -gt 1024 ]; then
unit="MB/s"
fpdiv "$rate" 1024 0
rate=${_RET}
else
unit="kB/s"
fi
fi
if [ -z "$rate" ] || [ "$rate" = "0" ]; then
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/disk_io"*
else
color b M W; printf "%s%s" "$symbol" "$rate"; color -; color M W; printf "%s" "$unit"; color --
fi
done
}
# vi: syntax=sh ts=4 noexpandtab
PK �]�?t� wifi_qualitynu ȯ�� #!/bin/sh -e
#
# wifi_quality: display wifi signal quality
#
# Copyright (C) 2008 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
___get_dev_list() {
if [ -n "$MONITORED_NETWORK" ]; then
echo "$MONITORED_NETWORK"
else
iw dev | grep Interface | cut -f2 -d\
fi
}
__wifi_quality_detail() {
if eval $BYOBU_TEST iw >/dev/null 2>&1; then
local dev
for dev in $(___get_dev_list); do
iw dev "$dev" info
iw dev "$dev" link
echo
done
elif eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then
iwconfig 2>/dev/null
fi
}
__wifi_quality() {
local out bitrate quality
if eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then
# iwconfig is expected to output lines like:
# Bit Rate=54 Mb/s Tx-Power=15 dBm
# Link Quality=60/70 Signal level=-50 dBm
# the awk below tokenizes the output and prints shell evalable results
out=`iwconfig $MONITORED_NETWORK 2>/dev/null |
awk '$0 ~ /[ ]*Link Quality./ {
sub(/.*=/,"",$2); split($2,a,"/");
printf "quality=%.0f\n", 100*a[1]/a[2] };
$0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); }
'`
eval "$out"
elif eval $BYOBU_TEST iw >/dev/null 2>&1; then
local dev
for dev in $(___get_dev_list); do
# iw is expected to output lines like:
# signal: -50 dBm
# rx bitrate: 216.0 MBit/s MCS 13 40MHz
# signal to quality: https://superuser.com/a/1360447
out=`iw dev "$dev" link 2>/dev/null |
awk '$0 ~ /^\s*signal:/ { a = 100 * ($2 + 110) / 70;
printf "quality=%.0f\n", (a > 100) ? 100 : ((a < 0) ? 0 : a); }
$0 ~ /^\s*rx bitrate:/ { printf "bitrate=%s\n", $3; }
'`
eval "$out"
[ -z "$bitrate" ] || [ -z "$quality" ] || break
done
fi
[ -n "$bitrate" ] || bitrate=0
[ -n "$quality" ] || quality=0
if [ "$bitrate" -gt 0 ] && [ "$quality" -gt 0 ]; then
printf "${ICON_WIFI}"; color b C k; printf "%s" "$bitrate"; color -; color C k; printf "%s" "$ICON_MBPS"; color -; color b C k; printf "%s" "$quality"; color -; color C k; printf "%s" "$PCT"; color --
else
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/wifi_quality"*
fi
}
# vi: syntax=sh ts=4 noexpandtab
PK �]��`+h h networknu ȯ�� #!/bin/sh -e
#
# network: calculate the network up/down rates
#
# Copyright (C) 2008 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__network_detail() {
get_network_interface; local interface="$_RET"
LC_ALL=C /sbin/ip addr show "$interface" | $BYOBU_SED 's/\s*$//'
}
__network() {
get_network_interface; local interface="$_RET"
local x1=0 x2=0 tx1=0 i= t= unit= symbol= cache= rate=
status_freq network
t="$_RET"
# By default, we won't bug the user with the display of network traffic
# below NETWORK_THRESHOLD in kbps; override in $BYOBU_CONFIG_DIR/status
[ -n "$NETWORK_THRESHOLD" ] || NETWORK_THRESHOLD=20
for i in up down; do
unit="kb"
case $i in
up) symbol="$ICON_UP" ;;
down) symbol="$ICON_DN" ;;
esac
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
while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do
case "$iface" in
${interface}:)
[ "$i" = "up" ] && x2=${tbytes} || x2=${rbytes}
break;
;;
${interface}:*)
# Interface and tbytes got munged together
[ "$i" = "up" ] && x2=${rmulticast##*:} || x2=${iface##*:}
break;
;;
esac
done < "$cache".dev
printf "%s" "$x2" > "$cache"
rate=$((8*($x2 - $x1) / $t / 1024)) # in kbps
[ "$rate" -lt 0 ] && rate=0
if [ $rate -gt $NETWORK_THRESHOLD ]; then
case "$NETWORK_UNITS" in
bytes)
rate=$(($rate/8))
if [ "$rate" -gt 1048576 ]; then
fpdiv "$rate" 1048576 1
rate=${_RET}
unit="GB/s"
elif [ "$rate" -gt 1024 ]; then
fpdiv "$rate" 1024 1
rate=${_RET}
unit="MB/s"
else
unit="kB/s"
fi
;;
*)
# Default to bps
# Why 1000 and not 1024? http://en.wikipedia.org/wiki/Data_rate_units
if [ "$rate" -gt 1000000 ]; then
fpdiv "$rate" 1000000 1
rate=${_RET}
unit="Gb"
elif [ "$rate" -gt 1000 ]; then
fpdiv "$rate" 1000 1
rate=${_RET}
unit="Mb"
fi
;;
esac
[ -n "$rate" ] || continue
color b m w; printf "%s%s" "$symbol" "$rate"; color -; color m w; printf "%s" "$unit"; color --
else
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/network"*
fi
done
}
# vi: syntax=sh ts=4 noexpandtab
PK �]퍽zZ Z cpu_freqnu ȯ�� #!/bin/sh -e
#
# cpu_freq: calculate current cpu frequency
#
# Copyright (C) 2008 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__cpu_freq_detail() {
cat /proc/cpuinfo
}
__cpu_freq() {
local hz freq count
if [ -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"
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 }')
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 }')
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
fpdiv $hz "1000000000" 1 # 1Ghz
freq="$_RET"
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
PK �]/�z z processesnu ȯ�� #!/bin/sh -e
#
# processes: report number of running processes
#
# Copyright (C) 2008 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__processes_detail() {
ps -ej 2>/dev/null
}
__processes() {
local count=
if [ -r /proc ]; then
count=$(ls -d /proc/[0-9]* 2>/dev/null | wc -l)
else
count=$(ps -ef | wc -l)
fi
[ -n "$count" ] || return
color b y w; printf "%s" "$count"; color -; color y w; printf "&"; color --
}
# vi: syntax=sh ts=4 noexpandtab
PK �]p7�% % colornu ȯ�� #!/bin/sh -e
#
# color: print the background/foreground color escape codes
#
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__color_detail() {
true
}
__color() {
[ -z "$FOREGROUND" ] && FOREGROUND="w"
[ -z "$BACKGROUND" ] && BACKGROUND="k"
case "$BYOBU_BACKEND" in
tmux)
true
;;
screen)
printf "\005{= $BACKGROUND$FOREGROUND}"
;;
esac
}
# vi: syntax=sh ts=4 noexpandtab
PK �]%��� usersnu ȯ�� #!/bin/sh -e
#
# users: print the number of remote users on the machine
#
# Copyright (C) 2009 Raphaël Pinson.
# Copyright (C) 2009 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Raphaël Pinson <raphink@ubuntu.com>
# Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__users_detail() {
ps -ef 2>/dev/null | grep "sshd:.*@" | grep -v grep
}
__users() {
local count=0
if [ "$USERS_DISTINCT" = "1" ]; then
count=$(pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l)
else
# Note: we'd like to use pgrep -c, however, this isn't available in
# 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
if [ $count -gt 0 ]; then
color b w r; printf "%d" "$count"; color -; color w r; printf "##"; color --
else
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"*
fi
}
# vi: syntax=sh ts=4 noexpandtab
PK �]���f f fan_speednu ȯ�� #!/bin/sh -e
#
# fan_speed: speed of the cpu or case fan
#
# Copyright (C) 2009 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__fan_speed_detail() {
# Nothing interesting to say here about fan speed
return
}
__fan_speed() {
local i="" speed=0
# Let's check a few different probes for fan speed
# This seems to cover most of them:
for i in $FAN /sys/class/hwmon/*/*/fan1_input /sys/class/hwmon/*/device/hwmon/*/fan1_input; do
[ -f "$i" ] || continue
read speed < "$i"
if [ -n "$speed" ] && [ "$speed" -gt 0 ]; then
color bold1; printf "%s" "$speed"; color -; color none; printf "rpm"; color --
return 0
fi
done
# But others (e.g. Dell Inspirons) seem to be here:
if [ -r /proc/i8k ]; then
local line=""
read line < /proc/i8k
set -- $line
for speed in $7 $8; do
if [ -n "$speed" ] && [ "$speed" -gt 0 ]; then
# I8K_FAN_MULT defaults to 30 (buggy BIOS workaround?),
# use `modprobe i8k fan_mult=1` to disable if unneeded,
# resulting in nonsensical speeds
[ "$speed" -gt 10000 ] && speed=$((${speed} / 30))
color bold1; printf "%s" "$speed"; color -; color none; printf "rpm"; color --
return 0
fi
done
fi
}
# vi: syntax=sh ts=4 noexpandtab
PK �].�S�b b servicesnu ȯ�� #!/bin/sh -e
#
# services: show what services are running on this server (configurable)
#
# Copyright (C) 2009 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__services_detail() {
return
}
service_running() {
if [ -f "/etc/init/$1.conf" ]; then
# Use upstart
case "$(status $1 2>/dev/null)" in
*running*)
true
;;
*)
false
;;
esac
elif [ -f "/etc/init.d/$1" ]; then
# Fall back to sysvinit
/etc/init.d/$1 status >/dev/null 2>&1
else
false
fi
}
__services() {
local services="$SERVICES"
# Users can define a list of services to monitor in $BYOBU_CONFIG_DIR/status
if [ -z "$services" ]; then
if [ -f "/etc/eucalyptus/eucalyptus.conf" ]; then
# If the user has not defined any services, but this system is a
# UEC system, default to the list of Ubuntu Enterprise Cloud Services
services="eucalyptus-cloud|CLC eucalyptus-walrus|WC eucalyptus-cc|CC eucalyptus-sc|SC eucalyptus-nc|NC"
fi
fi
output=
for i in $services; do
service=${i%|*}
nick=${i#*|}
case "$service" in
eucalyptus-nc)
if service_running $service; then
# This is a node controller, determine VM usage
. /etc/eucalyptus/eucalyptus.conf
count=$(pgrep -c -f /usr/bin/kvm || true)
output="$output,NC:$count"
fi
;;
*)
service_running $service && output="$output,$nick"
;;
esac
done
[ -n "$output" ] || return
color w c; printf "%s" ${output#,}; color --
}
# vi: syntax=sh ts=4 noexpandtab
PK �]��� � archnu ȯ�� #!/bin/sh -e
#
# arch: print the machine architecture
#
# Copyright (C) 2008 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__arch_detail() {
uname -a
}
__arch() {
printf "%s " $(uname -m)
}
# vi: syntax=sh ts=4 noexpandtab
PK �]H?�� �
ip_addressnu ȯ�� #!/bin/sh -e
#
# ip_address: report a host's ip address
#
# Copyright (C) 2008-2011 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__ip_address_detail() {
if [ -x /sbin/ip ]; then
/sbin/ip -4 addr list
/sbin/ip -6 addr list
fi
}
__ip_address() {
local interface ipaddr cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/ip_address"
# Allow interface overrides in $BYOBU_CONFIG_DIR/statusrc
if [ -n "$MONITORED_NETWORK" ]; then
interface="$MONITORED_NETWORK"
else
case "$IPV6" in
1|true|yes) interface=$(awk '$10 != "lo" { iface=$10 ; }; END { print iface; }' /proc/net/ipv6_route);;
*) get_network_interface; interface="$_RET";;
esac
fi
case "$IPV6" in
1|true|yes)
if [ "$IP_EXTERNAL" = "1" ]; then
# Background an update
timeout 1 wget -q -O- http://v6.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
sleep 0.02
else
# Background an update
if [ -x /sbin/ip ]; then
LC_ALL=C /sbin/ip -6 addr list dev "$interface" scope global </dev/null >"$cache" 2>/dev/null &
elif eval $BYOBU_TEST ifconfig >/dev/null 2>&1; then
LC_ALL=c ifconfig "$interface" | grep "inet6 " | awk '{print $2}' | sed -e "s/%.*//" >"$cache" 2>/dev/null &
fi
fi
[ -s "$cache" ] && read ipaddr < "$cache"
# Print 'None' if we have no global address
[ -z "$ipaddr" ] && ipaddr="None"
ipaddr=${ipaddr#* inet6 }
ipaddr=${ipaddr%%/*}
;;
*)
if [ "$IP_EXTERNAL" = "1" ]; then
timeout 1 wget -q -O- http://v4.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
sleep 0.02
[ -s "$cache" ] && read ipaddr < "$cache"
elif metadata_available; then
# We're in EC2, so get our public IP address
timeout 0.2 wget -q -O- http://169.254.169.254/latest/meta-data/public-ipv4 </dev/null >"$cache" 2>/dev/null &
sleep 0.02
[ -s "$cache" ] && read ipaddr < "$cache"
else
if [ -x /sbin/ip ]; then
ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global 2>/dev/null)
ipaddr=${ipaddr#* inet }
ipaddr=${ipaddr%%/*}
elif eval $BYOBU_TEST ifconfig >/dev/null 2>&1; then
ipaddr=$(ifconfig "$interface" | grep "inet " | awk '{print $2}')
fi
fi
;;
esac
if [ -n "$ipaddr" ]; then
if [ "$1" = "t" ]; then
printf "%s" "$ipaddr"
else
color b w k; printf "%s" "$ipaddr"; color --
fi
fi
}
# vi: syntax=sh ts=4 noexpandtab
PK �]m[��
whoaminu ȯ�� #!/bin/sh -e
#
# whoami: report current logged in user
#
# Copyright (C) 2008 Canonical Ltd.
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
___get_user() {
if eval $BYOBU_TEST whoami >/dev/null 2>&1; then
whoami
elif eval $BYOBU_TEST id >/dev/null 2>&1; then
id -un
fi
}
__whoami_detail() {
local user=$(___get_user)
[ -n "$user" ] || return
if eval $BYOBU_TEST getent >/dev/null 2>&1; then
getent -- passwd "$user"
else
grep "^$user:" /etc/passwd
fi
}
__whoami() {
local user=$(___get_user)
[ -n "$user" ] || return
color bold2; printf "%s@" "$user"; color -
}
# vi: syntax=sh ts=4 noexpandtab
PK �]i) ) sessionnu ȯ�� #!/bin/sh -e
#
# session: tmux session name
#
# Copyright (C) 2013-2014 Dustin Kirkland <kirkland@byobu.org>
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__session_detail() {
tmux list-sessions
}
__session() {
# Note: This will only work in byobu-tmux
case "$BYOBU_BACKEND" in
tmux)
local count=$(tmux list-sessions 2>/dev/null | grep -v "^_" | wc -l)
if [ $count -gt 1 ]; then
color u W k; printf "${ICON_SESSION}#S"; color --
else
echo
fi
;;
screen)
local count=$(screen -ls | grep "^\s\+.*)$" | wc -l)
if [ $count -gt 1 ]; then
color u W k; printf "${ICON_SESSION}%S"; color --
else
echo
fi
;;
esac
}
# vi: syntax=sh ts=4 noexpandtab
PK �])/�� � include/commonnu ȯ�� #!/bin/sh
#
# common: common stuff sourced by all scripts
#
# Copyright (C) 2011-2014 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if [ -z "${BYOBU_INCLUDED_LIBS}" ]; then
# Needed to set up $BYOBU_CONFIG_DIR
. "${BYOBU_PREFIX}/lib/${PKG}/include/dirs"
# Find command/type/which
for BYOBU_TEST in "command -v" "type" "which"; do
eval $BYOBU_TEST ls >/dev/null 2>&1 && break || true
done
# If the backend is already set (eg. running `byobu-tmux`), do nothing.
if [ -z "${BYOBU_BACKEND}" ]; then
[ -r "/etc/$PKG/backend" ] && . "/etc/$PKG/backend"
[ -r "$BYOBU_CONFIG_DIR/backend" ] && . "$BYOBU_CONFIG_DIR/backend"
# Just in case there's no config file at all
if [ -z "${BYOBU_BACKEND}" ]; then
# New byobu configuration, default to tmux
if eval $BYOBU_TEST tmux >/dev/null; then
BYOBU_BACKEND="tmux"
elif eval $BYOBU_TEST screen >/dev/null; then
BYOBU_BACKEND="screen"
else
printf "%s\n" "ERROR: $PKG won't work without tmux or screen installed" 1>&2
fi
fi
fi
# Creating backend cache
[ -d "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND"
. "${BYOBU_PREFIX}/lib/${PKG}/include/shutil"
. "${BYOBU_PREFIX}/lib/${PKG}/include/constants"
get_distro || true
export BYOBU_DISTRO="$_RET"
BYOBU_INCLUDED_LIBS=1
fi
PK �]��Ļ � &