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