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