Rockbox Technical Forums

Rockbox Development => Starting Development and Compiling => Topic started by: siwy on February 12, 2008, 11:57:43 AM

Title: Automatic RB build from SVN. Script in BASH
Post by: siwy on February 12, 2008, 11:57:43 AM
I have written a small script in BASH (requires sed but everyone has it) which builds rockbox automaticly from subversion.

Some instructions:
copy the text below (beginning from #!/bin/bash), paste it into notepad and (as root) save as /usr/bin/rb. make it executable by 'chmod +x /usr/bin/rb'

you also have to change some things. first of all edit MOUNT_DIR, SVN_DIR and BUILD_DIR. second of all run 'svn up rockbox' manually, look at the last line and notice how many non-numeric characters there are (counting from the end to the beginning) . eg. my last line looks like follows: "W wersji 16290." So there is only 1 non-numeric character from the end which is "." Understood? Now, you have to change value -6 in this line: "SVN=${SVN: -6: 5}" If you have 0 non-numeric charcter it has to be -5, if you have 1 (like me) it has to be -6,  if you have 2 it has to be -7 and so on. That's all. Enjoy.


It works only if you have all the development enviroment set. I mean you have RB source code, build folder and cross-compilers.

This code is published under wtfpl-2 license.

#!/bin/bash

#It works only if you have been set development enviroment up earlier

#Configuration of the enviroment
MOUNT_DIR="/media/IAUDIO"
SVN_DIR="/home/mati/rockbox"
BUILD_DIR="/home/mati/rockbox/build"

#Checks if there is any RockBox on the player
if [ ! -e $MOUNT_DIR/.rockbox/rockbox-info.txt ]
   then
      echo "Please mount your DAP on $MOUNT_DIR."
      exit 1
fi

#Checks version of RockBox in SVN
cd $SVN_DIR
SVN=$( svn up  | sed -n '$p' )
SVN=${SVN: -6: 5}   #These parameters depend on language of Subversion
                  #you are using

FILE=$( grep 'Version: r' $MOUNT_DIR/.rockbox/rockbox-info.txt )
FILE=${FILE: 10: 5}   #These parameters depend on language of Subversion
                     #you are using

if [ "$SVN" = "$FILE" ]
   then
      echo 'Your Rockbox is up-to-date.'
      exit 0
   else
      cd $BUILD_DIR
      echo -e "31\nN\n" | ../tools/configure #Set type of your DAP here
      make -j 3 #Set it properly to boost performance
      make tar
      tar xvf ./rockbox.tar -C $MOUNT_DIR
      echo -e "\nSuccessfully updated from $FILE to $SVN."
      exit 0
fi

echo 'Unknown error!'
exit 1
Title: Re: Automatic RB build from SVN. Script in BASH
Post by: GodEater on February 12, 2008, 01:09:23 PM
Thanks for making this - I'm sure a lot of novice builders will appreciate it.

However - it doesn't belong in the forums - please move it into the wiki where it will be findable forever :)
Title: Re: Automatic RB build from SVN. Script in BASH
Post by: siwy on February 12, 2008, 01:35:51 PM
I'm glad to hear it. please report if it works or doesn't.
Title: Re: Automatic RB build from SVN. Script in BASH
Post by: NicolasP on February 12, 2008, 06:18:52 PM
Quite a nice script, yes. Maybe this could even go in the tools/ directory in SVN!
Title: Re: Automatic RB build from SVN. Script in BASH
Post by: siwy on March 14, 2008, 09:05:00 AM
UPDATE
finally the script above is correct and works properly, makes no problems and is more verbose.
You don't need to test it, just use it!
Title: Re: Automatic RB build from SVN. Script in BASH
Post by: Chronon on March 20, 2008, 04:25:22 AM
I think a sensible place would be in the SimpleGuideToCompiling (http://www.rockbox.org/twiki/bin/view/Main/SimpleGuideToCompiling) wiki page in the "Compiling the Source Code" section.