[f4ed135] | 1 | #!/bin/bash
|
---|
| 2 | #
|
---|
[155e2b4] | 3 | # $Id$
|
---|
[f4ed135] | 4 | #
|
---|
| 5 |
|
---|
| 6 | export outFile=Config.in # file for reading and writing to.
|
---|
| 7 | export inFile=packages # file for reading and writing to.
|
---|
| 8 |
|
---|
| 9 | declare PKG_NAME
|
---|
| 10 | declare PKG_XML_FILE
|
---|
| 11 | declare PKG_DIR
|
---|
| 12 | declare PKG_VER
|
---|
| 13 | declare INST_VER
|
---|
| 14 | declare INST_STRING
|
---|
| 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 |
|
---|
| 33 | echo -en "\tGenerating Config.in from package data ..."
|
---|
| 34 | while [ 0 ]
|
---|
| 35 | do
|
---|
| 36 |
|
---|
| 37 | # read -r || break 1
|
---|
| 38 | read || break 1
|
---|
| 39 |
|
---|
| 40 | set -- $REPLY
|
---|
| 41 | PKG_NAME=$1
|
---|
| 42 | PKG_XML_FILE=$(basename $2)
|
---|
| 43 | PKG_DIR=$(dirname $2)
|
---|
| 44 | PKG_VER=$3
|
---|
| 45 | INST_VER=$4
|
---|
| 46 | # These are the META packages.
|
---|
| 47 | if [ $PKG_DIR = "." ]; then
|
---|
| 48 | SET_COMMENT=y
|
---|
| 49 | # Do not include previously installed packages
|
---|
| 50 | if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
|
---|
| 51 | continue
|
---|
| 52 | fi
|
---|
| 53 | # Set installed version for updated meta-packages
|
---|
| 54 | [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
|
---|
| 55 |
|
---|
| 56 | META_PKG=$(echo ${PKG_NAME} | tr [a-z] [A-Z])
|
---|
| 57 | (
|
---|
| 58 | cat << EOF
|
---|
| 59 | config CONFIG_$META_PKG
|
---|
| 60 | bool "$META_PKG $PKG_VER $INST_STRING"
|
---|
| 61 | default n
|
---|
| 62 |
|
---|
| 63 | menu "$(echo ${PKG_NAME} | tr [a-z] [A-Z]) components"
|
---|
| 64 | depends CONFIG_$META_PKG
|
---|
| 65 |
|
---|
| 66 | EOF
|
---|
| 67 | ) >> $outFile
|
---|
| 68 |
|
---|
| 69 | unset INST_STRING
|
---|
| 70 |
|
---|
| 71 | # Include the dependency data for this meta package
|
---|
| 72 | while [ 0 ]; do
|
---|
| 73 | read || break 1
|
---|
| 74 | PKG_NAME=${REPLY}
|
---|
| 75 | PKG_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f3)
|
---|
| 76 | INST_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f4)
|
---|
| 77 | # Skip installed meta-package components
|
---|
| 78 | if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
|
---|
| 79 | continue
|
---|
| 80 | fi
|
---|
| 81 | # Set installed version for updated meta-packages components
|
---|
| 82 | [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
|
---|
| 83 | (
|
---|
| 84 | cat << EOF
|
---|
| 85 | config DEP_${META_PKG}_${PKG_NAME}
|
---|
| 86 | bool "$PKG_NAME ${PKG_VER} ${INST_STRING}"
|
---|
| 87 | default y
|
---|
| 88 |
|
---|
| 89 | EOF
|
---|
| 90 | ) >> $outFile
|
---|
| 91 | unset INST_STRING
|
---|
| 92 | done <./libs/${PKG_NAME}.dep
|
---|
| 93 | echo -e "endmenu" >> $outFile
|
---|
| 94 | continue
|
---|
| 95 | fi
|
---|
| 96 | [[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT
|
---|
| 97 |
|
---|
[7889308] | 98 | # Deal with targets that are part of a meta-package but that are in the same
|
---|
[28087b7] | 99 | # directory that non meta-package targets
|
---|
[f4ed135] | 100 | case ${PKG_NAME} in
|
---|
[7889308] | 101 | alsa-* | \
|
---|
| 102 | xorg7-* | \
|
---|
| 103 | x-config | \
|
---|
| 104 | x-setup | \
|
---|
| 105 | libXau | \
|
---|
| 106 | libxcb | \
|
---|
| 107 | libXdmcp | \
|
---|
| 108 | luit | \
|
---|
| 109 | xbitmaps | \
|
---|
| 110 | xcb-proto | \
|
---|
| 111 | xkeyboard-config | \
|
---|
| 112 | mesalib | \
|
---|
| 113 | libdrm ) continue ;;
|
---|
[f4ed135] | 114 | esac
|
---|
| 115 |
|
---|
| 116 | # Skip installed packages
|
---|
| 117 | if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
|
---|
| 118 | continue
|
---|
| 119 | fi
|
---|
| 120 | # Set installed version for updated packages
|
---|
| 121 | [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
|
---|
| 122 |
|
---|
| 123 | IFS="/"
|
---|
| 124 | DIR_TREE=(${PKG_DIR})
|
---|
| 125 | IFS="$SAVE_IFS"
|
---|
| 126 |
|
---|
| 127 | # Define a top level menu
|
---|
| 128 | if [ "$PREV_DIR1" != "${DIR_TREE[1]}" ]; then
|
---|
| 129 | [[ "${DIR_TREE[1]}" = "kde" ]] && continue
|
---|
| 130 | [[ "${DIR_TREE[1]}" = "gnome" ]] && continue
|
---|
| 131 |
|
---|
| 132 | if [ $MENU_SET1 = "y" ]; then
|
---|
| 133 | # Close out any open secondary menu
|
---|
| 134 | if [ $MENU_SET2 = "y" ]; then
|
---|
| 135 | echo -e "\tendmenu" >> $outFile
|
---|
| 136 | # Reset 'menu open' flag
|
---|
| 137 | MENU_SET2="n"
|
---|
| 138 | fi
|
---|
| 139 | # Close the current top level menu
|
---|
| 140 | echo -e "endmenu\n" >> $outFile
|
---|
| 141 | fi
|
---|
| 142 | # Open a new top level menu
|
---|
| 143 | echo -e "menu "$(echo ${DIR_TREE[1]:0:1} | tr [a-z] [A-Z])${DIR_TREE[1]:1}"" >> $outFile
|
---|
| 144 | MENU_SET1="y"
|
---|
| 145 | fi
|
---|
| 146 |
|
---|
| 147 | # Define a secondary menu
|
---|
| 148 | if [ "$PREV_DIR2" != "${DIR_TREE[2]}" ]; then
|
---|
| 149 | # Close out the previous open menu structure
|
---|
| 150 | if [ $MENU_SET2 = "y" ]; then
|
---|
| 151 | echo -e "\tendmenu\n" >> $outFile
|
---|
| 152 | fi
|
---|
| 153 | # Initialize a new 2nd level menu structure.
|
---|
| 154 | echo -e "\tmenu "$(echo ${DIR_TREE[2]:0:1} | tr [a-z] [A-Z])${DIR_TREE[2]:1}"" >> $outFile
|
---|
| 155 | MENU_SET2="y"
|
---|
| 156 | fi
|
---|
| 157 | (
|
---|
| 158 | cat << EOF
|
---|
| 159 | config CONFIG_$PKG_NAME
|
---|
| 160 | bool "$PKG_NAME ${PKG_VER} ${INST_STRING}"
|
---|
| 161 | default n
|
---|
| 162 | EOF
|
---|
| 163 | ) >> $outFile
|
---|
| 164 |
|
---|
| 165 | unset INST_STRING
|
---|
| 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
|
---|
| 176 |
|
---|
| 177 | comment ""
|
---|
| 178 |
|
---|
| 179 | menu "Default packages for resolving dependencies"
|
---|
| 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
|
---|
| 191 | default LPRng if PS_LPRng
|
---|
| 192 |
|
---|
| 193 | choice
|
---|
| 194 | prompt "Mail server"
|
---|
| 195 | config MS_sendmail
|
---|
| 196 | bool "sendmail"
|
---|
| 197 | config MS_postfix
|
---|
| 198 | bool "postfix"
|
---|
| 199 | config MS_exim
|
---|
| 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"
|
---|
| 222 | config KER_mitkrb
|
---|
| 223 | bool "mitkrb"
|
---|
| 224 | config KER_heimdal
|
---|
| 225 | bool "heimdal"
|
---|
| 226 | endchoice
|
---|
| 227 | config KBR5
|
---|
| 228 | string
|
---|
| 229 | default heimdal if KER_heimdal
|
---|
| 230 | default mitkrb if KER_mitkrb
|
---|
| 231 |
|
---|
| 232 | choice
|
---|
| 233 | prompt "Window package"
|
---|
| 234 | config WIN_xorg7
|
---|
| 235 | bool "Xorg7"
|
---|
| 236 | config WIN_xfree86
|
---|
| 237 | bool "xfree86"
|
---|
| 238 | endchoice
|
---|
| 239 | config X11
|
---|
| 240 | string
|
---|
| 241 | default xorg7 if WIN_xorg7
|
---|
| 242 | default xfree86 if WIN_xfree86
|
---|
| 243 | endmenu
|
---|
| 244 |
|
---|
| 245 | choice
|
---|
| 246 | prompt "Dependency level"
|
---|
| 247 | default DEPLVL_2
|
---|
| 248 |
|
---|
| 249 | config DEPLVL_1
|
---|
| 250 | bool "Required dependencies only"
|
---|
| 251 |
|
---|
| 252 | config DEPLVL_2
|
---|
| 253 | bool "Required and recommended dependencies"
|
---|
| 254 |
|
---|
| 255 | config DEPLVL_3
|
---|
| 256 | bool "Required, recommended and optional dependencies"
|
---|
| 257 |
|
---|
| 258 | endchoice
|
---|
| 259 | config optDependency
|
---|
| 260 | int
|
---|
| 261 | default 1 if DEPLVL_1
|
---|
| 262 | default 2 if DEPLVL_2
|
---|
| 263 | default 3 if DEPLVL_3
|
---|
| 264 |
|
---|
| 265 |
|
---|
| 266 | config SUDO
|
---|
| 267 | bool "Build as User"
|
---|
| 268 | default y
|
---|
| 269 | help
|
---|
| 270 | Select if sudo will be used (you want build as a normal user)
|
---|
| 271 | otherwise sudo is not needed (you want build as root)
|
---|
| 272 | EOF
|
---|
| 273 | ) >> $outFile
|
---|
| 274 | echo "done"
|
---|
| 275 |
|
---|
| 276 |
|
---|