From 2fa9ed3401521724b0fbda39bec831c2848e7c67 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Mon, 1 Aug 2011 23:44:06 -0500 Subject: [PATCH] * usr/bin/byobu-janitor, usr/lib/byobu/.shutil: - get ec2 cost automatically working again in ec2 instances --- debian/changelog | 3 ++- usr/bin/byobu-janitor | 4 ++++ usr/lib/byobu/.shutil | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 842cfd83..0adda56f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ byobu (4.24) unreleased; urgency=low - * UNRELEASED + * usr/bin/byobu-janitor, usr/lib/byobu/.shutil: + - get ec2 cost automatically working again in ec2 instances -- Dustin Kirkland Thu, 28 Jul 2011 01:17:54 -0500 diff --git a/usr/bin/byobu-janitor b/usr/bin/byobu-janitor index 28b66faf..347046db 100755 --- a/usr/bin/byobu-janitor +++ b/usr/bin/byobu-janitor @@ -58,6 +58,10 @@ for f in status statusrc; do if [ ! -r "$BYOBU_CONFIG_DIR/$f" ]; then # Copy from skeleton, if possible [ -r "/etc/$PKG/$f" ] && cp -f /etc/$PKG/$f "$BYOBU_CONFIG_DIR/$f" + if [ "$f" = "status" ] && metadata_available; then + # Enable ec2_cost if we're in ec2 + $SED -i -e "s/ec2_cost=.*/ec2_cost=1/" "$BYOBU_CONFIG_DIR/$f" + fi fi done diff --git a/usr/lib/byobu/.shutil b/usr/lib/byobu/.shutil index d37be6a0..60c5d223 100755 --- a/usr/lib/byobu/.shutil +++ b/usr/lib/byobu/.shutil @@ -198,7 +198,7 @@ metadata_available() { # 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 # machines. - if [ -e /etc/ec2_version ]; then + if [ -e /etc/ec2_version ] || [ -e /usr/sbin/update-grub-legacy-ec2 ]; then wget -q -O- --timeout=1 http://169.254.169.254 >/dev/null 2>&1 else false