]> hackdaworld.org Git - hdw-linux/hdw-linux.git/blob - scripts/Puzzle
no special confopt - wont build! deleetd from targets
[hdw-linux/hdw-linux.git] / scripts / Puzzle
1 #
2 # hdw-linux Puzzle script
3 #
4 # author:       hackbard
5 #
6 # script to create the PKGS file which keeps the packages to get 
7 # downloaded and some meta information.
8 #
9
10 # see what Config file says
11 . ./Config
12
13 categories=`cat ./targets/$hdw_target/include | grep '^# \[C\]' | \
14                 awk '{ print $3 }'` 
15 singlepackages=`cat ./targets/$hdw_target/include | grep '^# \[P\]' | \
16                 awk '{ print $3 }'`
17
18 # add arch specific repository
19 categories="$categories $hdw_arch"
20
21 # packages to get removed
22 delpackages=`cat ./targets/$hdw_target/include | grep '^# \[R\]' | \
23                 awk '{ print $3 }'`
24
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"
30 fi
31                         
32 # remove all PKGS files
33 rm -rf ./download/*/PKGS
34
35 # add all categorie packages
36 for dir in $categories; do 
37
38 if [ -d ./packages/$dir ] ; then
39         echo "Creating PKGS file for $dir ..."
40         mkdir -p ./download/$dir 
41         rm -rf ./download/$dir/PKGS
42
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
47
48                 export pkg=$object
49                 cat ./packages/$dir/$object/$object | grep '#\ \[D\]' | \
50                 awk '/^# \[D\]/ { gsub("^# \\[D\\] *", "");
51                                         print ENVIRON["pkg"] " " $0 ; }' \
52                 >> ./download/$dir/PKGS
53                 ((counter1 += 1)) 
54                 
55                 fi
56         done
57         
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
62
63                 export pkg=$object
64                 cat ./packages/$dir/$object/$object | grep '#\ \[P\]' | \
65                 awk '/^# \[P\]/ { gsub("^# \\[P\\] *", "");
66                                         print ENVIRON["pkg"] " " $0 ; }' \
67                 >> ./download/$dir/PKGS
68                 ((counter2 += 1))
69         
70                 fi
71         done
72         echo "done."
73         echo "$counter1 packages for $dir found."
74         echo 
75
76 else
77         echo "Error: didnt find the packages config files in ./packages/$dir"
78         echo 
79 fi
80
81 done
82
83 echo "adding single packages from diffrent repositoriees to PKGS files ..."
84 echo
85 (( counter1 = 0 ))
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"
92                 export pkg=$object
93                 cat ./packages/$dir/$object/$object | grep '#\ \[D\]' | \
94                 awk '/^# \[D\]/ { gsub("^# \\[D\\] *", "");
95                                         print ENVIRON["pkg"] " " $0 ; }' \
96                 >> ./download/$dir/PKGS         
97                 (( counter1 += 1 ))
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
103         fi
104 done
105
106 echo
107 echo "done."
108 echo "added $counter1 single packages"
109 echo
110