Ddwrt selective co.sh

From DD-WRT Wiki

Revision as of 07:29, 7 February 2011 by Jmrobles (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Description

The following bash script will checkout from DD-WRT repository everything except kernel source code.

Note: this only works with subversion 1.5 or greater.

Usage

user@linux:~$ sh ddwrt_selective_co.sh dd-wrt


Source code

#!/bin/sh
TARGET=${1}

if [ -z "${TARGET}" ]; then
        echo ${0}: Please specify the target destination
        exit 1
fi

svn co svn://svn.dd-wrt.com/DD-WRT "${TARGET}" --depth immediates --quiet

for tmp1 in $( find "${TARGET}" -type d \( ! -iname  "${TARGET}" \) | grep --invert-match .svn ); do
        echo ${0}: Updating "${tmp1}" ..
        svn up "${tmp1}" --set-depth immediates --quiet

        for tmp2 in $( find "${tmp1}" -type d \( ! -iname $( basename "${tmp1}" ) \) | grep --invert-match .svn ); do
                if [ "${TARGET}/src/linux" != ${tmp2} ]; then
                        echo ${0}: -- Updating "${tmp2}" ..
                        svn up "${tmp2}" --set-depth infinity --quiet
                else
                        echo ${0}: == Updating "${tmp2}" ..
                        svn up "${tmp2}" --set-depth immediates --quiet
                fi
        done
done

Dowload target linux

Enter in src/linux/<target-linux> and run:

svn up --set-depth infinity