source: BLFS/gen_pkg_book.sh@ 0208570

experimental
Last change on this file since 0208570 was 0208570, checked in by George Boudreau <georgeb@…>, 18 years ago

Added gen_pkg_book.sh, the final driver for BLFS packages. A config file parser, regenerate deps files, create package book and all scripts.

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