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