<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>adamblog &#187; ENV</title>
	<atom:link href="http://blog.amyl.org.uk/category/env/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.amyl.org.uk</link>
	<description>my half-arsed attempt at blogging</description>
	<lastBuildDate>Tue, 06 Dec 2011 19:09:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>apt-listbugs and suite-wide scripted upgrades</title>
		<link>http://blog.amyl.org.uk/2010/11/apt-listbugs-and-scripted-updates/</link>
		<comments>http://blog.amyl.org.uk/2010/11/apt-listbugs-and-scripted-updates/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 15:47:40 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[ENV]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://blog.amyl.org.uk/?p=93</guid>
		<description><![CDATA[Having finally got fed up with logging in, individually, to upgrade each of the no2id machines and jails, a bit ago, I decided to write a script to do the &#8216;hard work&#8217; for me.
This worked fine, until today, when I noticed apt-listbugs complaining, and causing the script to fail to dist-upgrade.
Not a problem, thought I.]]></description>
			<content:encoded><![CDATA[<p>Having finally got fed up with logging in, individually, to upgrade each of the <a href="http://www.no2id.net">no2id</a> machines and jails, a bit ago, I decided to write a script to do the &#8216;hard work&#8217; for me.</p>
<p>This worked fine, until today, when I noticed <a href="http://packages.debian.org/search?keywords=apt-listbugs">apt-listbugs</a> complaining, and causing the script to fail to dist-upgrade.</p>
<p>Not a problem, thought I. I&#8217;m sure others have had this issue too. Being lazy, I thought first point of call would be the internets. I&#8217;d have thought something like:</p>
<p><code><br />
"DEBIAN_FRONTEND=noninteractive" "apt-listbugs"<br />
</code></p>
<p>might have done the trick. It didn&#8217;t (that I could find).</p>
<p>So I went back to doing what a lot of the new-breed of &#8216;devops&#8217; fail to do, and what I&#8217;m quite hypocritical of; looking at the manpage.</p>
<p>The <a href="http://manpages.debian.net/cgi-bin/man.cgi?query=apt-listbugs">manpage</a> provides us with this gem:</p>
<blockquote><p>
   ENVIRONMENT VARIABLES<br />
              o  APT_LISTBUGS_FRONTEND  If  this  variable  is  set  to &#8220;none&#8221;<br />
              apt-listbugs will not execute at all, this might  be  useful  if<br />
              you  would  like  to  script  the  use  of  a program that calls<br />
              apt-listbugs.
</p></blockquote>
<p>So there we go.</p>
<p><code><br />
 for M in $MACHINES<br />
 do<br />
     echo "Connecting to ${M}.no2id.net"<br />
-    ssh root@${M}.no2id.net 'export TERM=xterm; export DEBIAN_FRONTEND=noninteractive; apt-get update &#038;&#038; echo "" &#038;&#038; echo "" &#038;&#038; echo "This is "'${M}'".no2id.net" &#038;&#038; echo "" &#038;&#038; echo "" &#038;&#038; apt-get dist-upgrade'<br />
+    ssh root@${M}.no2id.net 'export TERM=xterm; export DEBIAN_FRONTEND=noninteractive; export APT_LISTBUGS_FRONTEND=none; apt-get update &#038;&#038; echo "" &#038;&#038; echo "" &#038;&#038; echo "This is "'${M}'".no2id.net" &#038;&#038; echo "" &#038;&#038; echo "" &#038;&#038; apt-get dist-upgrade'<br />
done<br />
</code></p>
<p>hopefully, this will help others, whose first port of call is the internets, and not manpages. </p>
<p>You may, however be sensible &#8212; and have had the time to roll out <a href="http://www.puppetlabs.com">Puppet</a> (ugh, when did they change their website! Why&#8253;) or <a href="http://www.opscode.com/chef">Chef</a> though.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.amyl.org.uk/2010/11/apt-listbugs-and-scripted-updates/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Conditional Prompt colo(u)rs</title>
		<link>http://blog.amyl.org.uk/2009/12/conditional-prompt-colors/</link>
		<comments>http://blog.amyl.org.uk/2009/12/conditional-prompt-colors/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 16:45:04 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[ENV]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[machine set-up]]></category>
		<category><![CDATA[misc]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[colour]]></category>
		<category><![CDATA[conditional]]></category>
		<category><![CDATA[dotfiles]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[PS1]]></category>

		<guid isPermaLink="false">http://tanqueray.amyl.org.uk/~adam/blog/?p=61</guid>
		<description><![CDATA[setting a colored prompt; different color for different machines based on hostname, oh yes.]]></description>
			<content:encoded><![CDATA[<p>I often work on several different machines, for different projects and things. It&#8217;s bloody annoying when I get the wrong machine!</p>
<p>I thought. I know what, I&#8217;ll make all of these machines use a colored prompt, and make that lot of machines use a different one.</p>
<p>(At this point, I should say that my dotfiles, and a variety of other things are kept in a subversion repo. Most of those bits are my-eyes-only (particularly a lot of the very badly/hastily thrown together scripts), but a few bits I&#8217;m gradually releasing.)</p>
<p>After mentioning this on <a href="http://twitter.com/adamamyl/status/6945837040">twitter</a>, a couple of people have been interested in how I did it.</p>
<p>The solution is quite easy, work out the hostname, and from that determine the &#8216;class&#8217; of machine, and then apply some colors. The <a href="http://wiki.archlinux.org/index.php/Color_Bash_Prompt#Wolfman.27s">archwiki</a> was useful in getting out the colors to use; along with underlining, and emboldening (I <strong>never</strong> use underlining, except in manuscript: ghastly thing that obscures text).</p>
<p>Whilst not perfect (the color parts could be set as a variable, and then passed to the PS1 line; I could have used &#8220;else&#8221; clauses&#8230;), it works. For me, so, erm, here&#8217;s <a href="http://code.amyl.org.uk/adam/dotfiles/bashrc">my .bashrc</a> &#8212; you want from the <code># work out machine name/domain:</code> line.</p>
<p>A simple switch wotsits in <code>screen(1)</code>, and</p>
<p><code>$ cd ~/pseudohome &#038;&#038; svn up</code></p>
<p>followed with a </p>
<p><code> $ . .bashrc</code></p>
<p>is how I deploy (some people have an &#8217;svn up&#8217; in their start-up scripts, I don&#8217;t).</p>
<p>Comments here, if you want to.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.amyl.org.uk/2009/12/conditional-prompt-colors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

