[bc4a8dc] | 1 | #!/bin/bash
|
---|
| 2 | #
|
---|
| 3 | # $Id:$
|
---|
| 4 | #
|
---|
| 5 |
|
---|
| 6 | export outFile=aConfig.in # file for reading and writing to.
|
---|
[ee8dc26] | 7 | export inFile=packages # file for reading and writing to.
|
---|
[bc4a8dc] | 8 |
|
---|
| 9 | declare TRACKING_DIR=/var/lib/jhalfs/BLFS
|
---|
| 10 |
|
---|
| 11 | declare PKG_NAME
|
---|
| 12 | declare PKG_XML_FILE
|
---|
| 13 | declare PKG_DIR
|
---|
| 14 | declare SAVE_IFS=${IFS}
|
---|
| 15 | declare -a DIR_TREE
|
---|
| 16 | declare PREV_DIR1="none"
|
---|
| 17 | declare PREV_DIR2="none"
|
---|
| 18 | declare MENU_SET1="n"
|
---|
| 19 | declare MENU_SET2="n"
|
---|
| 20 |
|
---|
| 21 | declare PKG_VER
|
---|
| 22 |
|
---|
| 23 | get_pkg_ver() {
|
---|
| 24 | local this_script=$1
|
---|
[ee8dc26] | 25 |
|
---|
[bc4a8dc] | 26 | PKG_VER=$(xmllint --noent ./blfs-xml/book/bookinfo.xml 2>/dev/null | \
|
---|
| 27 | grep -i " ${this_script#*-?-}-version " | cut -d "\"" -f2 )
|
---|
| 28 |
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | > $outFile
|
---|
| 32 |
|
---|
| 33 | #---------------------#
|
---|
| 34 | # MAIN #
|
---|
| 35 | #---------------------#
|
---|
| 36 | : <<enddoc
|
---|
| 37 | This script will create a Config.in file from the contents
|
---|
| 38 | of the file <packages>.
|
---|
| 39 | Packages previously installed will not be included.
|
---|
| 40 | enddoc
|
---|
| 41 |
|
---|
[8eb9b2d] | 42 | echo -en "\tGenerating Config.in from package data ..."
|
---|
[bc4a8dc] | 43 | while [ 0 ]
|
---|
| 44 | do
|
---|
| 45 |
|
---|
| 46 | # read -r || break 1
|
---|
| 47 | read || break 1
|
---|
| 48 | if [[ "${REPLY}" = "" ]] || \
|
---|
| 49 | [[ "${REPLY:0:1}" = "=" ]] || \
|
---|
| 50 | [[ "${REPLY:0:1}" = "#" ]]; then
|
---|
| 51 | continue
|
---|
| 52 | fi
|
---|
[ee8dc26] | 53 |
|
---|
[bc4a8dc] | 54 | set -- $REPLY
|
---|
[ee8dc26] | 55 | PKG_NAME=$1
|
---|
[bc4a8dc] | 56 | PKG_XML_FILE=$(basename $2)
|
---|
| 57 | PKG_DIR=$(dirname $2)
|
---|
[711f160] | 58 | # These are the META packages. for gnome and kde (soon ALSA and Xorg7)
|
---|
[bc4a8dc] | 59 | if [ $PKG_DIR = "." ]; then
|
---|
[711f160] | 60 | SET_COMMENT=y
|
---|
[8b7df52] | 61 | # Do not include previously installed packages....
|
---|
[bc4a8dc] | 62 | if [ -e $TRACKING_DIR/${PKG_NAME} ]; then continue; fi
|
---|
[69d25ea] | 63 |
|
---|
[711f160] | 64 | META_PKG=$(echo ${PKG_NAME} | tr [a-z] [A-Z])
|
---|
[8b7df52] | 65 | echo -e "config CONFIG_$META_PKG" >> $outFile
|
---|
| 66 | echo -e "\tbool \"$META_PKG\"" >> $outFile
|
---|
| 67 | echo -e "\tdefault n" >> $outFile
|
---|
| 68 |
|
---|
| 69 | echo -e "menu \"$(echo ${PKG_NAME} | tr [a-z] [A-Z]) components\"" >> $outFile
|
---|
[491e09b] | 70 | echo -e "\tdepends\tCONFIG_$META_PKG" >> $outFile
|
---|
[711f160] | 71 | # Include the dependency data for this meta package
|
---|
| 72 | while [ 0 ]; do
|
---|
| 73 | read || break 1
|
---|
| 74 | PKG_NAME=${REPLY}
|
---|
| 75 | get_pkg_ver "${PKG_NAME}"
|
---|
| 76 | (
|
---|
| 77 | cat << EOF
|
---|
| 78 | config DEP_${META_PKG}_${PKG_NAME}
|
---|
| 79 | bool "$PKG_NAME ${PKG_VER}"
|
---|
| 80 | default y
|
---|
| 81 |
|
---|
| 82 | EOF
|
---|
[ee8dc26] | 83 | ) >> $outFile
|
---|
[711f160] | 84 | done <./libs/${PKG_NAME}.dep
|
---|
| 85 | echo -e "endmenu" >> $outFile
|
---|
[bc4a8dc] | 86 | continue
|
---|
| 87 | fi
|
---|
[ee8dc26] | 88 | [[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT
|
---|
| 89 |
|
---|
[bc4a8dc] | 90 | # Deal with a few unusable chapter names
|
---|
| 91 | case ${PKG_NAME} in
|
---|
| 92 | other-* | others-* ) continue
|
---|
| 93 | ;;
|
---|
[ee8dc26] | 94 | xorg7-* ) # Deal with sub-elements of Xorg7, mandatory for build.
|
---|
[bc4a8dc] | 95 | # No need to (even possible?) to build separately
|
---|
| 96 | continue
|
---|
| 97 | ;;
|
---|
[8eb9b2d] | 98 | alsa-* ) continue ;;
|
---|
[bc4a8dc] | 99 | esac
|
---|
| 100 |
|
---|
| 101 | # IF this package name-version exists in the tracking dir
|
---|
| 102 | # do not add this package to the list of installable pkgs.
|
---|
| 103 | get_pkg_ver "${PKG_NAME}"
|
---|
| 104 | if [ -e $TRACKING_DIR/${PKG_NAME}-${PKG_VER} ]; then continue; fi
|
---|
[ee8dc26] | 105 |
|
---|
[bc4a8dc] | 106 | IFS="/"
|
---|
| 107 | DIR_TREE=(${PKG_DIR})
|
---|
| 108 | IFS="$SAVE_IFS"
|
---|
| 109 |
|
---|
[ee8dc26] | 110 | # Define a top level menu
|
---|
[bc4a8dc] | 111 | if [ "$PREV_DIR1" != "${DIR_TREE[1]}" ]; then
|
---|
[711f160] | 112 | [[ "${DIR_TREE[1]}" = "kde" ]] && continue
|
---|
| 113 | [[ "${DIR_TREE[1]}" = "gnome" ]] && continue
|
---|
[ee8dc26] | 114 |
|
---|
| 115 | if [ $MENU_SET1 = "y" ]; then
|
---|
[bc4a8dc] | 116 | # Close out any open secondary menu
|
---|
[ee8dc26] | 117 | if [ $MENU_SET2 = "y" ]; then
|
---|
[bc4a8dc] | 118 | echo -e "\tendmenu" >> $outFile
|
---|
| 119 | # Reset 'menu open' flag
|
---|
| 120 | MENU_SET2="n"
|
---|
| 121 | fi
|
---|
| 122 | # Close the current top level menu
|
---|
| 123 | echo -e "endmenu\n" >> $outFile
|
---|
| 124 | fi
|
---|
| 125 | # Open a new top level menu
|
---|
| 126 | echo -e "menu "$(echo ${DIR_TREE[1]:0:1} | tr [a-z] [A-Z])${DIR_TREE[1]:1}"" >> $outFile
|
---|
[ee8dc26] | 127 | MENU_SET1="y"
|
---|
[bc4a8dc] | 128 | fi
|
---|
| 129 |
|
---|
| 130 | # Define a secondary menu
|
---|
| 131 | if [ "$PREV_DIR2" != "${DIR_TREE[2]}" ]; then
|
---|
| 132 | # Close out the previous open menu structure
|
---|
[ee8dc26] | 133 | if [ $MENU_SET2 = "y" ]; then
|
---|
[bc4a8dc] | 134 | echo -e "\tendmenu\n" >> $outFile
|
---|
| 135 | fi
|
---|
[ee8dc26] | 136 | # Initialize a new 2nd level menu structure.
|
---|
[bc4a8dc] | 137 | echo -e "\tmenu "$(echo ${DIR_TREE[2]:0:1} | tr [a-z] [A-Z])${DIR_TREE[2]:1}"" >> $outFile
|
---|
[ee8dc26] | 138 | MENU_SET2="y"
|
---|
[bc4a8dc] | 139 | fi
|
---|
| 140 | (
|
---|
| 141 | cat << EOF
|
---|
| 142 | config CONFIG_$PKG_NAME
|
---|
| 143 | bool "$PKG_NAME ${PKG_VER}"
|
---|
[ee8dc26] | 144 | default n
|
---|
[bc4a8dc] | 145 | EOF
|
---|
| 146 | ) >> $outFile
|
---|
| 147 |
|
---|
| 148 | PREV_DIR1=${DIR_TREE[1]}
|
---|
| 149 | PREV_DIR2=${DIR_TREE[2]}
|
---|
| 150 | done <"$inFile"
|
---|
| 151 |
|
---|
| 152 | if [ $MENU_SET2 = "y" ]; then echo -e "\tendmenu" >> $outFile; fi
|
---|
| 153 | if [ $MENU_SET1 = "y" ]; then echo "endmenu" >> $outFile; fi
|
---|
| 154 |
|
---|
| 155 | (
|
---|
| 156 | cat << EOF
|
---|
[7d888a4] | 157 |
|
---|
| 158 | comment ""
|
---|
| 159 |
|
---|
| 160 | menu "Default packages for resolving dependencies"
|
---|
[8a8b55a] | 161 |
|
---|
| 162 | choice
|
---|
| 163 | prompt "Default print server"
|
---|
| 164 | config PS_cups
|
---|
| 165 | bool "cups"
|
---|
| 166 | config PS_LPRng
|
---|
| 167 | bool "LPRng"
|
---|
| 168 | endchoice
|
---|
| 169 | config PRINT_SERVER
|
---|
| 170 | string
|
---|
| 171 | default cups if PS_cups
|
---|
[ee8dc26] | 172 | default LPRng if PS_LPRng
|
---|
[8b7df52] | 173 |
|
---|
[8a8b55a] | 174 | choice
|
---|
| 175 | prompt "Mail server"
|
---|
| 176 | config MS_sendmail
|
---|
[69d25ea] | 177 | bool "sendmail"
|
---|
[8a8b55a] | 178 | config MS_postfix
|
---|
| 179 | bool "postfix"
|
---|
| 180 | config MS_exim"
|
---|
| 181 | bool "exim"
|
---|
| 182 | endchoice
|
---|
| 183 | config MAIL_SERVER
|
---|
| 184 | string
|
---|
| 185 | default sendmail if MS_sendmail
|
---|
| 186 | default postfix if MS_postfix
|
---|
| 187 | default exim if MS_exim
|
---|
| 188 |
|
---|
| 189 | choice
|
---|
| 190 | prompt "Postscript package"
|
---|
| 191 | config GS_espgs
|
---|
| 192 | bool "espgs"
|
---|
| 193 | config GS_ghostscript
|
---|
| 194 | bool "ghostscript"
|
---|
| 195 | endchoice
|
---|
| 196 | config GHOSTSCRIPT
|
---|
| 197 | string
|
---|
| 198 | default espgs if GS_espgs
|
---|
| 199 | default ghostscript if GS_ghostscript
|
---|
| 200 |
|
---|
| 201 | choice
|
---|
| 202 | prompt "Kerberos 5"
|
---|
[bcbf830] | 203 | config KER_mitkrb
|
---|
[8a8b55a] | 204 | bool "mitkrb"
|
---|
| 205 | config KER_heimdal
|
---|
[ee8dc26] | 206 | bool "heimdal"
|
---|
[8a8b55a] | 207 | endchoice
|
---|
| 208 | config KBR5
|
---|
| 209 | string
|
---|
| 210 | default heimdal if KER_heimdal
|
---|
| 211 | default mitkrb if KER_mitkrb
|
---|
| 212 |
|
---|
| 213 | choice
|
---|
[45bc8d6] | 214 | prompt "Window package"
|
---|
[8a8b55a] | 215 | config WIN_xorg7
|
---|
| 216 | bool "Xorg7"
|
---|
| 217 | config WIN_xorg
|
---|
| 218 | bool "Xorg"
|
---|
| 219 | config WIN_xfree86
|
---|
| 220 | bool "xfree86"
|
---|
[ee8dc26] | 221 | endchoice
|
---|
[8a8b55a] | 222 | config X11
|
---|
| 223 | string
|
---|
| 224 | default xorg7 if WIN_xorg7
|
---|
| 225 | default xorg if WIN_xorg
|
---|
| 226 | default xfree86 if WIN_xfree86
|
---|
[7d888a4] | 227 | endmenu
|
---|
[8a8b55a] | 228 |
|
---|
[ee8dc26] | 229 | choice
|
---|
[8b7df52] | 230 | prompt "Dependency level"
|
---|
[b5effd5] | 231 | default DEPLVL_2
|
---|
[ee8dc26] | 232 |
|
---|
[b5effd5] | 233 | config DEPLVL_1
|
---|
[8a8b55a] | 234 | bool "Required dependencies only"
|
---|
[ee8dc26] | 235 |
|
---|
[b5effd5] | 236 | config DEPLVL_2
|
---|
[8a8b55a] | 237 | bool "Required and recommended dependencies"
|
---|
[ee8dc26] | 238 |
|
---|
[b5effd5] | 239 | config DEPLVL_3
|
---|
[8a8b55a] | 240 | bool "Required, recommended and optional dependencies"
|
---|
[ee8dc26] | 241 |
|
---|
[8a8b55a] | 242 | endchoice
|
---|
| 243 | config optDependency
|
---|
| 244 | int
|
---|
[b5effd5] | 245 | default 1 if DEPLVL_1
|
---|
| 246 | default 2 if DEPLVL_2
|
---|
| 247 | default 3 if DEPLVL_3
|
---|
[ee8dc26] | 248 |
|
---|
| 249 |
|
---|
[8a8b55a] | 250 | config SUDO
|
---|
[bc4a8dc] | 251 | bool "Build as User"
|
---|
| 252 | default y
|
---|
| 253 | help
|
---|
| 254 | Select if sudo will be used (you want build as a normal user)
|
---|
| 255 | otherwise sudo is not needed (you want build as root)
|
---|
| 256 |
|
---|
| 257 | EOF
|
---|
| 258 | ) >> $outFile
|
---|
[8eb9b2d] | 259 | echo "done"
|
---|
[bc4a8dc] | 260 |
|
---|
| 261 |
|
---|