<?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>Dirty Motherfucking Blog &#187; administration</title>
	<atom:link href="http://dirty-motherfucker.org/blog/category/administration/feed/" rel="self" type="application/rss+xml" />
	<link>http://dirty-motherfucker.org/blog</link>
	<description>All kinds of shit</description>
	<lastBuildDate>Wed, 09 May 2012 12:49:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-beta4-20750</generator>
		<item>
		<title>Error code 600 when viewing Autodiscover.xml WTF?</title>
		<link>http://dirty-motherfucker.org/blog/2012/05/09/error-code-600-when-viewing-autodiscover-xml-wtf/</link>
		<comments>http://dirty-motherfucker.org/blog/2012/05/09/error-code-600-when-viewing-autodiscover-xml-wtf/#comments</comments>
		<pubDate>Wed, 09 May 2012 10:27:00 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=393</guid>
		<description><![CDATA[So you&#8217;re trying to set up the Exchange Autodiscovery but it just won&#8217;t work? You&#8217;re checking your autodiscover URL http://exchange.contoso.com/autodiscover/autodiscover.xml but all you&#8217;re seeing it this stupid error message that tells you nothing, except: If this is what&#8217;s happening to you, stop doing it :P You&#8217;ll never be able to check the autodiscover.xml from a [...]]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;re trying to set up the Exchange Autodiscovery but it just won&#8217;t work?</p>
<p>You&#8217;re checking your autodiscover URL http://exchange.contoso.com/autodiscover/autodiscover.xml but all you&#8217;re seeing it this stupid error message that tells you nothing, except:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;  
&lt;Autodiscover xmlns=&quot;http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006&quot;&gt;
  &lt;Response&gt;
    &lt;Error Time=&quot;09:28:57.8739220&quot; Id=&quot;2715916636&quot;&gt;
      &lt;ErrorCode&gt;600&lt;/ErrorCode&gt;
      &lt;Message&gt;Invalid Request&lt;/Message&gt;
      &lt;DebugData /&gt;
    &lt;/Error&gt;
  &lt;/Response&gt;
&lt;/Autodiscover&gt;
</pre>
<p>If this is what&#8217;s happening to you, stop doing it :P You&#8217;ll never be able to check the autodiscover.xml from a browser. The contents of the file <a href="http://www.administrator.de/index.php?content=162857">depend on the user agent</a> of the client that requests it. Only Outlook (or compatible clients) will receive ANY configuration.</p>
<p>So, before you start deleting your virtual Autodiscover directory and re-create it it, make sure you&#8217;re using <a href="http://eightwone.com/2010/08/15/standalone-autodiscover-test/">the correct client</a> to verify your results.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2012/05/09/error-code-600-when-viewing-autodiscover-xml-wtf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to fix failing language pack updates in TYPO3</title>
		<link>http://dirty-motherfucker.org/blog/2012/02/27/how-to-fix-failing-language-pack-updates-in-typo3/</link>
		<comments>http://dirty-motherfucker.org/blog/2012/02/27/how-to-fix-failing-language-pack-updates-in-typo3/#comments</comments>
		<pubDate>Mon, 27 Feb 2012 12:14:18 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[typo3]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=390</guid>
		<description><![CDATA[If you update language packs through the TYPO3 extension manager, it can happen that it will mark the update as &#8220;failed&#8221;, but if you check for updates again, it tells you there are no updates available. Generally it behaves kind of weird with language pack updates. What&#8217;s going on and how do I fix it? [...]]]></description>
			<content:encoded><![CDATA[<p>If you update language packs through the TYPO3 extension manager, it can happen that it will mark the update as &#8220;failed&#8221;, but if you check for updates again, it tells you there are no updates available.</p>
<p>Generally it behaves kind of weird with language pack updates. What&#8217;s going on and how do I fix it?</p>
<p>The cause of the problem is <a href="http://forge.typo3.org/issues/30918">broken ZIP support in TYPO3</a>. At least that&#8217;s what my research concluded.</p>
<p>To fix this, you need to set the path to the unzip utility in the TYPO3 configuration (so it doesn&#8217;t use the internal ZIP support). To do so you need to set this configuration variable:</p>
<pre class="brush: php; title: ; notranslate">
$TYPO3_CONF_VARS['BE']['unzip_path'] = '/usr/bin/unzip';
</pre>
<p>Set it to wherever your unzip utility is located.</p>
<p>So what if you&#8217;re on Windows and don&#8217;t have unzip? I have no idea. Would be glad if someone told me.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2012/02/27/how-to-fix-failing-language-pack-updates-in-typo3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Self-updating Bash Script Revised</title>
		<link>http://dirty-motherfucker.org/blog/2012/02/26/self-updating-bash-script-revised/</link>
		<comments>http://dirty-motherfucker.org/blog/2012/02/26/self-updating-bash-script-revised/#comments</comments>
		<pubDate>Sun, 26 Feb 2012 00:19:56 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=377</guid>
		<description><![CDATA[I recently posted an approach for a self-updating bash script. Shortly after using it in production, I noticed a critical shortcoming. Due to the simple way in which I implemented my update checking (an MD5 sum over the script itself), changes to the script interpreter line (aka shebang) would cause the script to output that [...]]]></description>
			<content:encoded><![CDATA[<p>I recently posted an approach for a <a href="http://dirty-motherfucker.org/blog/2011/12/22/self-updating-bash-script/">self-updating bash script</a>. Shortly after using it in production, I noticed a critical shortcoming.</p>
<p>Due to the simple way in which I implemented my update checking (an MD5 sum over the script itself), changes to the script interpreter line (aka shebang) would cause the script to output that a new version was available.</p>
<p>In addition to that, if the user did perform the update, his modification to the interpreter line would be overwritten.</p>
<p>So here is the revised version, that respects the first line on the script itself:</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash

set -o nounset
set -o errexit

SELF=$(basename $0)

# The base location from where to retrieve new versions of this script
UPDATE_BASE=http://typo3scripts.googlecode.com/svn/trunk

# Update check
function updateCheck() {
  SUM_LATEST=$(curl $UPDATE_BASE/versions 2&gt;&amp;1 | grep $SELF | awk '{print $2}')
  SUM_SELF=$(tail --lines=+2 &quot;$0&quot; | md5sum | awk '{print $1}')
  if [[ &quot;&quot; == $SUM_LATEST ]]; then
    echo &quot;No update information is available for '$SELF'&quot; &gt;&amp;2
    echo &quot;Please check the project home page http://code.google.com/p/typo3scripts/.&quot; &gt;&amp;2
    
  elif [[ &quot;$SUM_LATEST&quot; != &quot;$SUM_SELF&quot; ]]; then
    echo &quot;NOTE: New version available!&quot; &gt;&amp;2
  fi
}

# Self-update
function runSelfUpdate() {
  echo &quot;Performing self-update...&quot;
  
  _tempFileName=&quot;$0.tmp&quot;
  _payloadName=&quot;$0.payload&quot;
  
  # Download new version
  echo -n &quot;Downloading latest version...&quot;
  if ! wget --quiet --output-document=&quot;$_payloadName&quot; $UPDATE_BASE/$SELF ; then
    echo &quot;Failed: Error while trying to wget new version!&quot;
    echo &quot;File requested: $UPDATE_BASE/$SELF&quot;
    exit 1
  fi
  echo &quot;Done.&quot;
  
  # Restore shebang
  _interpreter=$(head --lines=1 &quot;$0&quot;)
  echo $_interpreter &gt; &quot;$_tempFileName&quot;
  tail --lines=+2 &quot;$_payloadName&quot; &gt;&gt; &quot;$_tempFileName&quot;
  rm &quot;$_payloadName&quot;
  
  # Copy over modes from old version
  OCTAL_MODE=$(stat -c '%a' $SELF)
  if ! chmod $OCTAL_MODE &quot;$_tempFileName&quot; ; then
    echo &quot;Failed: Error while trying to set mode on $_tempFileName.&quot;
    exit 1
  fi
  
  # Spawn update script
  cat &gt; updateScript.sh &lt;&lt; EOF
#!/bin/bash
# Overwrite old file with new
if mv &quot;$_tempFileName&quot; &quot;$0&quot;; then
  echo &quot;Done.&quot;
  echo &quot;Update complete.&quot;
  rm -- \$0
else
  echo &quot;Failed!&quot;
fi
EOF
  
  echo -n &quot;Inserting update process...&quot;
  exec /bin/bash updateScript.sh
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2012/02/26/self-updating-bash-script-revised/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Safely updating TYPO3 extensions</title>
		<link>http://dirty-motherfucker.org/blog/2012/02/22/safely-updating-typo3-extensions/</link>
		<comments>http://dirty-motherfucker.org/blog/2012/02/22/safely-updating-typo3-extensions/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 00:01:26 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[typo3]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[typo3scripts]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=364</guid>
		<description><![CDATA[A difference between the originally installed version and the current was detected! If you have ever read that warning in the TYPO3 extension manager, you know exactly how annoying it can be to find that difference. You made some minor tweak or fix and forgot about it and now you don&#8217;t know what it was [...]]]></description>
			<content:encoded><![CDATA[<p><em>A difference between the originally installed version and the current was detected!</em></p>
<p>If you have ever read that warning in the TYPO3 extension manager, you know exactly how annoying it can be to find that difference.</p>
<p>You made some minor tweak or fix and forgot about it and now you don&#8217;t know what it was and if the updated extension contains the same fix.</p>
<p>Or even worse. You&#8217;re already up to the new extension manager interface where there are neither upload comments nor the warning about local modification. Oh boy, oh boy.</p>
<p>So what can you do? Here&#8217;s what.</p>
<p>To do this, we need 3 scripts from the <a href="http://code.google.com/p/typo3scripts/">typo3scripts</a> script suite.</p>
<ol>
<li>extUpdate.sh</li>
<li>extChangelog.sh</li>
<li>extExtract.php</li>
</ol>
<p>How to install and configure these scripts is explained on their respective wiki pages on the project homepage, so I won&#8217;t repeat that here. Let&#8217;s get right to the interesting parts.</p>
<pre class="brush: bash; title: ; notranslate">$ ./extUpdate.sh
Sourcing script configuration from typo3scripts.conf...Done.
Checking dependencies...Succeeded.
New version of 'direct_mail' available. Installed: 2.6.10 Latest: 2.7.0
New version of 'div2007' available. Installed: 0.7.2 Latest: 0.8.1
New version of 'kb_md5fepw' available. Installed: 0.4.0 Latest: 0.4.1
New version of 'realurl' available. Installed: 1.12.0 Latest: 1.12.1</pre>
<p>First of all, let&#8217;s see the upload comments for those extensions:</p>
<pre class="brush: bash; title: ; notranslate">./extUpdate.sh --changelog
Sourcing script configuration from typo3scripts.conf...Done.
Checking dependencies...Succeeded.
New version of 'direct_mail' available. Installed: 2.6.10 Latest: 2.7.0
2.7.0 (2012-01-30 00:44:37)
 - layout tweaking
 - create draft newsletter and auto sending (e.g. weekly) (thanks to Benni Mack)
 - bug fixes
 please refer to changelog for further info.
 please report any bug or feature or anything in Forge (forge.typo3.org)

New version of 'div2007' available. Installed: 0.7.2 Latest: 0.8.1
0.8.0 (2012-01-23 21:19:28)
 add new classes for email and error message generation
 ready for TYPO3 4.6
0.8.1 (2012-01-28 18:10:45)
 allow the usage of a pibase object instead of class.tx_div2007_alpha_language_base

New version of 'kb_md5fepw' available. Installed: 0.4.0 Latest: 0.4.1
0.4.1 (2010-10-27 21:04:19)
 DEPRECATED: Use &quot;saltedpasswords&quot; and &quot;rsaauth&quot; extensions instead!

New version of 'realurl' available. Installed: 1.12.0 Latest: 1.12.1
1.12.1 (2012-02-17 13:23:27)
 Bug fixes. This is a recommended update to everybody.</pre>
<p>Great! Now we even know that kb_md5fepw is deprecated. The extension manager doesn&#8217;t list deprecated extensions in the update panel as it seems. Oh well, let&#8217;s have a look at those local modifications that keep us from updating our extension.</p>
<pre class="brush: bash; title: ; notranslate">$ ./extExtract.php direct_mail
Sourcing script configuration from typo3scripts.conf...Done.
NOTE: New version available!
Retrieving original extension file for 'direct_mail' 2.6.10...Done.
Extracting file 'direct_mail_2.6.10.t3x'...Done.
$ diff --recursive direct_mail_2.6.10.t3x-extracted/ typo3/typo3conf/ext/direct_mail
diff --recursive direct_mail_2.6.10.t3x-extracted//ext_tables.php typo3/typo3conf/ext/direct_mail/ext_tables.php
100c100
&lt;                       )
---
&gt;                       ),
diff --recursive direct_mail_2.6.10.t3x-extracted//mod2/class.tx_directmail_dmail.php typo3/typo3conf/ext/direct_mail/mod2/class.tx_directmail_dmail.php
421c421
&lt;                       if (t3lib_div::testInt($createMailFrom_UID))    {
---
&gt;                       if (t3lib_div::testInt($createMailFrom_UID) &amp;&amp; $createMailFrom_UID &gt; 0) {
diff --recursive direct_mail_2.6.10.t3x-extracted//mod4/class.tx_directmail_statistics.php typo3/typo3conf/ext/direct_mail/mod4/class.tx_directmail_statistics.php
439c439
&lt;                               ' AND type=0'.
---
&gt;                               ' AND (type=0 OR type=1)'.
diff --recursive direct_mail_2.6.10.t3x-extracted//res/scripts/class.tx_directmail_checkjumpurl.php typo3/typo3conf/ext/direct_mail/res/scripts/class.tx_directmail_checkjumpurl.php
132c132
&lt;                                                       $jumpurl = str_replace('###SYS_TABLE_NAME###', $theTable, $jumpurl);
---
&gt;                                                       $jumpurl = str_replace('###SYS_TABLE_NAME###', substr($theTable, 0, 1), $jumpurl);
</pre>
<p>Well, I don&#8217;t know what those changes do (actually, I totally do), but I better make sure I put them back after the update.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2012/02/22/safely-updating-typo3-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrate Progress Indicator in Console Output</title>
		<link>http://dirty-motherfucker.org/blog/2012/01/04/integrate-progress-indicator-in-console-output/</link>
		<comments>http://dirty-motherfucker.org/blog/2012/01/04/integrate-progress-indicator-in-console-output/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 15:38:39 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=355</guid>
		<description><![CDATA[I recently tried to use pv in a bash script so that it wouldn&#8217;t interfere with my concept of communicating overall progress to the user. When I usually like to do is to echo -n a description of the current task and then later echo either &#8220;Done.&#8221; or &#8220;Failed!&#8221; (or something similar). Obviously, that somewhat [...]]]></description>
			<content:encoded><![CDATA[<p>I recently tried to use <code>pv</code> in a bash script so that it wouldn&#8217;t interfere with my concept of communicating overall progress to the user.</p>
<p>When I usually like to do is to <code>echo -n</code> a description of the current task and then later <code>echo</code> either &#8220;Done.&#8221; or &#8220;Failed!&#8221; (or something similar).<br />
Obviously, that somewhat conflicts with <code>pv</code>. So here is the solution:</p>
<pre class="brush: bash; highlight: [11,12]; title: ; notranslate">
# Create backup archive
_statusMessage=&quot;Compressing installation...&quot;
echo -n $_statusMessage
if hash pv 2&gt;&amp;- &amp;&amp; hash gzip 2&gt;&amp;- &amp;&amp; hash du 2&gt;&amp;-; then
  echo
  _folderSize=`du --summarize --bytes $BASE | cut --fields 1`
  if ! tar --create --file - $BASE | pv --progress --rate --bytes --size $_folderSize | gzip --best &gt; $FILE; then
    echo &quot;Failed!&quot;
    exit 1
  fi
  # Clear pv output and position cursor after status message
  tput cuu 2 &amp;&amp; tput cuf ${#_statusMessage} &amp;&amp; tput ed
else
  if ! tar --create --gzip --file $FILE $BASE; then
    echo &quot;Failed!&quot;
    exit 1
  fi
fi

echo &quot;Done.&quot;
</pre>
<p>The snippet also shows how to conditionally use pv if it is available, which I really like.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2012/01/04/integrate-progress-indicator-in-console-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check Write Permissions for Folder Hierachcy</title>
		<link>http://dirty-motherfucker.org/blog/2012/01/02/check-write-permissions-for-folder-hierachcy/</link>
		<comments>http://dirty-motherfucker.org/blog/2012/01/02/check-write-permissions-for-folder-hierachcy/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 15:21:54 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[find]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=344</guid>
		<description><![CDATA[While working on a bash script, I wanted to check if I could rm -rf a folder before actually attempting it and flushing the console with tons of write permission error messages. Upon failing to find what I wanted online, I constructed this beauty: find . \( -exec test -w {} \; -o \( -exec [...]]]></description>
			<content:encoded><![CDATA[<p>While working on a bash script, I wanted to check if I could <code>rm -rf</code> a folder before actually attempting it and flushing the console with tons of write permission error messages.</p>
<p>Upon failing to find what I wanted online, I constructed this beauty:<br />
<code><br />
find . \( -exec test -w {} \; -o \( -exec echo {} \; -quit \) \) | xargs -I {} bash -c "if [ -n "{}" ]; then echo {} is not writeable\!; exit 1; fi"<br />
</code><br />
This will print the name of the item that is not writeable in addition to the non-zero return value needed when used in more complex scripts.</p>
<p>If you don&#8217;t want/need the output, you can go with the simpler version:<br />
<code><br />
find . \( -exec test -w {} \; -o \( -exec echo {} \; -quit \) \) | xargs -I {} test -z "{}"<br />
</code></p>
<p>If there is a more simple solution, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2012/01/02/check-write-permissions-for-folder-hierachcy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Self-updating Bash Script</title>
		<link>http://dirty-motherfucker.org/blog/2011/12/22/self-updating-bash-script/</link>
		<comments>http://dirty-motherfucker.org/blog/2011/12/22/self-updating-bash-script/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 11:59:58 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=338</guid>
		<description><![CDATA[Note: There is a revised version of this script available. While working on the typo3scripts project, I wanted to implement a self-updating feature into each of the scripts as that seemed most convenient for where these scripts would be used. My initial approach was OK but left me wondering. So, here is the revised approach [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Note: There is a <a href="http://dirty-motherfucker.org/blog/2012/02/26/self-updating-bash-script-revised/">revised version of this script</a> available.</strong></p>
<p>While working on the <a href="http://code.google.com/p/typo3scripts/" title="typo3scripts">typo3scripts</a> project, I wanted to implement a self-updating feature into each of the scripts as that seemed most convenient for where these scripts would be used. My <a href="http://stackoverflow.com/questions/8595751/is-this-a-valid-self-update-approach-for-a-bash-script" title="Self-updating bash script at StackOverflow">initial approach</a> was OK but left me wondering.</p>
<p>So, here is the revised approach for a bash script that has the ability to update itself:</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash

set -o nounset
set -o errexit

SELF=$(basename $0)

# The base location from where to retrieve new versions of this script
UPDATE_BASE=http://typo3scripts.googlecode.com/svn/trunk

# Self-update
runSelfUpdate() {
  echo &quot;Performing self-update...&quot;
  
  # Download new version
  echo -n &quot;Downloading latest version...&quot;
  if ! wget --quiet --output-document=&quot;$0.tmp&quot; $UPDATE_BASE/$SELF ; then
    echo &quot;Failed: Error while trying to wget new version!&quot;
    echo &quot;File requested: $UPDATE_BASE/$SELF&quot;
    exit 1
  fi
  echo &quot;Done.&quot;
  
  # Copy over modes from old version
  OCTAL_MODE=$(stat -c '%a' $SELF)
  if ! chmod $OCTAL_MODE &quot;$0.tmp&quot; ; then
    echo &quot;Failed: Error while trying to set mode on $0.tmp.&quot;
    exit 1
  fi
  
  # Spawn update script
  cat &gt; updateScript.sh &lt;&lt; EOF
#!/bin/bash
# Overwrite old file with new
if mv &quot;$0.tmp&quot; &quot;$0&quot;; then
  echo &quot;Done. Update complete.&quot;
  rm \$0
else
  echo &quot;Failed!&quot;
fi
EOF
  
  echo -n &quot;Inserting update process...&quot;
  exec /bin/bash updateScript.sh
}

# Update check
SUM_LATEST=$(curl $UPDATE_BASE/versions 2&gt;&amp;1 | grep $SELF | awk '{print $1}')
SUM_SELF=$(md5sum $0 | awk '{print $1}')
if [[ &quot;$SUM_LATEST&quot; != &quot;$SUM_SELF&quot; ]]; then
  echo &quot;NOTE: New version available!&quot;
fi
</pre>
<p>It also includes the update check which wasn&#8217;t discussed over at StackOverflow. In case I revise the approach yet again, you&#8217;ll find the latest version over at the <a href="http://code.google.com/p/typo3scripts/" title="Typo3Scripts Project Page">typo3scripts project page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2011/12/22/self-updating-bash-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The mystery of the broken OpenVPN certificate</title>
		<link>http://dirty-motherfucker.org/blog/2011/01/07/the-mystery-of-the-broken-openvpn-certificate/</link>
		<comments>http://dirty-motherfucker.org/blog/2011/01/07/the-mystery-of-the-broken-openvpn-certificate/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 14:06:30 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[openvpn]]></category>
		<category><![CDATA[utf8]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://www.dirty-motherfucker.org/blog/?p=326</guid>
		<description><![CDATA[Someone complained to me about the following error message when trying to use OpenVPN to connect to a VPN: All research regarding the matter pointed to a broken certificate. But even after re-exporting it and comparing the contents, we could not find any problem. I had the client repeat several parts of the certificate over [...]]]></description>
			<content:encoded><![CDATA[<p>Someone complained to me about the following error message when trying to use OpenVPN to connect to a VPN:</p>
<pre class="brush: plain; title: ; notranslate">
Cannot load certificate file error:0906D06C:
PEM routines:PEM_read_bio:no start line: error:140AD009:
SSL routines:SSL_CTX_use_certificate_file:PEM lib
</pre>
<p>All research regarding the matter pointed to a broken certificate. But even after re-exporting it and comparing the contents, we could not find any problem. I had the client repeat several parts of the certificate over the phone to my while comparing them to the one I had on the server. Everything matched exactly.</p>
<p>So I had the client send me the certificate and after a while I found the problem. The certificate the client had was saved as UTF8. If it was the BOM or the encoding of some characters, I have no idea. But after saving it as ANSI/ASCII the problem went away and the client was able to connect.</p>
<p>tl;dr: UTF8 is bad for OpenVPN certificates.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2011/01/07/the-mystery-of-the-broken-openvpn-certificate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Increased Screen-Space for Ubuntu Server VM</title>
		<link>http://dirty-motherfucker.org/blog/2010/10/13/increased-screen-space-for-ubuntu-server-vm/</link>
		<comments>http://dirty-motherfucker.org/blog/2010/10/13/increased-screen-space-for-ubuntu-server-vm/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 09:49:37 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.dirty-motherfucker.org/blog/?p=320</guid>
		<description><![CDATA[I often run Ubuntu server installations in VirtualBox. Sadly, this only provides you with the default console window. So most of the time I would additionally connect with Putty into the same VM, so that I can make use of a larger console. But recently it pissed me off so badly that I went hunting [...]]]></description>
			<content:encoded><![CDATA[<p>I often run Ubuntu server installations in VirtualBox. Sadly, this only provides you with the default console window. So most of the time I would additionally connect with Putty into the same VM, so that I can make use of a larger console. But recently it pissed me off so badly that I went hunting for a solution. And I found it in <a href="http://joeamined.wordpress.com/2008/02/25/enabling-high-resolution-console-in-ubuntu/">this article</a>. It&#8217;s not quite up speed with the current environment, so I&#8217;ll duplicate the information here and update it as well.</p>
<p>So first thing we want to do is remove the vesa framebuffer module from the modprobe blacklist.</p>
<pre class="brush: plain; title: ; notranslate">sudo editor /etc/modprobe.d/blacklist-framebuffer</pre>
<p>Comment out or delete the following line:</p>
<pre class="brush: plain; title: ; notranslate">blacklist vesafb</pre>
<p>Now to enable the needed modules:</p>
<pre class="brush: plain; title: ; notranslate">sudo editor /etc/initramfs-tools/modules</pre>
<p>And add the following lines at the end:</p>
<pre class="brush: plain; title: ; notranslate">fbcon
vesafb</pre>
<p>Finally, update your initramfs images:</p>
<pre class="brush: plain; title: ; notranslate">sudo update-initramfs -u</pre>
<p>Now, we need to make Grub pass the required parameters to the kernel to enable the high-res console.<br />
In case of Ubuntu 8.04 (and 8.10 I guess) or any pre-Grub2 version:</p>
<pre class="brush: plain; title: ; notranslate">sudo editor /boot/grub/menu.lst</pre>
<p>For Grub2 installations:</p>
<pre class="brush: plain; title: ; notranslate">sudo editor /etc/default/grub</pre>
<p>There will be a line like this:</p>
<pre class="brush: plain; title: ; notranslate">GRUB_CMDLINE_LINUX_DEFAULT=&quot;quiet splash&quot;</pre>
<p>You&#8217;re gonna want to add the vga parameter to that:</p>
<pre class="brush: plain; title: ; notranslate">GRUB_CMDLINE_LINUX_DEFAULT=&quot;quiet splash vga=791&quot;</pre>
<p>Or as the original article suggests (and what I prefer as well):</p>
<pre class="brush: plain; title: ; notranslate">GRUB_CMDLINE_LINUX_DEFAULT=&quot;verbose vga=791&quot;</pre>
<p>But that only changes the amount of information you get during boot time.<br />
The number that is passed as an argument with vga signals the desired resolution and color depth. 791 is 1024&#215;768 with 64K colors. A full list can be found <a href="http://www.mjmwired.net/kernel/Documentation/fb/vesafb.txt">here</a>.<br />
Now, for Grub2 installations you&#8217;ll want to update Grub:</p>
<pre class="brush: plain; title: ; notranslate">sudo update-grub2</pre>
<p>And then, reboot!</p>
<pre class="brush: plain; title: ; notranslate">sudo reboot now</pre>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2010/10/13/increased-screen-space-for-ubuntu-server-vm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ICH9R Raid Recovery</title>
		<link>http://dirty-motherfucker.org/blog/2010/08/17/ich9r-raid-recovery/</link>
		<comments>http://dirty-motherfucker.org/blog/2010/08/17/ich9r-raid-recovery/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 18:19:53 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[ich9r]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.dirty-motherfucker.org/blog/?p=313</guid>
		<description><![CDATA[You know how everyone would tell you to not use RAID0 unless the data you store on it is worthless? And do you know how the same people would most likely tell you to never put your operating system on a RAID0 volume? Well, I ignored those people and did it anyway. And what did [...]]]></description>
			<content:encoded><![CDATA[<p>You know how everyone would tell you to not use RAID0 unless the data you store on it is worthless? And do you know how the same people would most likely tell you to never put your operating system on a RAID0 volume?</p>
<p>Well, I ignored those people and did it anyway. And what did I, shortly after, get in return? A failed RAID volume. Yay.</p>
<p>One day I simply shut off my computer for a little restructuring of my work area, and after I turned it on again, it told me it can&#8217;t boot, cause, well, yeah. In fact, it reported that one of the RAID disks was no longer a member of the array. So I rebooted multiple times, shut off the computer and power supply, booted back up. The volume remained failed.</p>
<p>So I booted into an Ubuntu Live CD and browsed the web for solutions. Cause I was certain no data could have actually been lost. The RAID controller was just stupid. The solutions I found were mostly along the lines of &#8220;re-create the volume and restore a backup&#8221;. Of course I had no backup.<br />
So I thought I would just back up the drives contents now and try to simply re-create the volume and write the data back.</p>
<p>Using dd, I did exactly that:</p>
<pre class="brush: plain; title: ; notranslate">
dd if=/dev/sda of=/media/backup/sda.dd bs=2MB
dd if=/dev/sdb of=/media/backup/sdb.dd bs=2MB
</pre>
<p>This took the whole night of course. So, the next day I rebooted to re-create the RAID volume. But I was very surprised to find that the RAID controller reported the volume to be in perfect health. And surely enough, seconds later my Windows was up and running again.<br />
I praised the gods, instantly made backups and went on with my life.</p>
<p>Until yesterday. When the same shit happened AGAIN. I was minding my own business, when suddenly my computer shut off (due to overheating I assume). When I started it back up again, it, again, reported the RAID volume as failed.<br />
Again, multiple reboots didn&#8217;t do anything. And, again, I went into a Live CD to back up the RAID member disks.<br />
And, AGAIN, today my volume comes up as healthy as ever.</p>
<p>I have no clue if there is any logic behind this or if this was just magic happening. I also have no idea if my actions actually had anything to do with this RAID recovery. But, sure as hell, when I come across a failed ICH9R RAID0 volume again, I&#8217;ll dd the disks and reboot the shit out of it.</p>
<p>And, also, I&#8217;ll be converting back to a non-RAID setup ASAP.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2010/08/17/ich9r-raid-recovery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

