2 # hdw-linux Puzzle script
6 # script to create the PKGS file which keeps the packages to get
7 # downloaded and some meta information.
10 # see what Config file says
13 categories=`cat ./targets/$hdw_target/include | grep '^# \[C\]' | \
15 singlepackages=`cat ./targets/$hdw_target/include | grep '^# \[P\]' | \
18 # add arch specific repository
19 categories="$categories $hdw_arch"
21 # packages to get removed
22 delpackages=`cat ./targets/$hdw_target/include | grep '^# \[R\]' | \
25 # check for dietlibc/glibc
26 if [ "$hdw_use_dietlibc" = "1" ]; then
27 [ -z "`echo $categories | grep diet`" ] && \
28 singlepackages="$singlepackages diet/dietlibc"
29 delpackages="$delpackages base/glibc"
32 # remove all PKGS files
33 rm -rf ./download/*/PKGS
35 # add all categorie packages
36 for dir in $categories; do
38 if [ -d ./packages/$dir ] ; then
39 echo "Creating PKGS file for $dir ..."
40 mkdir -p ./download/$dir
41 rm -rf ./download/$dir/PKGS
43 # parsing the config files now
44 ((counter1 = 0)) ; echo "Parsing and creating PKGS file ..."
45 for object in `ls -A --ignore="CVS" ./packages/$dir`; do
46 if [ "`echo $delpackages | grep $dir/$object`" = "" ]; then
49 cat ./packages/$dir/$object/$object | grep '#\ \[D\]' | \
50 awk '/^# \[D\]/ { gsub("^# \\[D\\] *", "");
51 print ENVIRON["pkg"] " " $0 ; }' \
52 >> ./download/$dir/PKGS
58 # parsing config files for patches.
59 ((counter2 = 0)) ; echo "Parsing and adding patches to PKGS file ..."
60 for object in `ls -A --ignore="CVS" ./packages/$dir`; do
61 if [ "`echo $delpackages | grep $dir/$object`" = "" ]; then
64 cat ./packages/$dir/$object/$object | grep '#\ \[P\]' | \
65 awk '/^# \[P\]/ { gsub("^# \\[P\\] *", "");
66 print ENVIRON["pkg"] " " $0 ; }' \
67 >> ./download/$dir/PKGS
73 echo "$counter1 packages for $dir found."
77 echo "Error: didnt find the packages config files in ./packages/$dir"
83 echo "adding single packages from diffrent repositoriees to PKGS files ..."
86 for object in $singlepackages; do
87 dir=`echo $object | awk -F/ '{ print $1 }'`
88 object=`basename $object`
89 if [ -f ./packages/$dir/$object/$object ] ; then
90 [ ! -d ./download/$dir ] && mkdir -p ./download/$dir
91 echo "adding $object package from $dir"
93 cat ./packages/$dir/$object/$object | grep '#\ \[D\]' | \
94 awk '/^# \[D\]/ { gsub("^# \\[D\\] *", "");
95 print ENVIRON["pkg"] " " $0 ; }' \
96 >> ./download/$dir/PKGS
98 # also add the patches!
99 cat ./packages/$dir/$object/$object | grep '#\ \[P\]' | \
100 awk '/^# \[P\]/ { gsub("^# \\[P\\] *", "");
101 print ENVIRON["pkg"] " " $0 ; }' \
102 >> ./download/$dir/PKGS
108 echo "added $counter1 single packages"