<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>ukstokes.com</title>
	
	<link>http://ukstokes.com/blog</link>
	<description>tech stuff from a tech bloke</description>
	<lastBuildDate>Tue, 31 Aug 2010 15:03:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Ukstokescom" /><feedburner:info uri="ukstokescom" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Script to list all local admins in your domain</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/FZOSHXUOitE/</link>
		<comments>http://ukstokes.com/blog/2010/08/15/script-to-list-all-local-admins-your-domain/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 19:39:39 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Windows Servers]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Bash scripting]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=705</guid>
		<description><![CDATA[Here's a script to create a report of all local administrators on your domain. It gets the computer names from AD and sends a ping to each computer, and if it gets a reply it will interrogate the local administrators group using WMI to get the list of members. The Domain Admins group is ignored. [...]]]></description>
			<content:encoded><![CDATA[<p>Here's a script to create a report of all local administrators on your domain. It gets the computer names from AD and sends a ping to each computer, and if it gets a reply it will interrogate the local administrators group using WMI to get the list of members. The Domain Admins group is ignored. Run at a sensible time when most computers will be turned on.</p>
<p>Edit the SMTP server and strSender values to something appropriate. Also edit line 37 with the name of your domain. You will need to create the folder C:\scripts for this to work, or edit line 8 with a new location for the csv file. </p>
<p>The outputted file is a bit messy, but gets the job done. </p>
<div>
<pre class="brush: vb;">
SMTPServer = &quot;mail.yourdomain.corp&quot;
strSender = &quot;name@yourdomain.corp&quot;
strRecipient = InputBox(&quot;Enter the email address for report or&quot; &amp; vbcrlf &amp; &quot;press cancel to just generate a local file.&quot;, &quot;Input required&quot;)
Const ForAppending = 8
Set WshNetwork = WScript.CreateObject(&quot;WScript.Network&quot;)
Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set WshShell = CreateObject(&quot;WScript.Shell&quot;)
strFileName = &quot;C:\scripts\LocalAdminsReport.csv&quot;

If objFSO.FileExists(strFileName) Then
	objFSO.DeleteFile(strFileName)
End If		

Set objFile = objFSO.OpenTextFile(strFileName, ForAppending, True)
objFile.WriteLine &quot;ComputerName,Administrators&quot;

GetLocalAdmins 

msgbox Counter &amp; &quot; computers were counted.&quot; &amp; vbcrlf &amp; &quot;See &quot; &amp; strFileName &amp; &quot; for details.&quot;
If strRecipient = False then
	'user didn't enter an email address
	wscript.quit
Else
	SendEmail
End If

Private Function GetLocalAdmins
	Const ADS_SCOPE_SUBTREE = 2

	Set objConnection = CreateObject(&quot;ADODB.Connection&quot;)
	Set objCommand =   CreateObject(&quot;ADODB.Command&quot;)
	objConnection.Provider = &quot;ADsDSOObject&quot;
	objConnection.Open &quot;Active Directory Provider&quot;

	Set objCOmmand.ActiveConnection = objConnection
	objCommand.CommandText = &quot;Select Name from 'LDAP://DC=yourdomain,DC=corp' &quot; &amp; &quot;Where objectClass='computer'&quot;
	objCommand.Properties(&quot;Page Size&quot;) = 1000
	objCommand.Properties(&quot;Searchscope&quot;) = ADS_SCOPE_SUBTREE
	Set objRecordSet = objCommand.Execute
	objRecordSet.MoveFirst

	Do Until objRecordSet.EOF
		name = objRecordSet.Fields(&quot;Name&quot;).Value
		PINGFlag = Not CBool(WshShell.run(&quot;ping -w 500 -n 1 &quot; &amp; name,0,True))
		If PINGFlag = False Then
			objFile.WriteLine name &amp; &quot;,Did Not Ping&quot;
			Else
				'Get the local administrators
				Set objGroup = GetObject(&quot;WinNT://&quot; &amp; name &amp; &quot;/Administrators,group&quot;)
				For Each objMember In objGroup.Members
					If objMember.Name &lt;&gt; &quot;Administrator&quot; and objMember.Name &lt;&gt; &quot;Domain Admins&quot; Then
						objFile.WriteLine name &amp; &quot;,&quot; &amp; (objMember.Name)
					End If
				Next
		End If
		objRecordSet.MoveNext
	Loop
End Function

Private Function SendEmail
	Set objEmail = CreateObject(&quot;CDO.Message&quot;)
	objEmail.From = strSender
	objEmail.To = strRecipient
	objEmail.Subject = &quot;Local Admins Account&quot;
	objEmail.Textbody = Counter &amp; &quot; computers were counted. See attached log file for details.&quot;
	objEmail.AddAttachment(strFileName)
	objEmail.Configuration.Fields.Item (&quot;http://schemas.microsoft.com/cdo/configuration/sendusing&quot;) = 2
	objEmail.Configuration.Fields.Item (&quot;http://schemas.microsoft.com/cdo/configuration/smtpserver&quot;) = SMTPServer
	objEmail.Configuration.Fields.Item (&quot;http://schemas.microsoft.com/cdo/configuration/smtpserverport&quot;) = 25
	objEmail.Configuration.Fields.Update
	objEmail.Send
End Function
</pre>
</div>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/FZOSHXUOitE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2010/08/15/script-to-list-all-local-admins-your-domain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2010/08/15/script-to-list-all-local-admins-your-domain/</feedburner:origLink></item>
		<item>
		<title>Connect Skydrive as a Windows mapped drive</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/L4dwzR7WVQ4/</link>
		<comments>http://ukstokes.com/blog/2010/07/02/connect-skydrive-as-a-windows-mapped-drive/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 22:58:50 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Random stuff]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=691</guid>
		<description><![CDATA[It still remains to be seen how useful and popular Windows Live Skydrive will become, but if you happen to have an MSN account you automatically get 25Gb of free storage at your disposal, which in my case is enough to backup all of my important personal data - documents, photos, etc (the photos of [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-699" title="Windows Live SkyDrive logo" src="http://ukstokes.com/blog/wp-content/uploads/2010/07/Windows_Live_SkyDrive_logo-150x150.png" alt="Windows Live SkyDrive logo" width="113" height="113" />It still remains to be seen how useful and popular Windows Live Skydrive will become, but if you happen to have an MSN account you automatically get 25Gb of free storage at your disposal, which in my case is enough to backup all of my important personal data - documents, photos, etc (the photos of which are the most valuable). There are several ways to connect Skydrive as a mapped drive ... some are better than others, but this is the best way I have found so far.</p>
<p>Go and download <a href="http://skydrivesimpleviewer.codeplex.com/">SkyDrive Simple Viewer for WebDAV</a>. Extract the files to your C: drive and run the command like so:</p>
<pre class="brush: powershell;">dumpurls.exe &lt;UserName&gt; &lt;Password&gt;</pre>
<p>This should output a bunch of URL's representing the folders in your Skydrive.</p>
<p>Open up My Computer, click on Map Network Drive. Copy and paste one of the URL's into the box and click OK. Enter your Windows Live credentials into the logon box when it appears, and hey presto, your 25Gb off-site storage box appears as a mapped drive in My Computer.</p>
<p>Now you can back stuff up to it, manually or automatically (through home brewed scripts) and access your stuff from anywhere on the Internet. <em>Just remember not to backup anything personal to the "Public" folder, as that is visible to everyone.</em></p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/L4dwzR7WVQ4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2010/07/02/connect-skydrive-as-a-windows-mapped-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2010/07/02/connect-skydrive-as-a-windows-mapped-drive/</feedburner:origLink></item>
		<item>
		<title>D-Link DWA-131 and Ubuntu</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/uVqWyqKCaBc/</link>
		<comments>http://ukstokes.com/blog/2010/05/12/d-link-dwa-131-and-ubuntu/#comments</comments>
		<pubDate>Wed, 12 May 2010 21:50:46 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Desktop Linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=628</guid>
		<description><![CDATA[I recently bought this wireless-n USB adaptor for use with Ubuntu as I had read it was "Linux compatible", or at least as compatible as a wireless card can be with Linux. It proved tricky to get working, so this post may help others who are thinking of attempting the same thing. There are basically [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ukstokes.com/blog/wp-content/uploads/2010/05/nano-usb.jpg" rel="lightbox"><img class="alignleft size-full wp-image-668" title="D-Link DWA-131" src="http://ukstokes.com/blog/wp-content/uploads/2010/05/nano-usb.jpg" alt="" width="114" height="103" /></a>I recently bought this wireless-n USB adaptor for use with Ubuntu as I had read it was "Linux compatible", or at least as compatible as a wireless card can be with Linux. It proved tricky to get working, so this post may help others who are thinking of attempting the same thing.</p>
<p>There are basically 2 ways to make this usb dongle work, once you have overcome the first hurdle and discovered that this uses the Realtek 8192 chipset inside.</p>
<p><strong>The easy way</strong><br />
Easiest method is to use the Windows Realtek driver and a nifty program called ndiswrapper (or ndisgtk if you prefer to use a graphical interface). The drawback is this will only give you wireless-g capability, not wireless-n. Here's how (you can get the driver from <a href="http://members.driverguide.com/driver/detail.php?driverid=1689953&amp;action=filfo">here</a> if you don't have a driver disk):</p>
<pre class="brush: bash;">unzip UGL2430-U2H2_XP_Vista.zip
sudo ndiswrapper -i XP_Vista/88_91_92_SU_Driver/WinXP2K/net8192su.inf
sudo ndiswrapper -l
sudo ndiswrapper -m
sudo modprobe ndiswrapper
iwconfig</pre>
<p>Then you can manage your newly created "wlan0" or "wlan1" device using Network manager, or you can configure it manually if you like.</p>
<p><strong>The hard way (recommended)</strong><br />
To get the full wireless-n potential from this usb dongle you have to compile the Realtek driver from source. The drawback to this process is it is complicated, several prerequisite steps are required.</p>
<p>Download the driver files from here: <a href="http://www.opendrivers.com/modeldriver/RealTek_Network_RTL8191SU-driver-download.html">RealTek_Network_RTL8191SU-driver-download</a> and save it to ~/realtek</p>
<p>Assuming that your kernel version is 2.6.32 (check using uname -r) get the kernel source:</p>
<pre class="brush: bash;">sudo apt-get install build-essential linux-source-2.6.32 linux-headers-generic
cd /usr/src
sudo tar -xvjf linux-source-2.6.32.tar.bz2
sudo ln -s /usr/src/linux-source-2.6.32 /usr/src/linux</pre>
<p>If this was all fine, go back and unzip the driver file:</p>
<pre class="brush: bash;">cd ~/realtek
unzip rtl8191SU_usb_linux_v2.6.0006.20100226.zip
cd rtl8191SU_usb_linux_v2.6.0006.20100226/driver
tar fzxv rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226.tar.gz
cd rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226/</pre>
<p>Now for the crazy part. You now have to hack the source code of the driver to stop it from throwing build errors. Follow the instructions <a href="http://samiux.blogspot.com/2010/05/howto-realtek-8192su-usb-dongle.html">in this blog post first</a>, and then it will build successfully. Do the 'make' and 'make install' <strong>as root</strong> (sudo su -)</p>
<pre class="brush: bash;">make
make install
depmod -a
modprobe 8712u
iwconfig</pre>
<p>Now you should have full wireless-n networking on this device, iwconfig will show "IEEE 802.11bgn" if it was installed correctly.</p>
<p><strong>Edit: </strong>Looks like there is now an easier way to do this, <a href="http://ubuntuforums.org/showpost.php?p=9690593&#038;postcount=8">explained here on the Ubuntu Forums</a>.</p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/uVqWyqKCaBc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2010/05/12/d-link-dwa-131-and-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2010/05/12/d-link-dwa-131-and-ubuntu/</feedburner:origLink></item>
		<item>
		<title>Configure a non-enterprise Blackberry handset for Exchange</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/J1LuKg0mXds/</link>
		<comments>http://ukstokes.com/blog/2010/05/11/configure-a-non-enterprise-blackberry-handset-for-exchange/#comments</comments>
		<pubDate>Tue, 11 May 2010 21:26:34 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Blackberry]]></category>
		<category><![CDATA[BES]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=581</guid>
		<description><![CDATA[Some users in our organisation had purchased Blackberries from their favourite mobile phone retailers, with the expectation of them working with our Exchange email. Being retail BB's, they would not provisioned or licensed for our BES server, meaning we would not be able to remote wipe or do other useful stuff for them. Blackberry do [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ukstokes.com/blog/wp-content/uploads/2010/03/base_media.jpg" rel="lightbox"><img class="alignleft size-full wp-image-589" title="base_media" src="http://ukstokes.com/blog/wp-content/uploads/2010/03/base_media.jpg" alt="" width="80" height="80" /></a>Some users in our organisation had purchased Blackberries from their favourite mobile phone retailers, with the expectation of them working with our Exchange email. Being retail BB's, they would not provisioned or licensed for our BES server, meaning we would not be able to remote wipe or do other useful stuff for them. Blackberry do allow connectivity to Exchange via OWA <a href="http://www.blackberry.com/btsc/search.do?cmd=displayKC&amp;docType=kc&amp;externalId=KB03087">as per articles here</a>, but some users were not able to get their work email configured because of the following error:</p>
<blockquote><p>Cannot connect to email server or invalid server name.<br />
Please verify the Outlook Web Access URL.<br />
If the error persists contact yourdomain.com (your email provider).</p></blockquote>
<p>The fields available for user input were:</p>
<ul>
<li>Email address:</li>
<li>Password:</li>
<li>Web access URL</li>
<li>Username</li>
<li>Mailbox Name</li>
</ul>
<p>After some experimintation I discovered the working combination.</p>
<ol>
<li>Web Access URL had to include the /exchange at the end, e.g: https://your.owa.com/exchange</li>
<li>Username had to be in the domain\username format</li>
<li>Mailbox name had to be the first part of the email address, i.e everything before the @ sign.</li>
</ol>
<p>It was the mailbox name that took some guesswork. In a lot of organisations the 'mailbox name' would be the same as the username, but in our organisation we use a 6 digit number for usernames so the usual guessable combo was different. I wonder why this works though or why 'mailbox name' is even required. Seems a bit odd as it's not required by any other smartphone I've configured for ActiveSync.</p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/J1LuKg0mXds" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2010/05/11/configure-a-non-enterprise-blackberry-handset-for-exchange/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2010/05/11/configure-a-non-enterprise-blackberry-handset-for-exchange/</feedburner:origLink></item>
		<item>
		<title>Upgrading bugzilla from 3.0.x to 3.4.6</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/ip-vAGkfFLs/</link>
		<comments>http://ukstokes.com/blog/2010/05/11/upgrading-bugzilla-from-3-0-x-to-3-4-6/#comments</comments>
		<pubDate>Tue, 11 May 2010 21:23:16 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Enterprise Linux]]></category>
		<category><![CDATA[Bugzilla]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=602</guid>
		<description><![CDATA[A few weeks ago I updated a 3 year old installation of Bugzilla to the most recent version, and made these notes along the way. The Bugzilla online documentation is pretty good and my plan was formed using their docs as a guide. Send advance warning to users Log on to site, edit params and [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I updated a 3 year old installation of Bugzilla to the most recent version, and made these notes along the way. The Bugzilla online documentation is pretty good and my plan was formed using their docs as a guide.</p>
<ul>
<li>Send advance warning to users</li>
<li>Log on to site, edit params and enter some text under 'shutdown site'</li>
<li>Backup db using this commmand</li>
</ul>
<pre class="brush: bash;">mysqldump --opt -u bugs -p bugs &gt; bugs_backup_$(date +%d%m%y).sql</pre>
<ul>
<li>Download and extract bugzilla 3.4.6</li>
</ul>
<pre class="brush: bash;">cd ~
wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-3.4.6.tar.gz
tar fvzx bugzilla-3.4.6.tar.gz
cd /var/www/html/
mv bugzilla bugzilla.old
cp -r ~/bugzilla-3.4.6 ./bugzilla
cp -r bugzilla.old/localconfig* bugzilla</pre>
<p>Later you will install the DBD::mysql perl module which requires mysql header files. So if you don't have mysql-devel, install it now. Also the Image::Magick perl module may fail to build from cpan (this is what happened to me), this can be installed by yum as an alternative.</p>
<pre class="brush: bash;">yum install mysql-devel ImageMagick-perl.i386
cd bugzilla
./checksetup.pl</pre>
<p>checksetup.pl will tell you to install missing perl modules using cpan, however this requires an internet connection. I used ntlmaps to proxy through our MS ISA server as my bugzilla server doesn't have Internet access. I got ntlmaps from another server on the network:</p>
<pre class="brush: bash;">scp -r root@bugtest:/root/ntlm* .
cd ntlmaps-0.9.9.0.1
nohup python main.py
export http_proxy=http://localhost:5865
export ftp_proxy=ftp://localhost:5865
cd /var/www/html/bugzilla</pre>
<p>Install optional updates:</p>
<pre class="brush: bash;"># failed  --&gt; /usr/bin/perl install-module.pl Image::Magick
# skipped --&gt; /usr/bin/perl install-module.pl Authen::Radius
/usr/bin/perl install-module.pl SOAP::Lite
/usr/bin/perl install-module.pl TheSchwartz
/usr/bin/perl install-module.pl Daemon::Generic
/usr/bin/perl install-module.pl SOAP::Lite</pre>
<p>Install compulsary updates:</p>
<pre class="brush: bash;">/usr/bin/perl install-module.pl DBD::mysql
/usr/bin/perl install-module.pl CGI
/usr/bin/perl install-module.pl Digest::SHA
/usr/bin/perl install-module.pl DateTime
/usr/bin/perl install-module.pl DateTime::TimeZone
/usr/bin/perl install-module.pl Template
/usr/bin/perl install-module.pl Email::MIME
/usr/bin/perl install-module.pl Email::MIME::Encodings</pre>
<p>I also needed these perl modules, even though they weren't listed by checksetup.pl:</p>
<pre class="brush: bash;">/usr/bin/perl install-module.pl DateTime::Locale
/usr/bin/perl install-module.pl List::MoreUtils</pre>
<p>Finished with ntlmaps now, it can be stopped</p>
<pre class="brush: bash;">kill $(ps x | grep main.py | grep -v grep | awk {'print $1'})
export http_proxy=
export ftp_proxy=</pre>
<p>Run checksetup again, this bit can take some time while the db is upgraded:</p>
<pre class="brush: bash;">./checksetup.pl</pre>
<ul>
<li>Fix any more problems, run again if required.</li>
<li>Once finished log into bugzilla, put maintenance page back up. This option has now moved to Administration</li>
<li>Run sanity check, fix any problems.</li>
<li>Change any css and templates that you lost in the upgrade.</li>
<li>Reopen the site for logons when you are ready.</li>
</ul>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/ip-vAGkfFLs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2010/05/11/upgrading-bugzilla-from-3-0-x-to-3-4-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2010/05/11/upgrading-bugzilla-from-3-0-x-to-3-4-6/</feedburner:origLink></item>
		<item>
		<title>Compile your own droid – Part 1a</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/V0jmTCd8upA/</link>
		<comments>http://ukstokes.com/blog/2010/01/15/compile-your-own-droid-part-1a/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 21:48:42 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=570</guid>
		<description><![CDATA[Here's a confession. My inner geek woke me up the next morning at 3:00 wondering whether my android build had completed. In the end sanity took hold again, and I went back to sleep. Quite lucky really as when I checked in the morning, the java compiler had crashed with a meaningless error. An exception [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-565" title="android-logo" src="http://ukstokes.com/blog/wp-content/uploads/2010/01/android-logo.jpg" alt="android-logo" width="72" height="80" />Here's a confession. My inner geek woke me up the next morning at 3:00 wondering whether my android build had completed. In the end sanity took hold again, and I went back to sleep. Quite lucky really as when I checked in the morning, the java compiler had crashed with a meaningless error.</p>
<pre class="brush: bash;">An exception has occurred in the compiler (1.5.0). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.

java.lang.AssertionError: writePool E

at com.sun.tools.javac.jvm.ClassWriter.writePool(ClassWriter.java:513)
at com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1333)
at com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1211)
at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:325)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:474)
at com.sun.tools.javac.main.Main.compile(Main.java:592)
at com.sun.tools.javac.main.Main.compile(Main.java:544)
at com.sun.tools.javac.Main.compile(Main.java:58)
at com.sun.tools.javac.Main.main(Main.java:48)
make: *** [out/target/common/obj/APPS/VpnServices_intermediates/classes-full-debug.jar] Error 41
make: *** Waiting for unfinished jobs....</pre>
<p>After trying the most recent update of Java 1.5 I made a cry for help in the XDA forums. The answer seemed simple enough, try JDK1.6. I installed it and modified /home/ben/mydroid/build/core/main.mk, commenting out the lines that checked for Java 1.5. Then after a "make clean", and another "make -j2" (-j4 made my laptop burn up ...) it was building again, and this time finished!</p>
<p>I make a nandroid backup and wiped to factory settings (using Amon_RA's recovery image) flashed the resulting boot.img and system.img to my phone using fastboot:</p>
<pre class="brush: bash;">fastboot flash boot boot.img
fastboot flash system system.img
fastboot reboot</pre>
<p>Rebooted my device, and it worked! A very basic system though, no Market or Google Apps.</p>
<p>Next steps ... getting root, creating an update.zip, making my own kernel with compcache ... the list is actually endless, it's nice just to get this far.</p>
<p>In fact next step could be building from Cyanogen's Eclair sources. Will give it a go and post if it works...</p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/V0jmTCd8upA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2010/01/15/compile-your-own-droid-part-1a/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2010/01/15/compile-your-own-droid-part-1a/</feedburner:origLink></item>
		<item>
		<title>Compile your own droid (for HTC Sapphire) – Part 1</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/E4qqR00CzAY/</link>
		<comments>http://ukstokes.com/blog/2010/01/13/compile-your-own-droid-for-htc-sapphire-part-1/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 23:07:37 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=555</guid>
		<description><![CDATA[I thought I'd have a go at building Android 2.0.1 from source for the HTC Magic (AKA MyTouch 3G and HTC Sapphire). Mine is the 32B board from UK Vodafone - Google branded. Current most recent firmware from HTC for the device is Android 1.6, although Android 2.0.1 source code is available from Google. Android [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-565" title="android-logo" src="http://ukstokes.com/blog/wp-content/uploads/2010/01/android-logo.jpg" alt="android-logo" width="72" height="80" />I thought I'd have a go at building Android 2.0.1 from source for the HTC Magic (AKA MyTouch 3G and HTC Sapphire). Mine is the 32B board from UK Vodafone - Google branded. Current most recent firmware from HTC for the device is Android 1.6, although Android 2.0.1 source code is available from Google. Android 2.0 roms are already available from xda-developers.com, but I wanted to see how hard it was to do it myself. Also if I'm successful this will be a place where all information will be in one place.</p>
<p>This is not rocket science by the way - this is my experience in following the guides from Google and HTC on Ubuntu 9.10. All of this information is already out there, just not necessarily all in one place in this format or adapted for this environment.</p>
<p>Building on Windows is not supported. I'm using Ubuntu 9.10 (32bit) on my laptop. Java JDK 1.5 is required, using 1.6 is supported but you have to make additional steps changing instances of "1.5" to "1.6" in makefiles. 64bit Ubuntu users may want to follow a different guide, not sure if any differences here could cause a build to fail.</p>
<p><strong>Setting up your environment ready for development</strong>, install the following packages (<a href="http://source.android.com/download">reference</a>):</p>
<pre class="brush: bash;">sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zipcurl libncurses5-dev zlib1g-dev valgrind</pre>
<p>In Ubuntu 9.10 you can't get Java 1.5 using apt any more. I downloaded it from java.com and installed it in /usr/local/java/jdk1.5.0. Then:</p>
<pre class="brush: bash;">ln -s /usr/local/java/jdk1.5.0/bin/java /usr/local/bin/java</pre>
<p>If you try "java -version" it should tell you "Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)". Finally, edit your ~/.bashrc using vim and add the following to the end of the file:</p>
<pre class="brush: bash;">export JAVA_HOME=/usr/local/java/jdk1.5.0/
export ANDROID_JAVA_HOME=$JAVA_HOME
export PATH=$PATH:/home/ben/bin:$JAVA_HOME/bin</pre>
<p>Reload your .bashrc file using ". ~./bashrc".</p>
<p><strong>Setting up repo</strong> - a Google tool to manage your Android source code repository:</p>
<pre class="brush: bash;">cd ~
mkdir bin
curl http://android.git.kernel.org/repo &gt;~/bin/repo
chmod a+x ~/bin/repo
mkdir mydroid
cd mydroid
repo init -u git://android.git.kernel.org/platform/manifest.git -b eclair</pre>
<p>Answer the questions where prompted and then fetch the source code using:</p>
<pre class="brush: bash;">repo sync</pre>
<p>This bit takes a while ... when finished:</p>
<pre class="brush: bash;">gpg --import</pre>
<p>Paste in the GPG key at the bottom of <a href="http://source.android.com/download">this page</a> and then press ctrl+D. Now we need the HTC binaries and kernel source to build specifically for the Sapphire.</p>
<pre class="brush: bash;">wget --referer=http://developer.htc.com/google-io-device.html http://member.america.htc.com/download/RomCode/ADP/signed-google_ion-ota-14721.zip?

# line commented -- wget --referer=http://developer.htc.com/ http://member.america.htc.com/download/RomCode/Source_and_Binaries/sapphire.hep-357975db.tar.bz2</pre>
<p><strong>Now to do the final bit of setup</strong> and start the build (<a href="http://source.android.com/documentation/building-for-dream">reference here</a>):</p>
<pre class="brush: bash;">cd ~/mydroid/vendor/htc/sapphire-open
./unzip-files.sh
cd ~/mydroid
. build/envsetup.sh
lunch aosp_sapphire_us-eng</pre>
<p>Yes that is supposed to say "lunch", not "launch". Now the build can be started! One final thing is required to stop the build from crashing (<a href="http://www.mail-archive.com/android-porting@googlegroups.com/msg08157.html">reference</a>):</p>
<pre class="brush: bash;">cd ~/mydroid/external/webkit
git cherry-pick 18342a41ab72e2c21931afaaab6f1b9bdbedb9fa</pre>
<p>Now we can start the build:</p>
<pre class="brush: bash;">cd ~/mydroid
make -j4</pre>
<p>Bah, I've got an error: "Your version is: /bin/bash: javac: command not found.". There's a problem with my path (which I have corrected above already).</p>
<pre class="brush: bash;">export PATH=$PATH:$JAVA_HOME/bin</pre>
<p><strong>Now it's building</strong>. The HTC website advises this is now a good time to make a cup of tea, or take a nap. I'll revisit this tomorrow I think!</p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/E4qqR00CzAY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2010/01/13/compile-your-own-droid-for-htc-sapphire-part-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2010/01/13/compile-your-own-droid-for-htc-sapphire-part-1/</feedburner:origLink></item>
		<item>
		<title>Google Wave invite, anyone?</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/Egd4AFAbk9o/</link>
		<comments>http://ukstokes.com/blog/2009/11/27/google-wave-invite-anyone/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 22:07:03 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Random stuff]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=547</guid>
		<description><![CDATA[I just joined Google Wave this week and I have 8 invites if anyone wants one ... leave me a comment or get in touch via Twitter (@ben_stokes) with your email address and I'll send one over. Personally I am not that amazed with it, not sure if it will catch on ... I think [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-548" title="Google_Wave_logo" src="http://ukstokes.com/blog/wp-content/uploads/2009/11/Google_Wave_logo-150x150.png" alt="Google_Wave_logo" width="150" height="150" />I just joined Google Wave this week and I have 8 invites if anyone wants one ... leave me a comment or get in touch via Twitter (@ben_stokes) with your email address and I'll send one over. Personally I am not that amazed with it, not sure if it will catch on ... I think it should handle SMTP mail as well as 'waves', it's a bit too exclusive in its current form.</p>
<p><span style="background-color: #ffffff;">In other news there's been too much happening to have time to write about the interesting techy bits, I do have some new and useful bash and vbscripts which I'll probably post up in one big batch this week as I have some time off (woo). I've also been meaning to write some stuff about Android, yesterday I got Google Navigation working on my HTC Magic in the UK (currently it's only officially working in the USA). This was <a href="http://forum.xda-developers.com/showthread.php?t=583123">courtesy of xda-developers.com</a>, see the link for details. It works really well, I feel sorry for anyone that bought CoPilot Live from the Market for £20 (ouch) ... as it looks like Google will be giving this out for free with Android 2.0 in the very near future. </span></p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/Egd4AFAbk9o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2009/11/27/google-wave-invite-anyone/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2009/11/27/google-wave-invite-anyone/</feedburner:origLink></item>
		<item>
		<title>The thin client project</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/2u13WUSwR6k/</link>
		<comments>http://ukstokes.com/blog/2009/09/12/the-thin-client-project/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 20:59:00 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Desktop Linux]]></category>
		<category><![CDATA[Citrix]]></category>
		<category><![CDATA[thin client]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=463</guid>
		<description><![CDATA[On our small remote sites we use HP thin clients to connect to applications using Citrix. The thin clients are Linux based, with 1Gb of flash memory for storage and running an HP customised version of Debian. The distro is basically a cut down Gnome desktop with Iceweasel (Firefox), and some HP branding and tools [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ukstokes.com/blog/wp-content/uploads/2009/08/100px-NewTux.svg.png" rel="lightbox"><img class="size-full wp-image-484 alignleft" title="Tux" src="http://ukstokes.com/blog/wp-content/uploads/2009/08/100px-NewTux.svg.png" alt="Tux" width="100" height="120" /></a>On our small remote sites we use HP thin clients to connect to applications using Citrix. The thin clients are Linux based, with 1Gb of flash memory for storage and running an HP customised version of Debian. The distro is basically a cut down Gnome desktop with Iceweasel (Firefox), and some HP branding and tools for backing up and restoring the client and for connecting to HP printers.</p>
<p>We've recently had some downtime with ADSL connections in these sites and wanted a contingency for network problems. We came up with the idea of 3G USB dongles and had bought a Vodafone one, but after testing it, the conclusion was this would not work without a lot of hacking about with the packages available in the HP Distro. However, after some testing in <a href="http://www.ubuntu.com">Ubuntu</a> we found it worked perfectly with the most recent version of Network Manager. With Network Manager you can basically just insert the key and after a minute right-click the tray icon, select 'Vodefone 3G' and you're off (yes, incredibly it really is that good). So ... the challenge was to reconfigure our thin clients, so that:</p>
<p>- It used Ubuntu and Network Manager<br />
- It could be easily deployed by a user from booting a USB stick<br />
- Had a system to allow IT to make changes to the image and re-image the USB stick<br />
- The USB sticks should be easily cloned to distribute to all remote offices.</p>
<p>I can't resist a good challenge, expecially when it involves tinkering with Linux.</p>
<p><strong>1. Installing a lean and mean Ubuntu machine</strong><br />
This step was a challenge in in itself - Ubuntu Jaunty would not boot into a live session on this computer, (kernel modules were failing to load right at the start) and doing a basic text based install (with no GUI elements) pretty much filled the entire drive, give or take a few Mb!</p>
<p>I had partitioned the disk with no swap partition, 100Mb for home and 70Mb for boot. I set off by removing unwanted locales from the system using 'locale purge':</p>
<pre class="brush: bash;">sudo apt-get install localepurge
sudo apt-get clean</pre>
<p>I decided I would go for <a href="http://www.xfce.org/about/screenshots">XFCE</a> for the Window manager, since it was impossible to install a Gnome desktop without hundreds of megs of bloat. All I really need is a desktop with a web browser so installing a Gnome desktop seems like overkill.</p>
<pre class="brush: bash;">sudo apt-get install xfce4</pre>
<p>This automatically pulls in all of the dependancies, like the X-Window system. Next to start reclaiming used disk space. To find out which directories were using the most space I used du:</p>
<pre class="brush: bash;">sudo du / -h --max-depth=1 | grep M</pre>
<p>The main culprets were /usr/share and /lib. Deleting items from /lib is not advisable, removing the dependant packages and then using an 'apt-get autoremove' will tidy them up the clean way. I prefer to use Synaptic to do this rather than apt-get, some things are just better and faster using a GUI.</p>
<pre class="brush: bash;">sudo apt-get install synaptic
xfce4-session</pre>
<p>From within XFCE, I launched Synaptic and removed everything that was unnecessary. Afterwards went back into /usr/share and used du to locate the large DIR's again. I removed gimp files and unnecessary locales:</p>
<pre class="brush: bash;">cd /usr/share
sudo rm -rf gimp
sudo mv locale/en .
sudo mv locale/en_GB .
sudo rm -rf locale/*
sudo mv en locale
sudo mv en_GB locale</pre>
<p>Removed unnecessary docs, myspell and redundant openoffice.org components. Have no idea why these were even installed in the first place since the openoffice suite was not installed ... totally unnecessary bloat!</p>
<pre class="brush: bash;">sudo apt-get remove myspell-en myspell-en-gb
sudo rm /var/lib/dpkg/info/openoffice* -f
sudo dpkg -r --force-remove-reinstreq openoffice.org-hyphenation-en-us
sudo dpkg --purge openoffice.org-hypnenation-en-us
sudo tar fzvc /home/docs.tgz doc --remove-files</pre>
<p>I deleted /home/docs.tgz after a reboot, since nothing stopped working. <img src='http://ukstokes.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Next got rid of unwanted XFCE themes:</p>
<pre class="brush: bash;">cd /usr/share/themes
sudo mkdir ../themes_OLD
sudo mv * ../themes_OLD/
sudo mv themes_OLD/Def* .
sudo mv themes_OLD/Xfce* .
sudo rm -rf themes_OLD</pre>
<p>Installed Firefox, usplash (pretty startup screen) and the all-important Network Manager:</p>
<pre class="brush: bash;">sudo apt-get install firefox usplash network-manager</pre>
<p>To get the Network Manager tray icon in XFCE, you just have to configure 'nm-applet' to start when XFCE is started. Tested Network Manager using the Vodafone 3G dongle and success, it worked first time! Citrix sessions actually run quite well over 3G too.</p>
<p>Once last package cleanup, for good measure:</p>
<pre class="brush: bash;">sudo apt-get remove synaptic
sudo apt-get autoremove
sudo apt-get clean</pre>
<p>This left me around 30Mb free on /, which is pretty much what I had started with on the HP/Debian distro.</p>
<p>Last few bits were configuring the user to auto login, installing printers using CUPS, installing the Citrix client (this goes into the users /home directory), setting desktop background, and a few other customisations, like configuring Firefox to automatically purge data when closed ... that 100Mb home partition would fill up pretty quickly otherwise.</p>
<p>The autologon to XFCE without a login manager was a bit tricky since Ubuntu uses Upstart to manage the startup sequence rather than the traditional Linux sysinit, since this is a bit unfamiliar to me I had to follow some guides on the <a href="http://ubuntuforums.org">Ubuntu forums</a> to get it working. The community support is excellent though, which is one other reason we chose it in the move away from the HP thin client distro. There always seems to be someone before you who has already had the same problem!</p>
<p><strong>2. User friendly imaging from a bootable USB stick</strong><br />
My weapon of choice for this initially was the Linux tool 'dd', which does block level duplication of partitions or sections of a disk quite easily. For example to clone the second partition on disk 'hda' to a file, you could use:</p>
<pre class="brush: bash;">dd if=/dev/hda2 of=/myimages/thin_client_hda2.img</pre>
<p>dd can also be piped into tar or zip to compress the output. One drawback is dd does also duplicate white space into the output file, so it's not the most efficient tool for the job. My tests with dd were not very successful, creating the image was fine, but writing the image back to disk always failed complaining it had run out of disk space.</p>
<p>I dumped dd and started looking into <a href="http://clonezilla.org/">CloneZilla</a>. It's an open source partition and disk imaging tool that boots from CD or USB and can dump a disk image locally, or to an NFS or Samba share. It is comparible to norton ghost in features but not quite as friendly in the GUI department, since the menus are all text based and keyboard controlled. Clonezilla can dump an image to usb attached or to windows or NFS shares and can even be set up as a PXE server to multicast images across a network and image multiple machines at once, but it's most common form is imaging a single machine in live mode. To dump a disk image locally I has to split my usb stick into 2 partitions : 500Mb for Clonezilla (formatted in fat32) and 1.5Gb for the partition images (formatted in ext3). This was necessary as you can't write images to the filesystem clonezilla has booted from.</p>
<p>I used <a href="http://unetbootin.sourceforge.net/">unetbootin</a> (awesome utility) to write the Clonezilla iso to the usb stick and make it bootable. You may notice unetbootin already contains a Clonezilla option, I did try using this but the stick that was created was somehow missing important files from /etc/ocs, so I'd advise downloading the latest iso from clonezilla first, and then just using unetbootin wo write the iso file.</p>
<p style="text-align: center;"><a href="http://ukstokes.com/blog/wp-content/uploads/2009/09/unetbootin.PNG" rel="lightbox"><img class="size-medium wp-image-513 aligncenter" title="unetbootin" src="http://ukstokes.com/blog/wp-content/uploads/2009/09/unetbootin-300x220.PNG" alt="unetbootin" width="300" height="220" /><em><br />
Unetbootin</em></a></p>
<p>Next boot from the stick but instead of going into an interactive session, choose the command line mode. Grant yourself root access by using:</p>
<pre class="brush: bash;">sudo su -</pre>
<p>Edit the syslinux.cfg file to customise the boot menu.</p>
<pre class="brush: bash;">vi /live/image/syslinux.cfg</pre>
<p>If you've ever created a Linux PXE server you'll recognise the layout of this file. By editing this and passing different options to the kernel at boot, you can launch custom clonezilla scripts without user interaction. My syslinux.cfg looked like this ... the top menu item becomes the default, so this configuration will automatically restore the thin client from the usb stick if there is no interaction for 10 seconds - perfect for sending to users on remote sites.</p>
<pre class="brush: bash;">default vesamenu.c32
prompt 0
menu title UNetbootin
timeout 100

label restore
menu label Restore image from USB stick
kernel /ubnkern
append initrd=ubninit boot=live union=aufs vga=788 ip=frommedia ocs_live_run=&quot;/live/image/pkg/custom-ocs-restore&quot; ocs_live_extra_param=&quot;&quot; ocs_live_keymap=&quot;NONE&quot; ocs_live_batch=&quot;yes&quot; ocs_lang=&quot;en_us.UTF8&quot;

label backup
menu label Backup image to USB stick
kernel /ubnkern
append initrd=ubninit boot=live union=aufs vga=788 ip=frommedia ocs_live_run=&quot;/live/image/pkg/custom-ocs-backup&quot; ocs_live_extra_param=&quot;&quot; ocs_live_keymap=&quot;NONE&quot; ocs_live_batch=&quot;yes&quot; ocs_lang=&quot;en_us.UTF8&quot;

label unetbootindefault
menu label CloneZilla Live Session
kernel /ubnkern
append initrd=/ubninit boot=live union=aufs    nolocales ocs_live_run=&quot;ocs-live-general&quot; ocs_live_extra_param=&quot;&quot; ocs_live_keymap=&quot;&quot; ocs_live_batch=&quot;no&quot; ocs_lang=&quot;&quot; vga=791 ip=frommedia</pre>
<p>The <strong>ocs_live_run </strong>parameter in each stanza points to the custom script you want to run. These scripts have to exist in /live/image/pkg and be marked as executable. They can be called anything you like. Some examples already exist on the live cd, can't remember the exact location but I found them using:</p>
<pre class="brush: bash;">find / -name &quot;custom-ocs*&quot;</pre>
<p>My backup and restore scripts looked like this:</p>
<p><strong>/live/image/pkg/custom-ocs-backup</strong></p>
<pre class="brush: bash;">#!/bin/bash

DRBL_SCRIPT_PATH=&quot;${DRBL_SCRIPT_PATH:-/opt/drbl/}&quot;

. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
. $DRBL_SCRIPT_PATH/conf/drbl-ocs.conf
. $DRBL_SCRIPT_PATH/sbin/ocs-functions

if [ -e /etc/ocs/ocs-live.conf ]; then   . /etc/ocs/ocs-live.conf; fi
ask_and_load_lang_set en_US.UTF-8

mkdir -p /home/partimag
mount /dev/sda2 /home/partimag

/opt/drbl/sbin/ocs-sr -q2 -c -j2 -z1 -i 2000 -p true savedisk &quot;maverick-img&quot; &quot;hda&quot;</pre>
<p><strong>/live/image/pkg/custom-ocs-restore</strong></p>
<pre class="brush: bash;">#!/bin/bash

DRBL_SCRIPT_PATH=&quot;${DRBL_SCRIPT_PATH:-/opt/drbl/}&quot;

. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
. $DRBL_SCRIPT_PATH/conf/drbl-ocs.conf
. $DRBL_SCRIPT_PATH/sbin/ocs-functions

if [ -e /etc/ocs/ocs-live.conf ]; then   . /etc/ocs/ocs-live.conf; fi
ask_and_load_lang_set en_US.UTF-8

mkdir -p /home/partimag
mount /dev/sda2 /home/partimag

/opt/drbl/sbin/ocs-sr -g auto -c -p true restoredisk &quot;maverick-img&quot; &quot;hda&quot;</pre>
<p>I got stuck in a few places, the project maintainer (Steven Shiau) helped me out on the <a href="http://sourceforge.net/forum/forum.php?forum_id=663168">clonezilla forums</a> (thanks Steven).</p>
<p><strong>3. Cloning the USB stick</strong></p>
<p>Gah ... well I've got this working using dd ... but I need a Windows tool that can do this since the IT Service Desk are all on Windows machines! Provided the partitions on the USB stick are the correct size, one can use:</p>
<pre class="brush: bash;">dd if=/dev/sda1 of=/dev/sdb1 conv=notrunc
dd if=/dev/sda2 of=/dev/sdb2 conv=notrunc</pre>
<p>What Windows tool can I use to do this ... don't really have the time to spend but I am thinking a 3rd option in the Clonezilla boot menu for duplicating the stick. Perhaps a 2nd part in the future to this already too long blog post!</p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/2u13WUSwR6k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2009/09/12/the-thin-client-project/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2009/09/12/the-thin-client-project/</feedburner:origLink></item>
		<item>
		<title>Managing multiple PuTTys</title>
		<link>http://feedproxy.google.com/~r/Ukstokescom/~3/NW8aiTw8HzM/</link>
		<comments>http://ukstokes.com/blog/2009/09/09/managing-multiple-puttys/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 21:21:22 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Enterprise Linux]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Putty]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=407</guid>
		<description><![CDATA[I don't have any Linux cluster servers to look after but do manage 2 Linux server farms. They are similar to clusters in that they are both groups of RHEL servers that all have to have an identical config. The larger of these farms is 12 RHEL 5.3 servers, and to roll out changes to [...]]]></description>
			<content:encoded><![CDATA[<p>I don't have any Linux cluster servers to look after but do manage 2 Linux server farms. They are similar to clusters in that they are both groups of RHEL servers that all have to have an identical config. The larger of these farms is 12 RHEL 5.3 servers, and to roll out changes to them all, I wanted to be able to make the change once, and after it was verified, make the same change on the other 11 servers. I started off by writing this script on <em>server1</em>:</p>
<pre class="brush: bash;">#!/bin/sh

echo -n &quot;Enter command to run (on one line): &quot;
read STRING

for SERVER in server2 server3 server4 server5 server6 etc; do

echo -e &quot;\033[1;31m$SERVER says:\033[m&quot;
ssh $SERVER &quot;$STRING&quot;

done

echo -n &quot;Do you want to run the command locally? (y/n) :&quot;
read ANSWER

case &quot;$ANSWER&quot; in

y|Y) echo -e &quot;\033[1;31mlocalhost says:\033[m&quot;; $STRING ;;
N|n) exit 1 ;;
esac</pre>
<p>For this to work I had to create ssh keys on each server using:</p>
<pre class="brush: bash;">ssh-keygen -t dsa</pre>
<p>And then install the newly generated key (~/ssh/id_dsa.pub) into the authorized_keys file on<em> server1</em>. This works for running simple commands one at a time.</p>
<p>For other tasks its sometimes necessary to manage multiple ssh sessions at once, for example to monitor resources using <a href="http://htop.sourceforge.net/">htop</a> or tailing log files. On Linux you can use <a href="http://clusterssh.sourceforge.net/">ClusterSSH</a> (cssh) but this turned out to be a royal pain in the butt to get working on CentOS or RHEL. It worked OK in an Ubuntu VM but was a bit clunky and I felt there would be a better way of managing multiple PuTTy windows, since I am using a Windows 7 laptop for my day-to-day stuff.</p>
<p>There are quite a few goodies for this on the <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/links.html">Links page</a> on the Putty website and this is where I found <a href="http://www.millardsoftware.com/puttycs">Putty Command Sender</a>. Quite simply you type your command into the command sender, and much like clusterssh, it sends it to all the putty windows you have open.</p>
<p style="text-align: center;"><a href="http://ukstokes.com/blog/wp-content/uploads/2009/09/puttys.png" rel="lightbox"><img class="size-medium wp-image-518 aligncenter" title="puttys" src="http://ukstokes.com/blog/wp-content/uploads/2009/09/puttys-300x187.png" alt="puttys" width="300" height="187" /><em><br />
Putty Command Sender</em></a></p>
<p style="text-align: left;">It's not so great for editing files in Vi on 12 servers at once but it is possible - you can send cursor movements as well as lines of code or single commands. The only thing you have to watch out for in PuttyCS is that all Putty windows have updated before you start typing your next command, otherwise the last window to update may miss the first few characters of the next command.</p>
<p style="text-align: left;">Finally to launch my sessions in groups I'm using <a href="http://puttysm.sourceforge.net/">Putty Session Manager</a>. Other alternatives are available but I found this one to be the best. It's lightweight nature fits in with Putty nicely.</p>
<img src="http://feeds.feedburner.com/~r/Ukstokescom/~4/NW8aiTw8HzM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2009/09/09/managing-multiple-puttys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ukstokes.com/blog/2009/09/09/managing-multiple-puttys/</feedburner:origLink></item>
	</channel>
</rss>
