<?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>Guy Rutenberg &#187; Linux</title>
	<atom:link href="http://www.guyrutenberg.com/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guyrutenberg.com</link>
	<description>Keeping track of what I do</description>
	<lastBuildDate>Sat, 14 Jan 2012 11:30:25 +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>Creating a Deb for an Updated Version</title>
		<link>http://www.guyrutenberg.com/2011/12/17/creating-a-deb-for-an-updated-version/</link>
		<comments>http://www.guyrutenberg.com/2011/12/17/creating-a-deb-for-an-updated-version/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 16:16:04 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=928</guid>
		<description><![CDATA[Say you&#8217;ve an existing package like gitg and you want to use the new version of gitg or even apply your own patches. You could directly make install but you will probably regret it as soon as you&#8217;ll want to upgrade/uninstall, and you want to create a better package than the one created by checkinstall. [...]]]></description>
			<content:encoded><![CDATA[<p>Say you&#8217;ve an existing package like <code>gitg</code> and you want to use the new version of <code>gitg</code> or even apply your own patches. You could directly <code>make install</code> but you will probably regret it as soon as you&#8217;ll want to upgrade/uninstall, and you want to create a better package than the one created by <a href="">checkinstall</a>. Apperantly, creating a <code>deb</code> package for a new version of already packaged <code>deb</code> isn&#8217;t complicated.</p>
<h3>Getting Started</h3>
<p>Start by pulling the sources for the already available package. I&#8217;ll by using <code>gitg</code> as an example throughout this tutorial.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">apt-get source gitg</pre></div></div>

<p>This will create a folder according to the version of the package, something like <code>gitg-0.2.4</code>. Extract the new version besides it and <code>cd</code> into its directory. The next step is to copy the <code>debian/</code> directory from the old source package the code you&#8217;ve just extracted.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">cp -R ../gitg-0.2.4/debian/ .</pre></div></div>

<h3>Update <code>debian/</code> Files</h3>
<p>The next step is to update the files under the <code>debian/</code> sub-directory.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">DEBEMAIL=&quot;Guy Rutenberg &lt;myemail@domain.com&gt;&quot; debchange --nmu</pre></div></div>

<p>This will update the <code>debian/changelog</code> and set the new version. <code>--nmu</code> will create a new &#8220;non maintainer upload&#8221; version, meaning if the current version was <code>0.2.4-0ubuntu1</code>, it will change it to <code>0.2.4-0ubuntu1.1</code>. This will make sure that there won&#8217;t be any collision between your package and an official one. If you update to a new upstream version. It might be more suitable to use something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">debchange --newversion 0.2.5+20111211.git.20391c4</pre></div></div>

<p>If necessary, update the <code>Build-Depends</code> and <code>Depends</code> sections of <code>debian/control</code>.</p>
<h3>Building the Package</h3>
<p>If your building a package directly from version control and not part of an official release, you may need to run</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">./autogen</pre></div></div>

<p>at this point.</p>
<p>Now to the actual building:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">debuild -us -uc -i -I -B</pre></div></div>

<p><code>-us -uc</code> tells the script not to sign the <code>.dsc</code> and <code>.changes</code> files accordingly. <code>-i</code> and <code>-I</code> makes the script ignore common version control files. <code>-B</code> tells <code>debuild</code> to only create binary packages. You can also pass <code>-j</code> followed by the number of simultaneous jobs you wish to allow (e.g. <code>-j3</code>, like in <code>make</code>) which an significantly speed things up.</p>
<h3>Installing the Package</h3>
<p>The package will reside in the parent directory, for example:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">../gitg_0.2.5+20111211.git.20391c4_amd64.deb</pre></div></div>

<p>At this point you&#8217;re basically done. If you want to install the package you can use</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">sudo debi</pre></div></div>

<p>while you&#8217;re still inside the build directory.</p>
<h3>References</h3>
<ul>
<li><a href="https://help.ubuntu.com/community/UpdatingADeb">UpdatingADeb</a></li>
<li>Man pages for <code>debuild</code>, <code>dpgk-genchanges</code>, <code>dpgk-buildpackage</code>.<br />
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2011/12/17/creating-a-deb-for-an-updated-version/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Check if a server is about to run fsck</title>
		<link>http://www.guyrutenberg.com/2011/08/06/check-if-a-server-is-about-to-run-fsck/</link>
		<comments>http://www.guyrutenberg.com/2011/08/06/check-if-a-server-is-about-to-run-fsck/#comments</comments>
		<pubDate>Sat, 06 Aug 2011 06:02:40 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=846</guid>
		<description><![CDATA[Couple of weeks ago I installed some updates to my server. And when I restarted it, it didn&#8217;t came up. To make things worse, the IPMI console decided to go on strike so I couldn&#8217;t see what&#8217;s really going on. I presumed that the system isn&#8217;t responding because of some kernel panic. After a while, [...]]]></description>
			<content:encoded><![CDATA[<p>Couple of weeks ago I installed some updates to my server. And when I restarted it, it didn&#8217;t came up. To make things worse, the IPMI console decided to go on strike so I couldn&#8217;t see what&#8217;s really going on. I presumed that the system isn&#8217;t responding because of some kernel panic. After a while, I gave up for that night in hope the in the morning the IPMI would be sorted out. To my surprise, the IPMI was still out of work, but the server was up again. Apparently, the system wasn&#8217;t stuck on kernel panic, but on <code>fsck</code>&#8216;ing the harddisks. So in order to avoid such problems in the future I looked for a way to tell when the system is going to run <code>fsck</code> after the next reboot (I also had the IPMI fixed).</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"> $ sudo tune2fs -l /dev/sda6</pre></div></div>

<p>In the output you will find the following lines:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Mount count:              2
Maximum mount count:      36
Last checked:             Tue Jul 26 04:49:18 2011
Check interval:           15552000 (6 months)</pre></div></div>

<p>&#8220;Maximum mount count&#8221; is the number of mounts after which the filesystem will be checked by fsck. &#8220;Check interval&#8221; is the maximal time between two filesystem checks. The command also lets you see the actual mount count since the last check and when it took place.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2011/08/06/check-if-a-server-is-about-to-run-fsck/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>search_for_updates 0.2</title>
		<link>http://www.guyrutenberg.com/2011/05/10/search_for_updates-0-2/</link>
		<comments>http://www.guyrutenberg.com/2011/05/10/search_for_updates-0-2/#comments</comments>
		<pubDate>Tue, 10 May 2011 09:02:00 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Gentoo]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=815</guid>
		<description><![CDATA[This is a small update to my search_for_updates script which have been laying around. The script allows to search for updates from portage without resolving dependencies. Thus, it&#8217;s much faster than emerge -pvu world The new version lists the best version available for each package which can be updated using the --verbose flag. You can [...]]]></description>
			<content:encoded><![CDATA[<p>This is a small update to my <a href="/2010/09/19/searching-for-updates-without-emerge/"><code>search_for_updates</code></a> script which have been laying around. The script allows to search for updates from portage without resolving dependencies. Thus, it&#8217;s much faster than</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">emerge -pvu world</pre></div></div>

<p>The new version lists the best version available for each package which can be updated using the <code>--verbose</code> flag. You can download the new version from here: <a href="/wp-content/uploads/2011/05/search_for_updates-0.2">search_for_updates-0.2</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2011/05/10/search_for_updates-0-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iproute2 Cheatsheet</title>
		<link>http://www.guyrutenberg.com/2010/12/29/iproute2-cheatsheet/</link>
		<comments>http://www.guyrutenberg.com/2010/12/29/iproute2-cheatsheet/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 22:25:17 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[ip]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=758</guid>
		<description><![CDATA[The iproute2 package offers the ip utility, which is a modern replacments for tools such as ifconfig, route, arp and more. It allows to configure addresses, links route and arp tables. The only problem is that its documentation can be quite confusing. This post is intended to be a task-oriented guide to this utility, it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>The <code>iproute2</code> package offers the <code>ip</code> utility, which is a modern replacments for tools such as <code>ifconfig</code>, <code>route</code>, <code>arp</code> and more. It allows to configure addresses, links route and arp tables. The only problem is that its documentation can be quite confusing. This post is intended to be a task-oriented guide to this utility, it&#8217;s far from complete and I intend to update it from time to time.<br />
<span id="more-758"></span><br />
List available network interfaces and their ip addresses (along with other useful information).</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ ip addr</pre></div></div>

<p>Add an address to interface and define the subnet mask:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># ip addr add 192.168.1.81/24 dev eth0</pre></div></div>

<p>Removing an address:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># ip addr del 192.168.1.81/24 dev eth0</pre></div></div>

<p>Bringing network interface up:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># ip link set eth0 up</pre></div></div>

<p>and down:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># ip link set eth0 down</pre></div></div>

<p>List entries in the ARP table:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ ip neigh</pre></div></div>

<p>View routing rules:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ ip route</pre></div></div>

<p>Set default gateway:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># ip route add default via 192.168.1.1</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/12/29/iproute2-cheatsheet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Kernel Configuration and nvidia-drivers</title>
		<link>http://www.guyrutenberg.com/2010/11/19/kernel-configuration-and-nvidia-drivers/</link>
		<comments>http://www.guyrutenberg.com/2010/11/19/kernel-configuration-and-nvidia-drivers/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 14:41:28 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Kernel]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=777</guid>
		<description><![CDATA[This is more of a note to myself, as I keep forgetting this. The propriety NVIDIA drivers, provided by the x11-drivers/nvidia-drivers dislikes alternatives. It will refuse to build against a kernel with the rivafb (CONFIG_FB_RIVA) and nvidiafb (CONFIG_FB_NVIDIA) built in or built as modules. Both can be found (and unset) under: Device Drivers -&#62; Graphics [...]]]></description>
			<content:encoded><![CDATA[<p>This is more of a note to myself, as I keep forgetting this. The propriety NVIDIA drivers, provided by the <code>x11-drivers/nvidia-drivers</code> dislikes alternatives. It will refuse to build against a kernel with the <code>rivafb</code> (<code>CONFIG_FB_RIVA</code>) and <code>nvidiafb</code> (<code>CONFIG_FB_NVIDIA</code>) built in or built as modules. Both can be found (and unset) under:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Device Drivers
-&gt; Graphics support
   -&gt; nVidia Framebuffer Support
   -&gt; nVidia Riva support</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/11/19/kernel-configuration-and-nvidia-drivers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sudo for X Programs</title>
		<link>http://www.guyrutenberg.com/2010/11/12/sudo-for-x-programs/</link>
		<comments>http://www.guyrutenberg.com/2010/11/12/sudo-for-x-programs/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 09:15:04 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[X11]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=773</guid>
		<description><![CDATA[By default (at least on my machine), it wasn&#8217;t possible to open X applications using sudo. For example sudoing xclock resulted in the following error: $ sudo xclock No protocol specified Error: Can't open display: :0.0 The same error appeared even when I executed xclock after running sudo su. Apperantly, by default the X server [...]]]></description>
			<content:encoded><![CDATA[<p>By default (at least on my machine), it wasn&#8217;t possible to open X applications using <code>sudo</code>. For example <code>sudo</code>ing <code>xclock</code> resulted in the following error:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ sudo xclock
No protocol specified
Error: Can't open display: :0.0</pre></div></div>

<p>The same error appeared even when I executed <code>xclock</code> after running <code>sudo su</code>.<br />
<span id="more-773"></span><br />
Apperantly, by default the X server doesn&#8217;t allow anyone else besides you to open windows on the display. While it&#8217;s generally a good thing, it&#8217;s annoying if you&#8217;re trying to preform some GUI stuff as root. You can use the <code>xauth</code> utility to grant permissions to other users. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ xhost local:root
non-network local connections being added to access control list</pre></div></div>

<p>Allows <code>root</code> user connecting from the local machine (like <code>sudo</code>) to access the X display for your user. You can see the current access list by simply typing <code>xhost</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/11/12/sudo-for-x-programs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eject Your Kindle and Reconnect under Linux</title>
		<link>http://www.guyrutenberg.com/2010/11/06/eject-your-kindle-and-reconnect-under-linux/</link>
		<comments>http://www.guyrutenberg.com/2010/11/06/eject-your-kindle-and-reconnect-under-linux/#comments</comments>
		<pubDate>Sat, 06 Nov 2010 14:02:44 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Kindle]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=763</guid>
		<description><![CDATA[I am Your User suggested a method to eject your Kindle in Linux. While his method works, you don&#8217;t need to specify the partition number. E.g. $ sudo eject /dev/sdd where /dev/sdd is the device file of the Kindle. But what if you want to reconnect it back without plugging in and out the usb [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://iamyouruser.blogspot.com/2009/03/ubuntu-eject-kindle.html">I am Your User</a> suggested a method to eject your Kindle in Linux. While his method works, you don&#8217;t need to specify the partition number. E.g.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ sudo eject /dev/sdd</pre></div></div>

<p>where <code>/dev/sdd</code> is the device file of the Kindle.</p>
<p>But what if you want to reconnect it back without plugging in and out the usb cable? You can add the <code>-t</code> switch.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ sudo eject -t /dev/sdd</pre></div></div>

<p>Even though it prints the following error:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">eject: CD-ROM tray close command failed: Input/output error</pre></div></div>

<p>it works, and the Kindle reappears in KDE.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/11/06/eject-your-kindle-and-reconnect-under-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Searching for Updates without emerge</title>
		<link>http://www.guyrutenberg.com/2010/09/19/searching-for-updates-without-emerge/</link>
		<comments>http://www.guyrutenberg.com/2010/09/19/searching-for-updates-without-emerge/#comments</comments>
		<pubDate>Sun, 19 Sep 2010 21:19:52 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Gentoo]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=739</guid>
		<description><![CDATA[The normal way to see which installed packages have available updates on Gentoo is running $ emerge -puv world And then you usually select the packages you really want to update and emerge them. However this workflow has several downsides: It&#8217;s slow. When portage checks for updates this way it fully resolves all the dependencies. [...]]]></description>
			<content:encoded><![CDATA[<p>The normal way to see which installed packages have available updates on Gentoo is running</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ emerge -puv world</pre></div></div>

<p>And then you usually select the packages you really want to update and emerge them. However this workflow has several downsides:</p>
<ol>
<li>It&#8217;s slow. When portage checks for updates this way it fully resolves all the dependencies. This process is unnecessary, as in many cases you aren&#8217;t interested in updating all the packages, furthermore in their dependencies.</li>
<li>It may fail. When portage fails to resolve the dependencies, it will either complain or completely fail. If it complains, it isn&#8217;t really that bad, except for the time used for resolving the unanswered dependencies. Sometimes it fails completely (usually when masking is involved) and won&#8217;t display any of the available packages, hence leaving the user in the dark (except for some dependency error message).</li>
<li>It displays lot&#8217;s of output. Many times you&#8217;re not interesting in seeing the dependencies that will be updated if you emerge every package in the world file. It&#8217;s just confusing and distract you from the interesting updates for packages in the world file.</li>
</ol>
<p>The following scripts tries to work around these problems. It works by querying the portage API for the best version available for each package in the world file. If that version isn&#8217;t installed it reports that there are updates waiting for that package. The script runs faster then <code>emerge -pvu world</code> and only displays the packages from the world file. If you find a package that you want to upgrade you can emerge it separately to see the required dependencies.</p>
<p><span id="more-739"></span></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#! /usr/bin/env python</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#   Copyright 2010 Guy Rutenberg</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#   This program is free software: you can redistribute it and/or modify</span>
<span style="color: #808080; font-style: italic;">#   it under the terms of the GNU General Public License as published by</span>
<span style="color: #808080; font-style: italic;">#   the Free Software Foundation, either version 3 of the License, or</span>
<span style="color: #808080; font-style: italic;">#   (at your option) any later version.</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#   This program is distributed in the hope that it will be useful,</span>
<span style="color: #808080; font-style: italic;">#   but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span style="color: #808080; font-style: italic;">#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<span style="color: #808080; font-style: italic;">#   GNU General Public License for more details.</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#   You should have received a copy of the GNU General Public License</span>
<span style="color: #808080; font-style: italic;">#   along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> portage
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">logging</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">subprocess</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">optparse</span> <span style="color: #ff7700;font-weight:bold;">import</span> OptionParser
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> MainApp:
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>,args=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span>:
        usage = <span style="color: #483d8b;">&quot;Usage: %prog [options]&quot;</span>
        version = <span style="color: #483d8b;">&quot;0.1&quot;</span>
        <span style="color: #dc143c;">parser</span> = OptionParser<span style="color: black;">&#40;</span>usage,version=version<span style="color: black;">&#41;</span>
        <span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;</span>,<span style="color: #483d8b;">&quot;--kde&quot;</span>, dest=<span style="color: #483d8b;">&quot;kde&quot;</span>,default=<span style="color: #008000;">False</span>,
                          action=<span style="color: #483d8b;">&quot;store_true&quot;</span>,
                          <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;Post a notification with the number of update&quot;</span><span style="color: black;">&#41;</span>
        <span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;-q&quot;</span>,<span style="color: #483d8b;">&quot;--quiet&quot;</span>, dest=<span style="color: #483d8b;">&quot;quiet&quot;</span>,default=<span style="color: #008000;">False</span>,
                          action=<span style="color: #483d8b;">&quot;store_true&quot;</span>,
                          <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;Make as little output as possible&quot;</span><span style="color: black;">&#41;</span>
        <span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">options</span>, <span style="color: #008000;">self</span>.<span style="color: black;">args</span><span style="color: black;">&#41;</span> = <span style="color: #dc143c;">parser</span>.<span style="color: black;">parse_args</span><span style="color: black;">&#40;</span>args=args<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> run<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: black;">updatable</span> = <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> atom <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">self</span>.<span style="color: black;">get_world_entries</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
            <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">self</span>.<span style="color: black;">get_best_version</span><span style="color: black;">&#40;</span>atom<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">self</span>.<span style="color: black;">get_installed_versions</span><span style="color: black;">&#40;</span>atom<span style="color: black;">&#41;</span>:
                <span style="color: #008000;">self</span>.<span style="color: black;">updatable</span>.<span style="color: black;">add</span><span style="color: black;">&#40;</span>atom<span style="color: black;">&#41;</span>
                <span style="color: #ff7700;font-weight:bold;">print</span> atom
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">self</span>.<span style="color: black;">options</span>.<span style="color: black;">kde</span>:
            <span style="color: #008000;">self</span>.<span style="color: black;">notify_kde</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">self</span>.<span style="color: black;">options</span>.<span style="color: black;">quiet</span>:
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Total:&quot;</span>,<span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">updatable</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> notify_kde<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">updatable</span><span style="color: black;">&#41;</span>:
            text = <span style="color: #483d8b;">&quot;There are %i updates&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">updatable</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            text = <span style="color: #483d8b;">&quot;There are no updates&quot;</span>
        <span style="color: #dc143c;">subprocess</span>.<span style="color: black;">call</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;kdialog&quot;</span>, <span style="color: #483d8b;">&quot;--passivepopup&quot;</span>, text, <span style="color: #483d8b;">&quot;--title&quot;</span>, <span style="color: #483d8b;">&quot;Portage Updates&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
&nbsp;
    @<span style="color: #008000;">staticmethod</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> get_world_entries<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;&quot;
        parses the world file and returns a set of all the atoms
        &quot;&quot;&quot;</span>
        f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;/&quot;</span>+portage.<span style="color: black;">WORLD_FILE</span>, <span style="color: #483d8b;">&quot;r&quot;</span><span style="color: black;">&#41;</span>
        atoms = <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> f.<span style="color: black;">readlines</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
            atom = line<span style="color: black;">&#91;</span>:-<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
            <span style="color: #ff7700;font-weight:bold;">if</span> portage.<span style="color: black;">isvalidatom</span><span style="color: black;">&#40;</span>line<span style="color: black;">&#91;</span>:-<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>:
                atoms.<span style="color: black;">add</span><span style="color: black;">&#40;</span>atom<span style="color: black;">&#41;</span>
        f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> atoms
&nbsp;
    @<span style="color: #008000;">staticmethod</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> get_installed_versions<span style="color: black;">&#40;</span>atom<span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> portage.<span style="color: black;">db</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'/'</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'vartree'</span><span style="color: black;">&#93;</span>.<span style="color: black;">dbapi</span>.<span style="color: black;">match</span><span style="color: black;">&#40;</span>atom<span style="color: black;">&#41;</span>
&nbsp;
    @<span style="color: #008000;">staticmethod</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> get_best_version<span style="color: black;">&#40;</span>atom<span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;&quot;
        Returns the best available version taking into account masking and
        keywords
        &quot;&quot;&quot;</span>
        available = portage.<span style="color: black;">db</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'/'</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'porttree'</span><span style="color: black;">&#93;</span>.<span style="color: black;">dbapi</span>.<span style="color: black;">match</span><span style="color: black;">&#40;</span>atom<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> portage.<span style="color: black;">best</span><span style="color: black;">&#40;</span>available<span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
    app = MainApp<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    app.<span style="color: black;">run</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;"># vim: filetype=python ai ts=5 sts=4 et sw=4</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/09/19/searching-for-updates-without-emerge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading All QT Modules in Gentoo</title>
		<link>http://www.guyrutenberg.com/2009/11/21/upgrading-all-qt-modules-in-gentoo/</link>
		<comments>http://www.guyrutenberg.com/2009/11/21/upgrading-all-qt-modules-in-gentoo/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 20:01:06 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[QT]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=594</guid>
		<description><![CDATA[Upgrading minor versions QT seems to be a hassle, as each version blocks the previous and because of inter-dependencies, Gentoo can&#8217;t understand by itself how to solve them. The solution is to tell it to specifically upgrade all installed modules. sudo emerge -avu1 $&#40;qlist -IvC /qt- &#124; grep 4. &#124; sed s/-4.*//&#41; This will allow [...]]]></description>
			<content:encoded><![CDATA[<p>Upgrading minor versions QT seems to be a hassle, as each version blocks the previous and because of inter-dependencies, Gentoo can&#8217;t understand by itself how to solve them. The solution is to tell it to specifically upgrade all installed modules.<br />
<span id="more-594"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> emerge <span style="color: #660033;">-avu1</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>qlist <span style="color: #660033;">-IvC</span> <span style="color: #000000; font-weight: bold;">/</span>qt- <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #000000;">4</span>. <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> s<span style="color: #000000; font-weight: bold;">/</span>-<span style="color: #000000;">4</span>.<span style="color: #000000; font-weight: bold;">*//</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>This will allow Gentoo to solve the dependencies by uninstalling the old versions, unlike if you only try to upgrade a single package like <code>x11-libs/qt-core</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/11/21/upgrading-all-qt-modules-in-gentoo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NVidia driver fails to initialize after X restart</title>
		<link>http://www.guyrutenberg.com/2009/11/14/nvidia-driver-fails-to-initialize-after-x-restart/</link>
		<comments>http://www.guyrutenberg.com/2009/11/14/nvidia-driver-fails-to-initialize-after-x-restart/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 15:19:14 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Errors]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=589</guid>
		<description><![CDATA[This is mainly a note to myself. Sometimes when the X server is restart it complains that nvidia driver couldn&#8217;t be initialized and that no screens were found. This may be a result of a version mismatch between X11&#8242;s and the kernel&#8217;s nvidia module. The solution is to modprobe -r nvidia before restarting the X [...]]]></description>
			<content:encoded><![CDATA[<p>This is mainly a note to myself. Sometimes when the X server is restart it complains that <code>nvidia</code> driver couldn&#8217;t be initialized and that no screens were found. This may be a result of a version mismatch between X11&#8242;s and the kernel&#8217;s <code>nvidia</code> module. The solution is to</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">modprobe -r nvidia</pre></div></div>

<p>before restarting the X server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/11/14/nvidia-driver-fails-to-initialize-after-x-restart/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.461 seconds -->

