1 | #!/bin/bash
|
---|
2 | #
|
---|
3 | # $Id$
|
---|
4 | #
|
---|
5 | # Read and parse the configuration parameters..
|
---|
6 | #
|
---|
7 | ConfigFile="configuration"
|
---|
8 | while [ 0 ]; do
|
---|
9 | read || break 1
|
---|
10 |
|
---|
11 | # Garbage collection
|
---|
12 | case ${REPLY} in
|
---|
13 | \#* | '') continue ;;
|
---|
14 | esac
|
---|
15 |
|
---|
16 | case "${REPLY}" in
|
---|
17 | CONFIG_ALSA=* | \
|
---|
18 | CONFIG_GNOME-CORE=* | \
|
---|
19 | CONFIG_GNOME-FULL=* | \
|
---|
20 | CONFIG_KDE-CORE=* | \
|
---|
21 | CONFIG_KDE-FULL=* | \
|
---|
22 | CONFIG_KDE-KOFFICE=* | \
|
---|
23 | CONFIG_XORG7=* ) REPLY=${REPLY%=*} # Strip the trailing '=y' test.. unecessary
|
---|
24 | echo -n "${REPLY}"
|
---|
25 | if [[ $((++cntr)) > 1 ]]; then
|
---|
26 | echo " <<-- ERROR:: SELECT ONLY 1 PACKAGE AT A TIME, META-PACKAGE NOT SELECTED"
|
---|
27 | else
|
---|
28 | echo ""
|
---|
29 | optTARGET=$(echo $REPLY | cut -d "_" -f2 | tr [A-Z] [a-z])
|
---|
30 | fi
|
---|
31 | continue ;;
|
---|
32 |
|
---|
33 | # Create global variables for these parameters.
|
---|
34 | optDependency=* | \
|
---|
35 | PRINT_SERVER=* | \
|
---|
36 | MAIL_SERVER=* | \
|
---|
37 | GHOSTSCRIPT=* | \
|
---|
38 | KBR5=* | \
|
---|
39 | X11=* | \
|
---|
40 | SUDO=* ) eval ${REPLY} # Define/set a global variable..
|
---|
41 | continue ;;
|
---|
42 | esac
|
---|
43 |
|
---|
44 | if [[ "${REPLY}" =~ "^CONFIG_" ]]; then
|
---|
45 | echo -n "$REPLY"
|
---|
46 | if [[ $((++cntr)) > 1 ]]; then
|
---|
47 | echo " <<-- ERROR SELECT ONLY 1 PACKAGE AT A TIME, WILL NOT BUILD"
|
---|
48 | else
|
---|
49 | echo ""
|
---|
50 | optTARGET=$( echo $REPLY | sed -e 's@CONFIG_@@' -e 's@=y@@' )
|
---|
51 | fi
|
---|
52 | fi
|
---|
53 | done <$ConfigFile
|
---|
54 | if [[ $optTARGET = "" ]]; then
|
---|
55 | echo -e "\n>>> NO TARGET SELECTED.. applicaton terminated"
|
---|
56 | echo -e " Run <make> again and select a package to build\n"
|
---|
57 | exit 0
|
---|
58 | fi
|
---|
59 |
|
---|
60 | #
|
---|
61 | # Regenerate the META-package dependencies from the configuration file
|
---|
62 | #
|
---|
63 | rm -f libs/*.dep-MOD
|
---|
64 | while [ 0 ]; do
|
---|
65 | read || break 1
|
---|
66 | case ${REPLY} in
|
---|
67 | \#* | '') continue ;;
|
---|
68 | esac
|
---|
69 |
|
---|
70 | # Drop the "=y"
|
---|
71 | REPLY=${REPLY%=*}
|
---|
72 | if [[ "${REPLY}" =~ "^DEP_" ]]; then
|
---|
73 | META_PACKAGE=$(echo $REPLY | cut -d "_" -f2 | tr [A-Z] [a-z])
|
---|
74 | DEP_FNAME=$(echo $REPLY | cut -d "_" -f3)
|
---|
75 | echo "${DEP_FNAME}" >>libs/${META_PACKAGE}.dep-MOD
|
---|
76 | fi
|
---|
77 |
|
---|
78 | done <$ConfigFile
|
---|
79 | #
|
---|
80 | # Replace to 'old' dependency file with a new one.
|
---|
81 | #
|
---|
82 | for dst in `ls ./libs/*.dep-MOD 2>/dev/null`; do
|
---|
83 | cp -vf $dst ${dst%-MOD}
|
---|
84 | done
|
---|
85 |
|
---|
86 |
|
---|
87 | set -e
|
---|
88 | declare TARGET=$optTARGET
|
---|
89 | declare DEP_LEVEL=$optDependency
|
---|
90 | declare PKGXML
|
---|
91 | declare BLFS_XML
|
---|
92 | declare VERBOSITY=1
|
---|
93 | [[ -z $SUDO ]] && SUDO=y
|
---|
94 |
|
---|
95 | #---------------------
|
---|
96 | # Constants
|
---|
97 | source libs/constants.inc
|
---|
98 | [[ $? > 0 ]] && echo -e "\n\tERROR: constants.inc did not load..\n" && exit
|
---|
99 |
|
---|
100 | #---------------------
|
---|
101 | # Dependencies module
|
---|
102 | source libs/func_dependencies
|
---|
103 | [[ $? > 0 ]] && echo -e "\n\tERROR: func_dependencies did not load..\n" && exit
|
---|
104 |
|
---|
105 | #---------------------
|
---|
106 | # parser module
|
---|
107 | source libs/func_parser
|
---|
108 | [[ $? > 0 ]] && echo -e "\n\tERROR: func_parser did not load..\n" && exit
|
---|
109 |
|
---|
110 |
|
---|
111 | #------- MAIN --------
|
---|
112 | if [[ ! -f packages ]] ; then
|
---|
113 | echo -e "\tNo packages file has been found.\n"
|
---|
114 | echo -e "\tExecution aborted.\n"
|
---|
115 | exit 1
|
---|
116 | fi
|
---|
117 |
|
---|
118 | generate_dependency_tree
|
---|
119 | generate_TARGET_xml
|
---|
120 | generate_target_book
|
---|
121 | create_build_scripts "${SUDO}"
|
---|