reorganized Config file
[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 chr=0
20 root=""
21
22 while [ "$1" ] ; do
23         case "$1" in
24                 -create_cvs_list)       ccl=1;  shift 1 ;;
25                 -create_dist_files)     cdf=1;  shift 1 ;;
26                 -create_runtimedeps)    rtd=1;  shift 1 ;;
27                 -create_build_deps)     bd=1;   shift 1 ;;
28                 -chroot)                chr=1;  shift 1 ;;
29                 *)
30                         echo
31                         echo "usage:"
32                         echo
33                         echo "$0 -create_cvs_list"
34                         echo "$0 -create_dist_files"
35                         echo "$0 -create_runtimedeps"
36                         echo "$0 -create_build_deps"
37                         echo
38                         exit 1 ;;
39         esac
40 done
41
42 [ "$chr" = "1" ] && root=$hdw_build_dir
43
44 if [ "$rtd" = "1" ] ; then
45         echo "# hdw packages + run time dependencies"
46         echo "#"
47         echo "# created `date`"
48         echo
49         echo "00-dirtree -"
50         for i in $root/var/adm/flists/*; do
51                 package=`basename $i | sed 's/-[0-9].*//'`
52                 if [ -n "`echo $package | grep -v stage[0-1]`" ] ; then
53                         file="$root/var/adm/deps/run/$package"
54                         echo -en $package
55                         echo -en " - "
56                         if [ -f $file ] ; then
57                                 for j in `cat $file`; do
58                                         echo -en "$j "
59                                 done
60                         fi
61                         echo -en "\n"
62                 fi
63         done
64 fi
65
66 if [ "$ccl" = "1" ] ; then
67         for i in download/*/PKGS; do
68                 grep 'cvs:' $i | \
69                         while read pkg package foo; do
70                                 cat=`echo $i | awk -F/ '{ print $2 }'`
71                                 echo "download/$cat/$pkg/$package"
72                         done
73         done
74 fi
75
76 if [ "$cdf" = "1" ] ; then
77         max=`grep '^max=' ./scripts/Build-Distro | awk -F= '{ print $2 }'`
78         mkdir -p ./distro
79         . ./Config
80         echo -en "creating dist file ./distro/$hdw_target ..."
81         . ./scripts/subroutines
82         echo "00-dirtree" > ./distro/$hdw_target
83         create_buildorder '2 3' $max > ./distro/$hdw_target.~
84         grep -v '^#' ./distro/$hdw_target.~ | awk '{ print $4 }' >> \
85                 ./distro/$hdw_target
86         rm ./distro/$hdw_target.~
87         echo -en " done\n"
88 fi
89