add a patch for grub-0.97 from LFS to fix segfaults on x86_64
[openwrt/svn-archive/archive.git] / scripts / feeds.sh
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # Usage : $1 -> source feeds
8 # $2 -> other options
9 #
10 # Note : we do not yet resolve package name conflicts
11 #
12 #
13 FEEDS_DIR=$TOPDIR/feeds
14 PACKAGE_DIR=$TOPDIR/package
15
16 cd $TOPDIR
17 # This directory will be structured this way : feeds/feed-name
18 [ -d $FEEDS_DIR ] || mkdir -p $FEEDS_DIR
19
20
21 # Some functions we might call several times a run
22 delete_symlinks() {
23 find $PACKAGE_DIR -type l | xargs rm -f
24 }
25
26 setup_symlinks() {
27 # We assume that feeds do reproduce the hierarchy : section/package
28 for dir in $(ls $FEEDS_DIR/)
29 do
30 ln -s $FEEDS_DIR/$dir/*/* $PACKAGE_DIR/
31 done
32 }
33
34 checkout_feed() {
35 # We ensure the feed has not already been checkout, if so, just update the source feed
36 if [ -d $FEEDS_DIR/$2 ]; then
37 svn update $FEEDS_DIR/$2
38 echo "Updated to revision $(LANG=C svn info $FEEDS_DIR/$2 | awk '/^Revision:/ { print $2 }' )";
39 # Otherwise, we have to checkout in the
40 else
41 svn co $1 $FEEDS_DIR/$2
42 echo "Checked out revision $(LANG=C svn info $FEEDS_DIR/$2 | awk '/^Revision:/ { print $2 }' )";
43 fi
44 }
45
46 extract_feed_name() {
47 echo "$(echo $1 | awk -F/ '{ print $NF}')"
48 }
49
50 # We can delete symlinks every time we start this script, since modifications have been made anyway
51 delete_symlinks ""
52 # Now let's checkout feeds
53 for feed in $1
54 do
55 name=$(extract_feed_name "$feed")
56 checkout_feed "$feed" "$name"
57 done
58 # Finally setup symlinks
59 setup_symlinks ""