fai fixes
[hdw-linux/hdw-linux.git] / scripts / Helper
1 #!/bin/sh
2 #
3 # hdw - linux ./scripts/Helper script
4 #
5 # author: hackbard@hackdaworld.dyndns.org
6 #
7
8 # reading Config file
9 . ./Config
10 . ./scripts/subroutines
11
12 # soon there will be some usefull options available:
13 # - create new priorities according to dependencies
14
15 ccl=0
16 cdf=0
17 rtd=0
18 bd=0
19
20 while [ "$1" ] ; do
21         case "$1" in
22                 -create_cvs_list)       ccl=1;  shift 1 ;;
23                 -create_dist_files)     cdf=1;  shift 1 ;;
24                 -create_runtimedeps)    rtd=1;  shift 1 ;;
25                 -create_build_deps)     bd=1;   shift 1 ;;
26                 *)
27                         echo
28                         echo "usage:"
29                         echo
30                         echo "$0 -create_cvs_list"
31                         echo "$0 -create_dist_files"
32                         echo "$0 -create_runtimedeps"
33                         echo "$0 -create_build_deps"
34                         echo
35                         exit 1 ;;
36         esac
37 done
38
39 if [ "$rtd" = "1" ] ; then
40         echo "# hdw packages + run time dependencies"
41         echo "#"
42         echo "# created `date`"
43         echo
44         for i in /var/adm/deps/run/*; do
45                 echo -en $i | sed 's$/var/adm/deps/run/$$'
46                 echo -en " - "
47                 for j in `cat $i`; do
48                         echo -en "$j "
49                 done
50                 echo -en "\n"
51         done
52 fi
53
54 if [ "$ccl" = "1" ] ; then
55         for i in download/*/PKGS; do
56                 grep 'cvs:' $i | \
57                         while read pkg package foo; do
58                                 cat=`echo $i | awk -F/ '{ print $2 }'`
59                                 echo "download/$cat/$pkg/$package"
60                         done
61         done
62 fi
63
64 if [ "$cdf" = "1" ] ; then
65         max=`grep '^max=' ./scripts/Build-Distro | awk -F= '{ print $2 }'`
66         mkdir -p ./distro
67         . ./Config
68         echo -en "creating dist file ./distro/$hdw_target ..."
69         . ./scripts/subroutines
70         echo "00-dirtree" > ./distro/$hdw_target
71         create_buildorder '2 3 4' $max > ./distro/$hdw_target.~
72         grep -v '^#' ./distro/$hdw_target.~ | awk '{ print $4 }' >> \
73                 ./distro/$hdw_target
74         rm ./distro/$hdw_target.~
75         echo -en " done\n"
76 fi
77