Has anyone made anything (even just a script) to automatically download, untar, and make projects off of SourceForge in Linux? How could I do that?
I am using Ubuntu 12.10, specifically.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
The standard workflow for installing from source is to download the package, decompress it run the included
configure script, compile and install. So, for those cases where the package you want to install follows the standard method, you can do this:
#!/usr/bin/env bash ## Make a new empty directory ($$ is the script's PID) echo "Creating directory $$" mkdir $$ cd $$ ## get the file name tar=$(basename "$1" | grep -Po "[^?]*(?=[?$])") ## Download the file wget $1 --output-document $tar ## Check if it is a gzipped or bzipped tar file=$(find . -type f); istgz=$(echo $file | grep "tar\.gz\|tgz") istbz=$(echo $file | grep "tar\.bz\|tbz") ok=1 ## Extract the archive if [ $istbz ]; then tar xjf $file; ok=$? ## $? is the last command's exit status elif [ $istgz ]; then tar xzf $file ok=$? ## If things did not go OK, complain else echo "Something went wrong, perhaps the filetype is not recognized" exit 1; fi ## If things went OK, install if [ $ok = 0 ]; then ## Look for a configure script and cd into wherever it is conf=$(find . -name configure -executable) if [ $conf ]; then dir=$(dirname $conf); cd $dir; ## run the configure script, make and install ./configure && make && sudo make install && echo "Succesfully installed, installation directory was $$" else echo "No configure script found, exiting." fi fi
Save this script as, for example,
sforge.sh, make it executable (
chmod a+x sforge.sh) and run it with the URL of the sourceforge package you want to install. Make sure you use the direct link and remove any references to mirrors. In this example, I am downloading
conky, when I click on the "direct download" link from sourceforge, the URL is
I only want the first part (in bold) or the name of the file will be weird, so I will use:
This script will only work for those packages that follow the normal layout. It needs to be a tarred
gzip file and it expects a
configure script and a Makefile. Many packages will not have these and the script will not work. It should be OK for many if not most cases though.
There are a couple of tools that can help with that: Jordan Sissel's fpm and Bernd Ahlers fpm-cookery. The first being able to conveniently build packages from source code in a very simple manner, the second providing a way to automate this workflow.
I won't go into details, as the projects are very well documented and there are working recipes for different kinds of code.
If I understood your question right, then there is no such generic tool for "auto-build" all projects. Every project has its own specific steps to checking dependencies, downloading source, compiling & installing. If someone can build a certain application manually, he/she could write an auto-build script for that certain app, then share the script to the public for everyone's convenience.
Additionally, you can try to use ArchLinux, its AUR package manager is functioning in a similar way e.g. getting source code tarballs, installing dependencies, compiling, and installing. If one want to create such a package, read the AUR User Guidelines.