Using the "ark" resource to do simple install steps with an archive file


#1

I see a lot of people reinventing the install process for tarballs,
zipfiles, wars, etc, myself included

I have adapted infochimps’ excellent install_from_release LWRP for
downloading archives (‘arks’) from a given url, unpacking them to a given
directory, and making them available to the rest of the system.

install Apache Ivy dependency resolution tool

ark “ivy” do
release_url 'http://someurl.example.com/ivy.tar.gz
version '2.2.0’
end

This example copies ivy.tar.gz to /usr/local/src/ivy-2.2.0.tar.gz, unpacks
its contents to /usr/local/share/ivy-2.2.0/ – stripping the leading
directory, and symlinks /usr/local/share/ivy to /usr/local/shary/ivy-2.2.0

ark ‘jdk’ do
release_url 'http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-x64.tar.gz
version '7.2’
home_dir "/usr/local/jvm/default"
add_global_bin_dir true
user 'foobar’
end

This example copies jdk-7u2-linux-x64.tar.gz to
/usr/local/src/jdk-7.2.tar.gz, unpacks its contents to
/usr/local/share/jdk-7.2/ – stripping the leading directory, symlinks
/usr/local/jvm/default to /usr/local/share/jkd-7.2, and adds
/usr/local/share/jdk-7.2/bin/ to the global PATH for all users. The user
’foobar’ is the owner of the /usr/local/share/jdk-7.2 directory

ark ‘liferay-client’ do
release_url "http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.1.0%20GA1/liferay-portal-client-6.1.0-ce-ga1-20120106155615760.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flportal%2Ffiles%2FLiferay%20Portal%2F6.1.0%20GA1%2F&ts=1329490764&use_mirror=ignum"
version "6.1.0"
install_dir "/usr/local/share/tomcat/lib"
home_dir "/usr/local/share/tomcat/lib"
user "hitman"
stop_file "portal-client.jar"
end

This example uses a stop_file to signal that the ark does not need to be
unpacked if “/usr/local/share/tomcat/lib/portal-client.jar” file exists.

The vast majority of the code was written by Flip Kromer and he deserves
the credit. I changed the name in my fork because “install_from_release” is
just too long for my minimalist tastes


and the original here:

Infochimps install_from can also handle the install and configuration of
arks with make, ant, and setup.py however I have not tested those aspects
yet.

BryanWB