* usr/lib/byobu/hostname, usr/lib/byobu/ip_address:

- in EC2, use metadata for ip and hostname, far more useful
    in that environment
This commit is contained in:
Dustin Kirkland 2011-06-16 10:15:12 -05:00
commit d727b382a0
3 changed files with 22 additions and 9 deletions

3
debian/changelog vendored
View file

@ -11,6 +11,9 @@ byobu (4.12) unreleased; urgency=low
- update docs to reflect reality - update docs to reflect reality
* usr/share/byobu/profiles/tmux: * usr/share/byobu/profiles/tmux:
- added an early draft of a tmux profile - added an early draft of a tmux profile
* usr/lib/byobu/hostname, usr/lib/byobu/ip_address:
- in EC2, use metadata for ip and hostname, far more useful
in that environment
-- Dustin Kirkland <kirkland@ubuntu.com> Sun, 12 Jun 2011 23:37:24 -0500 -- Dustin Kirkland <kirkland@ubuntu.com> Sun, 12 Jun 2011 23:37:24 -0500

View file

@ -1,9 +1,9 @@
#!/bin/sh -e #!/bin/sh -e
# #
# hostname - report a host's name # hostname - report a host's name
# Copyright (C) 2008 Canonical Ltd. # Copyright (C) 2008-2011 Canonical Ltd.
# #
# Authors: Dustin Kirkland <kirkland@canonical.com> # Authors: Dustin Kirkland <kirkland@ubuntu.com>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -26,6 +26,11 @@ if [ "$1" = "--detail" ]; then
exit 0 exit 0
fi fi
. "$DATA/status" if host 169.254.169.254 >/dev/null 2>&1; then
# We're in EC2, so get our public hostname
h=$(wget -q -O - http://169.254.169.254/latest/meta-data/public-hostname)
else
h=$(hostname -s 2>/dev/null || hostname)
fi
color bold2; printf "%s" "$(hostname -s 2>/dev/null || hostname)"; color -- color bold2; printf "%s" "$h "; color --

View file

@ -1,9 +1,9 @@
#!/bin/sh -e #!/bin/sh -e
# #
# ip_address - report a host's ip address # ip_address - report a host's ip address
# Copyright (C) 2008 Canonical Ltd. # Copyright (C) 2008-2011 Canonical Ltd.
# #
# Authors: Dustin Kirkland <kirkland@canonical.com> # Authors: Dustin Kirkland <kirkland@ubuntu.com>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -51,9 +51,14 @@ case "$IPV6" in
ipaddr=${ipaddr%%/*} ipaddr=${ipaddr%%/*}
;; ;;
*) *)
ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global) if host 169.254.169.254 >/dev/null 2>&1; then
ipaddr=${ipaddr#* inet } # We're in EC2, so get our public IP address
ipaddr=${ipaddr%%/*} ipaddr=$(wget -q -O- http://169.254.169.254/latest/meta-data/public-ipv4)
else
ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global)
ipaddr=${ipaddr#* inet }
ipaddr=${ipaddr%%/*}
fi
;; ;;
esac esac