Sunday, November 14, 2010

How to reduce the dependency hell in Linux

This is my first post after 2 months !! anyway today i am going to give a special tip for Linux users. if you are a linux user you must have faced with dependency hell. recently i stumble upon to this project on github so, here i will explain how to use that awesome project to reduce the dependency hell in other words you can run a program which run perfectly on your machine in another machine without think about any dependencies or setting up the environment.

click here and download this file from github, if the link doesn't work or if you prefer to download the source code and build yourself follow this instructions

git clone git://github.com/pgbovine/CDE.git
cd CDE
make

if you have downloaded the compiled code follow these instructions

mv cde_2010-11-13_32bit cde
chmod g+x cde

NOTE : cde_2010-11-13_32bit should be replaced with your downloaded filename.

done. now what?
ok let's use this great little program. assuming that the cde file is in your present working directory you can type this in the terminal.

echo "hello" >> test.txt
./cde vim test.txt

here i created a text file and write hello in it and used vim to open the text file you can use any program not only vim (e.g cat, gedit, vi). you will see no difference it opens the vim editor with hello in it. but if you just happen to type a ls you will see a directory which you didn't create ! in that directory it holds all the dependencies need to run the program.


now you can zip that cde-package directory and unzip in any machine which has the same operating system and open your text file with vim. so let's say the second machine doesn't have vim but still you can run vim text.txt !!! using cde you can run not only vim but any program you just need to run the program with cde

./cde program_name

in order to run the program in the second machine you have to follow these instructions

cd cde-root
ls


what can you see ?

it is almost like your root folder ! now go to the directory where you had that text file in my case i had it in /home/keshan/Downloads/Test/ in my original machine so, in your second machine go to the same directory(when you type home omit /) and now type ./vim.cde test.txt

cd home/keshan/Downloads/Test
./vim.cde test.txt

try this out with any program....

cheers !
-Kesh,