<?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>Nathan VanHoudnos &#187; shell scripts</title>
	<atom:link href="http://www.stat.cmu.edu/~nmv/category/shell-scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stat.cmu.edu/~nmv</link>
	<description>Statistics and Public Policy Ph.D. Student</description>
	<lastBuildDate>Thu, 07 Feb 2013 20:43:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>Messing with R packages</title>
		<link>http://www.stat.cmu.edu/~nmv/2010/06/17/messing-with-r-packages/</link>
		<comments>http://www.stat.cmu.edu/~nmv/2010/06/17/messing-with-r-packages/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 18:06:30 +0000</pubDate>
		<dc:creator>nmv</dc:creator>
				<category><![CDATA[rstats]]></category>
		<category><![CDATA[shell scripts]]></category>

		<guid isPermaLink="false">http://nathanvan.wordpress.com/?p=50</guid>
		<description><![CDATA[This was really frustrating. I&#8217;m trying to modify a package from Matt Johnson and although I could get the package he sent me to install flawlessly, I couldn&#8217;t un-tar it, make a change, re-tar it, and then R CMD INSTALL &#8230; <a href="http://www.stat.cmu.edu/~nmv/2010/06/17/messing-with-r-packages/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This was really frustrating. I&#8217;m trying to modify a package from <a href="http://www.tc.edu/faculty/index.htm?facid=msj2119">Matt Johnson</a> and although I could get the package he sent me to install flawlessly, I couldn&#8217;t un-tar it, make a change, re-tar it, and then R CMD INSTALL it. I was about to pull out my hair. The error I got was:<br />
<code>ERROR: cannot extract package from ‘hrm-rev9.tar.gz’</code></p>
<p>The secret: you have to have the <strong>name</strong> correct.<br />
<code>R CMD INSTALL hrm-rev9.tar.gz</code><br />
barfs. But<br />
<code>R CMD INSTALL hrm_0.1-9.tar.gz</code><br />
works fine. I&#8217;m sure it&#8217;s somewhere in the docs. I just couldn&#8217;t find it. </p>
<p>As always, I made a script to do it for me: (Updated 6/17/2010 15:41)<br />
<code><br />
#!/bin/bash<br />
# Quick script to tar &amp; gzip the package, remove the old one, and install the new one<br />
# I'll add options automatically tag and release it later. </p>
<p>#Set the library that I'm using<br />
LIB="/home/vanhoudn/R/i486-pc-linux-gnu-library/2.10/"</p>
<p>#Commit<br />
svn commit -m "Build commit" </p>
<p>#get the revision number from svn<br />
REV=`svn info -R | grep Revision | cut -d: -f 2 | sort -g -r | head -n 1 | sed 's/ //g'`</p>
<p>#Build the filename<br />
FILENAME="hrm_0.1-$REV.tar.gz"</p>
<p># I need to tar up the pkg so I can install it.<br />
# Jump to the parent directory and work from there.<br />
cd ..<br />
# Exclude any hidden files under the directories (svn has a bunch)<br />
# and add the named files<br />
tar czf $FILENAME --exclude '.*' hrm/DESCRIPTION hrm/NAMESPACE hrm/src hrm/R </p>
<p># Remove the old version of the package<br />
R CMD REMOVE -l $LIB hrm</p>
<p># Install the new package<br />
R CMD INSTALL $FILENAME</p>
<p># Clean up<br />
rm $FILENAME</p>
<p># Go back to our previous directory<br />
cd hrm<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stat.cmu.edu/~nmv/2010/06/17/messing-with-r-packages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CMU Web Publishing is Strange</title>
		<link>http://www.stat.cmu.edu/~nmv/2010/06/04/cmu-web-publishing-is-strange/</link>
		<comments>http://www.stat.cmu.edu/~nmv/2010/06/04/cmu-web-publishing-is-strange/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 13:41:36 +0000</pubDate>
		<dc:creator>nmv</dc:creator>
				<category><![CDATA[shell scripts]]></category>

		<guid isPermaLink="false">http://nathanvan.wordpress.com/?p=13</guid>
		<description><![CDATA[The My Andrew web publishing workflow is a little strange. Once you get everything setup, maintenance is a pain. Once you copy the updated files to ~/www, you must visit a webpage to &#8220;publish&#8221; those files. Presumably the script that &#8230; <a href="http://www.stat.cmu.edu/~nmv/2010/06/04/cmu-web-publishing-is-strange/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The <a href="https://www.cmu.edu/myandrew/">My Andrew</a> web publishing workflow is a little strange. Once you get everything <a href="http://www.cmu.edu/computing/doc/web/publish/andrew/pub-steps/index.html">setup</a>, maintenance is a pain.  Once you copy the updated files to ~/www, you must visit a <a href="https://www.andrew.cmu.edu/server/publish.html">webpage</a> to &#8220;publish&#8221; those files. Presumably the script that copies the files from ~/www to somewhere else in the infrastructure does some security checking or something.</p>
<p>Visiting a webform is a pain. Luckily, it is unauthenticated and uses GET so it is simplicity itself to &#8220;publish&#8221; from the command line. A quick script:<br />
<code><br />
#!/bin/sh</code></p>
<p><code>#Change these to where your local copy of www sits and your username<br />
SOURCE=/home/nathanvan/winhome/workspace/www/<br />
USER=nmv</p>
<p>rsync -rv $SOURCE $USER@unix.andrew.cmu.edu:www<br />
#Since I'm triggering an event, I'm not worried about certificate integrity.<br />
wget --no-check-certificate 'https://www.andrew.cmu.edu/cgi-bin/publish?FLAG=0&amp;NAME='$USER</p>
<p></code></p>
<p><code>#Clean up what wget left behind.<br />
rm 'publish@FLAG=0&amp;NAME='$USER<br />
</code></p>
<p>Clearly there are other ways to do this, but this is simple and compatible with my workflow. Since I don&#8217;t do this often, I&#8217;m okay with typing my password. I could use ssh-agent and such, but I haven&#8217;t got that setup on this machine yet and doubtfully ever will.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stat.cmu.edu/~nmv/2010/06/04/cmu-web-publishing-is-strange/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>