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