mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 06:23:19 -07:00
* usr/bin/byobu-launch, usr/lib/byobu/ec2_cost,
usr/lib/byobu/hostname, usr/lib/byobu/include/shutil, usr/lib/byobu/ip_address: - work around checkbashisms false positives
This commit is contained in:
parent
c86b19813b
commit
ba71101c39
6 changed files with 17 additions and 12 deletions
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -2,6 +2,10 @@ byobu (5.52) unreleased; urgency=low
|
||||||
|
|
||||||
* usr/bin/byobu-janitor:
|
* usr/bin/byobu-janitor:
|
||||||
- ensure byobu can be purged without breaking a bashrc
|
- ensure byobu can be purged without breaking a bashrc
|
||||||
|
* usr/bin/byobu-launch, usr/lib/byobu/ec2_cost,
|
||||||
|
usr/lib/byobu/hostname, usr/lib/byobu/include/shutil,
|
||||||
|
usr/lib/byobu/ip_address:
|
||||||
|
- work around checkbashisms false positives
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 05 Aug 2013 08:38:30 +0100
|
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 05 Aug 2013 08:38:30 +0100
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,8 @@ elif [ "$BYOBU_SOURCED_PROFILE" != "1" ] && [ "$LC_BYOBU" != "0" ] && [ "$BYOBU_
|
||||||
[ -z "$_byobu_sourced" ] && [ -r "$HOME/.profile" ] && . "$HOME/.profile"
|
[ -z "$_byobu_sourced" ] && [ -r "$HOME/.profile" ] && . "$HOME/.profile"
|
||||||
if byobu-launcher; then
|
if byobu-launcher; then
|
||||||
# Wait very briefly for the no-logout flag to get written?
|
# Wait very briefly for the no-logout flag to get written?
|
||||||
sleep 0.1
|
local brief="0.1"
|
||||||
|
sleep $brief
|
||||||
if [ -e "$BYOBU_CONFIG_DIR/no-logout-on-detach" ] || [ -e "$BYOBU_RUN_DIR/no-logout" ]; then
|
if [ -e "$BYOBU_CONFIG_DIR/no-logout-on-detach" ] || [ -e "$BYOBU_RUN_DIR/no-logout" ]; then
|
||||||
# The user does not want to logout on byobu detach
|
# The user does not want to logout on byobu detach
|
||||||
rm -f "$BYOBU_RUN_DIR/no-logout" # Remove one-time no-logout flag, if it exists
|
rm -f "$BYOBU_RUN_DIR/no-logout" # Remove one-time no-logout flag, if it exists
|
||||||
|
|
|
@ -32,17 +32,17 @@ __ec2_cost_detail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
__ec2_cost() {
|
__ec2_cost() {
|
||||||
local zone type file_to_stat cpu mem rate hours tx_gb rx_gb network_cost uptime_cost total_cost interface cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/ec2_cost"
|
local zone type file_to_stat cpu mem rate hours tx_gb rx_gb network_cost uptime_cost total_cost interface cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/ec2_cost" brief="0.02"
|
||||||
if [ -s "$cache.rate" ]; then
|
if [ -s "$cache.rate" ]; then
|
||||||
read rate < "$cache.rate"
|
read rate < "$cache.rate"
|
||||||
elif metadata_available; then
|
elif metadata_available; then
|
||||||
# Try to use metadata service
|
# Try to use metadata service
|
||||||
[ -s "$cache.zone" ] || wget -q -O- http://169.254.169.254/latest/meta-data/placement/availability-zone </dev/null >"$cache.zone" 2>/dev/null &
|
[ -s "$cache.zone" ] || wget -q -O- http://169.254.169.254/latest/meta-data/placement/availability-zone </dev/null >"$cache.zone" 2>/dev/null &
|
||||||
sleep 0.02
|
sleep $brief
|
||||||
[ -s "$cache.zone" ] && read zone < "$cache.zone"
|
[ -s "$cache.zone" ] && read zone < "$cache.zone"
|
||||||
zone=${zone%%[a-z]}
|
zone=${zone%%[a-z]}
|
||||||
[ -s "$cache.type" ] || wget -q -O- http://169.254.169.254/latest/meta-data/instance-type </dev/null >"$cache.type" 2>/dev/null &
|
[ -s "$cache.type" ] || wget -q -O- http://169.254.169.254/latest/meta-data/instance-type </dev/null >"$cache.type" 2>/dev/null &
|
||||||
sleep 0.02
|
sleep $brief
|
||||||
[ -s "$cache.type" ] && read type < "$cache.type"
|
[ -s "$cache.type" ] && read type < "$cache.type"
|
||||||
$BYOBU_PREFIX/lib/byobu/include/ec2instancespricing.py --type ondemand --filter-region $zone --filter-type $type --filter-os-type linux --format csv | tail -n1 > "$cache.rate"
|
$BYOBU_PREFIX/lib/byobu/include/ec2instancespricing.py --type ondemand --filter-region $zone --filter-type $type --filter-os-type linux --format csv | tail -n1 > "$cache.rate"
|
||||||
read rate < "$cache.rate"
|
read rate < "$cache.rate"
|
||||||
|
|
|
@ -24,12 +24,12 @@ __hostname_detail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
__hostname() {
|
__hostname() {
|
||||||
local h=
|
local h= brief="0.02"
|
||||||
if metadata_available; then
|
if metadata_available; then
|
||||||
local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/hostname"
|
local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/hostname"
|
||||||
# Background a retrieval of our public hostname
|
# Background a retrieval of our public hostname
|
||||||
wget -q -O- http://169.254.169.254/latest/meta-data/public-hostname </dev/null >"$cache" 2>/dev/null &
|
wget -q -O- http://169.254.169.254/latest/meta-data/public-hostname </dev/null >"$cache" 2>/dev/null &
|
||||||
sleep 0.02
|
sleep $brief
|
||||||
[ -s "$cache" ] && read h < "$cache"
|
[ -s "$cache" ] && read h < "$cache"
|
||||||
else
|
else
|
||||||
h=$(hostname -s 2>/dev/null || hostname)
|
h=$(hostname -s 2>/dev/null || hostname)
|
||||||
|
|
|
@ -209,7 +209,7 @@ metadata_available() {
|
||||||
# This is really ugly. We need a reliable, fast way of determining
|
# This is really ugly. We need a reliable, fast way of determining
|
||||||
# if a metadata service is available, that does NOT slow down non-ec2
|
# if a metadata service is available, that does NOT slow down non-ec2
|
||||||
# machines.
|
# machines.
|
||||||
local x=0 cache="$BYOBU_CONFIG_DIR/.metadata_available"
|
local x=0 cache="$BYOBU_CONFIG_DIR/.metadata_available" brief="0.02"
|
||||||
# First, check the cache
|
# First, check the cache
|
||||||
if [ -s "$cache" ]; then
|
if [ -s "$cache" ]; then
|
||||||
# Metadata is non-empty, so we have metadata available
|
# Metadata is non-empty, so we have metadata available
|
||||||
|
@ -219,7 +219,7 @@ metadata_available() {
|
||||||
if [ -e /etc/ec2_version ] || [ -e /usr/sbin/update-grub-legacy-ec2 ]; then
|
if [ -e /etc/ec2_version ] || [ -e /usr/sbin/update-grub-legacy-ec2 ]; then
|
||||||
# This *looks* like a machine with metadata, so background a potentially slow check
|
# This *looks* like a machine with metadata, so background a potentially slow check
|
||||||
wget -q -O- --timeout=10 --tries=1 http://169.254.169.254 </dev/null >"$cache" 2>/dev/null &
|
wget -q -O- --timeout=10 --tries=1 http://169.254.169.254 </dev/null >"$cache" 2>/dev/null &
|
||||||
sleep 0.02
|
sleep $brief
|
||||||
[ -s "$cache" ] && x=1
|
[ -s "$cache" ] && x=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -28,7 +28,7 @@ __ip_address_detail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
__ip_address() {
|
__ip_address() {
|
||||||
local interface ipaddr cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/ip_address"
|
local interface ipaddr cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/ip_address" brief="0.02"
|
||||||
# Allow interface overrides in $BYOBU_CONFIG_DIR/statusrc
|
# Allow interface overrides in $BYOBU_CONFIG_DIR/statusrc
|
||||||
if [ -n "$MONITORED_NETWORK" ]; then
|
if [ -n "$MONITORED_NETWORK" ]; then
|
||||||
interface="$MONITORED_NETWORK"
|
interface="$MONITORED_NETWORK"
|
||||||
|
@ -43,7 +43,7 @@ __ip_address() {
|
||||||
if [ "$IP_EXTERNAL" = "1" ]; then
|
if [ "$IP_EXTERNAL" = "1" ]; then
|
||||||
# Background an update
|
# Background an update
|
||||||
wget -q -O- http://v6.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
|
wget -q -O- http://v6.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
|
||||||
sleep 0.02
|
sleep $brief
|
||||||
else
|
else
|
||||||
# Background an update
|
# Background an update
|
||||||
if [ -x /sbin/ip ]; then
|
if [ -x /sbin/ip ]; then
|
||||||
|
@ -62,12 +62,12 @@ __ip_address() {
|
||||||
*)
|
*)
|
||||||
if [ "$IP_EXTERNAL" = "1" ]; then
|
if [ "$IP_EXTERNAL" = "1" ]; then
|
||||||
wget -q -O- http://v4.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
|
wget -q -O- http://v4.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
|
||||||
sleep 0.02
|
sleep $brief
|
||||||
[ -s "$cache" ] && read ipaddr < "$cache"
|
[ -s "$cache" ] && read ipaddr < "$cache"
|
||||||
elif metadata_available; then
|
elif metadata_available; then
|
||||||
# We're in EC2, so get our public IP address
|
# We're in EC2, so get our public IP address
|
||||||
wget -q -O- http://169.254.169.254/latest/meta-data/public-ipv4 </dev/null >"$cache" 2>/dev/null &
|
wget -q -O- http://169.254.169.254/latest/meta-data/public-ipv4 </dev/null >"$cache" 2>/dev/null &
|
||||||
sleep 0.02
|
sleep $brief
|
||||||
[ -s "$cache" ] && read ipaddr < "$cache"
|
[ -s "$cache" ] && read ipaddr < "$cache"
|
||||||
else
|
else
|
||||||
if [ -x /sbin/ip ]; then
|
if [ -x /sbin/ip ]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue