<?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>Paul Legato &#187; unix</title>
	<atom:link href="http://www.paullegato.com/blog/tag/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.paullegato.com</link>
	<description></description>
	<lastBuildDate>Tue, 06 Dec 2011 00:52:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Dell PowerEdge BIOS Upgrade on Linux</title>
		<link>http://www.paullegato.com/blog/dell-poweredge-bios-linux/</link>
		<comments>http://www.paullegato.com/blog/dell-poweredge-bios-linux/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 05:13:59 +0000</pubDate>
		<dc:creator>Paul Legato</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.paullegato.com/?p=372</guid>
		<description><![CDATA[How to flash the BIOS on a Linux Dell PowerEdge system without having to use MS Windows.]]></description>
			<content:encoded><![CDATA[<p>Dell only provides certain PowerEdge BIOS flash upgrades in the form of Windows-only self-extracting archives (despite the facts that they claim to officially support Linux and that the BIOS flash utility itself is a DOS program.) Ordinary <code>unzip</code> won&#8217;t open the self-extracting archive. You need to run it on a Windows system, which I don&#8217;t have. Here&#8217;s how to flash your PowerEdge BIOS without Windows.</p>
<p>Dell provides the <a target="_blank" href="http://linux.dell.com/projects.shtml#biosdisk"  class="broken_link">biosdisk utility</a> to make a bootable FreeDOS image with the BIOS upgrade executable on it, but it doesn&#8217;t work with the Windows-only PowerEdge 4400 BIOS upgrade, since that won&#8217;t run on FreeDOS. They claim that <code>biosdisk</code> isn&#8217;t intended for PowerEdge systems, since they all have Linux BIOS flashes available; this does not seem to actually be the case for the 4400.</p>
<p>The Windows self-extractor <em>does</em> run under WINE, but it demands an actual floppy drive device to write to, which my computer doesn&#8217;t have. WINE also doesn&#8217;t seem to support mounting an image file as a floppy device, for some reason. You&#8217;ll need to use something like VMWare or a computer with a physical floppy drive to get this to extract itself.</p>
<p>Once you have a floppy image, here&#8217;s how to flash without biosdisk or Windows available: <span id="more-372"></span></p>
<ol>
<li><strong>Use <a target="_blank" href="http://wiki.winehq.org/FrontPage" >WINE</a> to extract the archive.</strong> For maximum fun, the upgrade I have refuses to just extract itself; instead, it requires that it has access to a floppy drive to write to directly. Sigh. Ok. Working on that. Updates to come. <code>winecfg</code>
<li><strong>Install <a target="_blank" href="http://syslinux.zytor.com/wiki/index.php/The_Syslinux_Project" >syslinux</a>.</strong>  (<code>apt-get install syslinux</code>). We are going to use <a target="_blank" href="http://syslinux.zytor.com/wiki/index.php/MEMDISK" >memdisk</a>, a boot loader that creates a RAM drive and then loads an operating system, to load FreeDOS.</li>
<li><strong>Get a<a target="_blank" href="http://www.fdos.org/bootdisks/" > FreeDOS boot disk image</a> and add your flashing .exe to it.</strong>Mount with something like <code>mount -t vfat /path/to/freedos.img /mnt -o loop</code>, then just <code>cp</code> your flashing .exe to <code>/mnt</code>. (If you got a gzipped image, <code>gunzip</code> it first.</li>
<li><strong>Edit /etc/grub.d/40_custom to add a boot menu entry for memdisk/FreeDOS.</strong>
<pre class="brush: plain; title: ; notranslate">
menuentry &quot;FreeDOS&quot; {
    set root=(hd0,2) #### &lt;--- Change this to your /boot partition!
    linux16 /memdisk floppy
    initrd16 /freedos.img
}
</pre>
<p>As noted, change the root entry to point to your actual /boot partition, so GRUB can find the images. Also note that the partition normally mounted at <code>/boot</code> will be mounted as the root directory (/) at boot time, so it&#8217;s not necessary to prefix <code>/boot</code> before the image file names.</p>
<p>Then, reboot and select FreeDos from the GRUB menu. Run your DOS-based flash program, and all is well.</p>
<img src="http://www.paullegato.com/?ak_action=api_record_view&id=372&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.paullegato.com/blog/dell-poweredge-bios-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash BIOS Without a Floppy</title>
		<link>http://www.paullegato.com/blog/flash-bios-without-floppy/</link>
		<comments>http://www.paullegato.com/blog/flash-bios-without-floppy/#comments</comments>
		<pubDate>Sun, 09 May 2010 00:09:53 +0000</pubDate>
		<dc:creator>Paul Legato</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.paullegato.com/?p=283</guid>
		<description><![CDATA[Flashing the BIOS without a floppy drive can be done with an Ultimate Boot CD (free!) and a USB memory stick. BIOS upgrades usually come in the form of an MS-DOS executable meant to be run from a bootable floppy, but modern computers don&#8217;t usually have floppy drives anymore, and who has a copy of [...]]]></description>
			<content:encoded><![CDATA[<p>Flashing the BIOS without a floppy drive can be done with an <a target="_blank" href="http://www.ultimatebootcd.com/download.html" >Ultimate Boot CD</a> (free!) and a USB memory stick. BIOS upgrades usually come in the form of an MS-DOS executable meant to be run from a bootable floppy, but modern computers don&#8217;t usually have floppy drives anymore, and who has a copy of DOS lying around anyway?</p>
<ol>
<li>Download a copy of the free <a target="_blank" href="http://www.ultimatebootcd.com/download.html" >Ultimate Boot CD</a> and burn it to disk. <a target="_blank" href="http://www.freedos.org/" >FreeDOS</a> (and a lot of other useful stuff) is preinstalled on the CD. As the name implies, FreeDOS is a free, open source, binary-compatible replacement for MS-DOS.</lI>
<li>Download the replacement BIOS from your motherboard&#8217;s manufacturer. Unpack it onto a USB flash drive.</li>
<li>Plug your flash drive into the target computer and boot it with your Ultimate Boot CD. Select FreeDOS from the menu.</li>
<li>FreeDOS asks a number of configuration questions while booting. You can usually leave all at their default except for the ASPIUSB driver. ASPIUSB is <em>not</em> enabled by default (at the time of this writing), but is necessary for the use of a USB flash drive under DOS, so enable it when prompted.
<li>If you miss the prompt for the USB driver, don&#8217;t worry. Type &#8220;<code>menu</code>&#8221; at a command prompt and enable USB devices from the popup menu.</li>
</li>
<li>Change to your flash drive by typing e.g. <code>R:</code> and execute the BIOS flash utility as per the manufacturer&#8217;s instructions. (If you don&#8217;t know which drive letter to use, type &#8220;<code>menu</code>&#8221; and select the option to display active drive letters.)</li>
</ol>
<img src="http://www.paullegato.com/?ak_action=api_record_view&id=283&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.paullegato.com/blog/flash-bios-without-floppy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Libcurl bindings for Java on Macintosh</title>
		<link>http://www.paullegato.com/blog/libcurl-java-macintosh/</link>
		<comments>http://www.paullegato.com/blog/libcurl-java-macintosh/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 03:35:14 +0000</pubDate>
		<dc:creator>Paul Legato</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.paullegato.com/?p=173</guid>
		<description><![CDATA[Libcurl's Java bindings now compile on Macintosh, with a few minor modifications to the Makefile. Get the code from my Github account.]]></description>
			<content:encoded><![CDATA[<p>Libcurl&#8217;s Java bindings now compile on Macintosh, with a few minor modifications to the Makefile. <a target="_blank" href="http://github.com/pjlegato/curl-java" >Get the code</a> from my Github account.</p>
<p><em>Update</em>: More recent Java bindings, which do not seem to be linked anywhere on the libcurl site, are available at <a target="_blank" href="http://www.gknw.net/viewvc/trunk/?root=curl-java"  class="broken_link">http://www.gknw.net/viewvc/trunk/?root=curl-java</a>. Still no multi support, though.</p>
<img src="http://www.paullegato.com/?ak_action=api_record_view&id=173&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.paullegato.com/blog/libcurl-java-macintosh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Launchctl vs Cron: You&#8217;ve Got To Be Kidding Me</title>
		<link>http://www.paullegato.com/blog/launchctl-cron/</link>
		<comments>http://www.paullegato.com/blog/launchctl-cron/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 23:05:30 +0000</pubDate>
		<dc:creator>Paul Legato</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.paullegato.com/?p=19</guid>
		<description><![CDATA[So I wanted to write a cron job on my Mac. Just run this script every day at midnight. Nothing fancy. In standard Unix, this is one line in a crontab: 0 0 * * * /some/script That&#8217;s it. Put that in your crontab and /some/script will run every day at midnight. Naturally, I typed [...]]]></description>
			<content:encoded><![CDATA[<p>So I wanted to write a cron job on my Mac. Just run this script every day at midnight. Nothing fancy.</p>
<p>In standard Unix, this is <em>one line</em> in a crontab:</p>
<blockquote><p><code>0 0 * * * /some/script</code></p></blockquote>
<p>That&#8217;s it. Put that in your crontab and <code>/some/script</code> will run every day at midnight.</p>
<p>Naturally, I typed <code>man crontab</code> on my Mac to get started. Apple likes to make weird minor modifications to standard Unix commands sometimes. I found:</p>
<blockquote><p>(Darwin note: Although cron(8) and crontab(5) are officially supported under Darwin, their functionality has been absorbed into launchd(8), which provides a more flexible way of automatically executing commands.  See launchctl(1) for more information.)</p></blockquote>
<p>More flexible, huh? I&#8217;m all about more flexible! Sounds good. Another well thought out Apple improvement, sweeping away 30+ years of Unix cruft at a stroke!</p>
<p>Not quite.<span id="more-19"></span> Turns out that you must submit jobs to <code>launchctl</code> as <strong>XML files</strong>. We all know how much I hate XML files, and this is a great example of why. That one line cronjob becomes <a target="_blank" href="http://forums.macosxhints.com/archive/index.php/t-48458.html" >this fragile ~20 line XML monstrosity</a>:</p>
<blockquote><p><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />
&lt;!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;<br />
&lt;plist version="1.0"&gt;<br />
&lt;dict&gt;<br />
&lt;key&gt;Label&lt;/key&gt;<br />
&lt;string&gt;net.sourceforge.awstats.update-daily&lt;/string&gt;<br />
&lt;key&gt;LowPriorityIO&lt;/key&gt;<br />
&lt;true/&gt;<br />
&lt;key&gt;OnDemand&lt;/key&gt;<br />
&lt;false/&gt;<br />
&lt;key&gt;Program&lt;/key&gt;<br />
&lt;string&gt;/opt/local/www/awstats/cgi-bin/awstats.pl&lt;/string&gt;<br />
&lt;key&gt;ProgramArguments&lt;/key&gt;<br />
&lt;array&gt;<br />
&lt;string&gt;-config=INSERT_YOUR_COMPUTER_NAME_HERE.local&lt;/string&gt;<br />
&lt;string&gt;-update&lt;/string&gt;<br />
&lt;/array&gt;<br />
&lt;key&gt;ServiceDescription&lt;/key&gt;<br />
&lt;string&gt;Updates statistics for awstats.pl every day at 3AM.&lt;/string&gt;<br />
&lt;key&gt;StartCalendarInterval&lt;/key&gt;<br />
&lt;dict&gt;<br />
&lt;key&gt;Hour&lt;/key&gt;<br />
&lt;integer&gt;3&lt;/integer&gt;<br />
&lt;/dict&gt;<br />
&lt;/dict&gt;<br />
&lt;/plist&gt;</code></p></blockquote>
<p>But it defines its own syntax!! I can already hear the XML cheerleaders say. Well, sort of. You can read it, kinda, even if you are unfamiliar with the syntax, but you certainly can&#8217;t write it without spending half an hour or more reading about and then absorbing the syntax documentation first.  For comparison, you can learn the syntax of a crontab entry in around 1 minute. Hell, the <em>documentation</em> of the crontab syntax is shorter than that one simple launchd plist example, nevermind the <a target="_blank" href="http://developer.apple.com/Mac/library/documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html" >13 page manpage explaining the launchd plist syntax</a>.</p>
<p>More verbosity means more things that can be screwed up, as that discussion thread amply demonstrates. Even extremely simple jobs become ordeals. In this case, the problem stems from <em>trying to do too much in one tool</em>,  forgetting the Unix philosophy: <strong>do one thing, and do it well</strong>. Create reusable, chainable tools, rather than one monolithic beast that tries to do everything. Apple bills <a target="_blank" href="http://www.google.com/search?q=launchd+replaces+site%3Adeveloper.apple.com" >launchd as a replacement for init, rc, init.d, rc.d, SystemStarter, inetd/xinetd, atd, crond, and watchdogd.</a> Maybe others, too.</p>
<p>Developing a language powerful enough to capture the functionality of all of those different tools results in a massively complex, fragile, general-purpose language. Developing a tool that does exactly 1 of those things results in a tiny, simple, clean, resilient language that is easy to use and hard to screw up. Complex cases are then handled by gluing those many small tools together, not by programming a massive monolith.</p>
<p>Fortunately, cron is still supported by Mac OS X as a legacy service, so I&#8217;m using that. If and when they finally remove it from the OS altogether, I&#8217;ll be using the MacPorts version.</p>
<img src="http://www.paullegato.com/?ak_action=api_record_view&id=19&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.paullegato.com/blog/launchctl-cron/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

