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