2006-08-15 13:35:19 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2006-08-22 21:20:24 +02:00
|
|
|
# $Id$
|
2006-08-15 13:35:19 +02:00
|
|
|
#
|
|
|
|
|
2006-08-22 20:56:08 +02:00
|
|
|
export outFile=Config.in # file for reading and writing to.
|
2006-08-17 23:19:23 +02:00
|
|
|
export inFile=packages # file for reading and writing to.
|
2006-08-15 13:35:19 +02:00
|
|
|
|
|
|
|
declare PKG_NAME
|
|
|
|
declare PKG_XML_FILE
|
|
|
|
declare PKG_DIR
|
2006-08-19 14:09:55 +02:00
|
|
|
declare PKG_VER
|
2006-08-21 23:57:52 +02:00
|
|
|
declare INST_VER
|
2006-08-22 22:26:57 +02:00
|
|
|
declare INST_STRING
|
2006-08-15 13:35:19 +02:00
|
|
|
declare SAVE_IFS=${IFS}
|
|
|
|
declare -a DIR_TREE
|
|
|
|
declare PREV_DIR1="none"
|
|
|
|
declare PREV_DIR2="none"
|
|
|
|
declare MENU_SET1="n"
|
|
|
|
declare MENU_SET2="n"
|
|
|
|
|
|
|
|
> $outFile
|
|
|
|
|
|
|
|
#---------------------#
|
|
|
|
# MAIN #
|
|
|
|
#---------------------#
|
|
|
|
: <<enddoc
|
|
|
|
This script will create a Config.in file from the contents
|
|
|
|
of the file <packages>.
|
|
|
|
Packages previously installed will not be included.
|
|
|
|
enddoc
|
|
|
|
|
2006-08-17 23:38:31 +02:00
|
|
|
echo -en "\tGenerating Config.in from package data ..."
|
2006-08-15 13:35:19 +02:00
|
|
|
while [ 0 ]
|
|
|
|
do
|
|
|
|
|
|
|
|
# read -r || break 1
|
|
|
|
read || break 1
|
2006-08-17 23:19:23 +02:00
|
|
|
|
2006-08-15 13:35:19 +02:00
|
|
|
set -- $REPLY
|
2006-08-17 23:19:23 +02:00
|
|
|
PKG_NAME=$1
|
2006-08-15 13:35:19 +02:00
|
|
|
PKG_XML_FILE=$(basename $2)
|
|
|
|
PKG_DIR=$(dirname $2)
|
2006-08-19 14:09:55 +02:00
|
|
|
PKG_VER=$3
|
2006-08-21 23:57:52 +02:00
|
|
|
INST_VER=$4
|
2006-08-19 14:09:55 +02:00
|
|
|
# These are the META packages.
|
2006-08-15 13:35:19 +02:00
|
|
|
if [ $PKG_DIR = "." ]; then
|
2006-08-17 01:18:19 +02:00
|
|
|
SET_COMMENT=y
|
2006-08-22 22:26:57 +02:00
|
|
|
# Do not include previously installed packages
|
2006-08-21 23:57:52 +02:00
|
|
|
if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2006-08-22 22:26:57 +02:00
|
|
|
# Set installed version for updated meta-packages
|
|
|
|
[ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
|
2006-08-17 23:32:21 +02:00
|
|
|
|
2006-08-17 01:18:19 +02:00
|
|
|
META_PKG=$(echo ${PKG_NAME} | tr [a-z] [A-Z])
|
2006-08-22 22:26:57 +02:00
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
config CONFIG_$META_PKG
|
|
|
|
bool "$META_PKG $PKG_VER $INST_STRING"
|
|
|
|
default n
|
|
|
|
|
2006-08-22 22:30:10 +02:00
|
|
|
menu "$(echo ${PKG_NAME} | tr [a-z] [A-Z]) components"
|
2006-08-22 22:26:57 +02:00
|
|
|
depends CONFIG_$META_PKG
|
|
|
|
|
|
|
|
EOF
|
|
|
|
) >> $outFile
|
2006-08-17 23:11:14 +02:00
|
|
|
|
2006-08-22 22:26:57 +02:00
|
|
|
unset INST_STRING
|
|
|
|
|
|
|
|
# Include the dependency data for this meta package
|
2006-08-17 01:18:19 +02:00
|
|
|
while [ 0 ]; do
|
|
|
|
read || break 1
|
2006-08-19 14:09:55 +02:00
|
|
|
PKG_NAME=${REPLY}
|
2006-08-21 23:57:52 +02:00
|
|
|
PKG_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f3)
|
|
|
|
INST_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f4)
|
2006-08-22 22:26:57 +02:00
|
|
|
# Skip installed meta-package components
|
2006-08-21 23:57:52 +02:00
|
|
|
if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2006-08-22 22:26:57 +02:00
|
|
|
# Set installed version for updated meta-packages components
|
|
|
|
[ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
|
2006-08-17 01:18:19 +02:00
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
config DEP_${META_PKG}_${PKG_NAME}
|
2006-08-22 22:26:57 +02:00
|
|
|
bool "$PKG_NAME ${PKG_VER} ${INST_STRING}"
|
2006-08-17 01:18:19 +02:00
|
|
|
default y
|
|
|
|
|
|
|
|
EOF
|
2006-08-17 23:19:23 +02:00
|
|
|
) >> $outFile
|
2006-08-22 22:26:57 +02:00
|
|
|
unset INST_STRING
|
2006-08-17 01:18:19 +02:00
|
|
|
done <./libs/${PKG_NAME}.dep
|
|
|
|
echo -e "endmenu" >> $outFile
|
2006-08-15 13:35:19 +02:00
|
|
|
continue
|
|
|
|
fi
|
2006-08-17 23:19:23 +02:00
|
|
|
[[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT
|
|
|
|
|
2006-08-19 00:24:11 +02:00
|
|
|
# Deal with a few unusable (at target level) package names
|
2006-08-15 13:35:19 +02:00
|
|
|
case ${PKG_NAME} in
|
2006-08-19 00:24:11 +02:00
|
|
|
xorg7-* ) continue ;;
|
2006-08-17 23:38:31 +02:00
|
|
|
alsa-* ) continue ;;
|
2006-08-19 00:24:11 +02:00
|
|
|
x-config | x-setup ) continue ;;
|
2006-08-15 13:35:19 +02:00
|
|
|
esac
|
|
|
|
|
2006-08-22 22:26:57 +02:00
|
|
|
# Skip installed packages
|
2006-08-21 23:57:52 +02:00
|
|
|
if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2006-08-22 22:26:57 +02:00
|
|
|
# Set installed version for updated packages
|
|
|
|
[ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
|
2006-08-17 23:19:23 +02:00
|
|
|
|
2006-08-15 13:35:19 +02:00
|
|
|
IFS="/"
|
|
|
|
DIR_TREE=(${PKG_DIR})
|
|
|
|
IFS="$SAVE_IFS"
|
|
|
|
|
2006-08-19 14:09:55 +02:00
|
|
|
# Define a top level menu
|
2006-08-15 13:35:19 +02:00
|
|
|
if [ "$PREV_DIR1" != "${DIR_TREE[1]}" ]; then
|
2006-08-17 01:18:19 +02:00
|
|
|
[[ "${DIR_TREE[1]}" = "kde" ]] && continue
|
|
|
|
[[ "${DIR_TREE[1]}" = "gnome" ]] && continue
|
2006-08-17 23:19:23 +02:00
|
|
|
|
|
|
|
if [ $MENU_SET1 = "y" ]; then
|
2006-08-15 13:35:19 +02:00
|
|
|
# Close out any open secondary menu
|
2006-08-17 23:19:23 +02:00
|
|
|
if [ $MENU_SET2 = "y" ]; then
|
2006-08-15 13:35:19 +02:00
|
|
|
echo -e "\tendmenu" >> $outFile
|
|
|
|
# Reset 'menu open' flag
|
|
|
|
MENU_SET2="n"
|
|
|
|
fi
|
|
|
|
# Close the current top level menu
|
|
|
|
echo -e "endmenu\n" >> $outFile
|
|
|
|
fi
|
|
|
|
# Open a new top level menu
|
|
|
|
echo -e "menu "$(echo ${DIR_TREE[1]:0:1} | tr [a-z] [A-Z])${DIR_TREE[1]:1}"" >> $outFile
|
2006-08-17 23:19:23 +02:00
|
|
|
MENU_SET1="y"
|
2006-08-15 13:35:19 +02:00
|
|
|
fi
|
|
|
|
|
2006-08-19 14:09:55 +02:00
|
|
|
# Define a secondary menu
|
2006-08-15 13:35:19 +02:00
|
|
|
if [ "$PREV_DIR2" != "${DIR_TREE[2]}" ]; then
|
|
|
|
# Close out the previous open menu structure
|
2006-08-17 23:19:23 +02:00
|
|
|
if [ $MENU_SET2 = "y" ]; then
|
2006-08-15 13:35:19 +02:00
|
|
|
echo -e "\tendmenu\n" >> $outFile
|
|
|
|
fi
|
2006-08-17 23:19:23 +02:00
|
|
|
# Initialize a new 2nd level menu structure.
|
2006-08-15 13:35:19 +02:00
|
|
|
echo -e "\tmenu "$(echo ${DIR_TREE[2]:0:1} | tr [a-z] [A-Z])${DIR_TREE[2]:1}"" >> $outFile
|
2006-08-17 23:19:23 +02:00
|
|
|
MENU_SET2="y"
|
2006-08-15 13:35:19 +02:00
|
|
|
fi
|
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
config CONFIG_$PKG_NAME
|
2006-08-22 22:26:57 +02:00
|
|
|
bool "$PKG_NAME ${PKG_VER} ${INST_STRING}"
|
2006-08-17 23:19:23 +02:00
|
|
|
default n
|
2006-08-15 13:35:19 +02:00
|
|
|
EOF
|
|
|
|
) >> $outFile
|
|
|
|
|
2006-08-22 22:26:57 +02:00
|
|
|
unset INST_STRING
|
|
|
|
|
2006-08-15 13:35:19 +02:00
|
|
|
PREV_DIR1=${DIR_TREE[1]}
|
|
|
|
PREV_DIR2=${DIR_TREE[2]}
|
|
|
|
done <"$inFile"
|
|
|
|
|
|
|
|
if [ $MENU_SET2 = "y" ]; then echo -e "\tendmenu" >> $outFile; fi
|
|
|
|
if [ $MENU_SET1 = "y" ]; then echo "endmenu" >> $outFile; fi
|
|
|
|
|
|
|
|
(
|
|
|
|
cat << EOF
|
2006-08-17 05:57:20 +02:00
|
|
|
|
|
|
|
comment ""
|
|
|
|
|
|
|
|
menu "Default packages for resolving dependencies"
|
2006-08-16 22:30:30 +02:00
|
|
|
|
|
|
|
choice
|
|
|
|
prompt "Default print server"
|
|
|
|
config PS_cups
|
|
|
|
bool "cups"
|
|
|
|
config PS_LPRng
|
|
|
|
bool "LPRng"
|
|
|
|
endchoice
|
|
|
|
config PRINT_SERVER
|
|
|
|
string
|
|
|
|
default cups if PS_cups
|
2006-08-17 23:19:23 +02:00
|
|
|
default LPRng if PS_LPRng
|
2006-08-17 23:11:14 +02:00
|
|
|
|
2006-08-16 22:30:30 +02:00
|
|
|
choice
|
|
|
|
prompt "Mail server"
|
|
|
|
config MS_sendmail
|
2006-08-17 23:32:21 +02:00
|
|
|
bool "sendmail"
|
2006-08-16 22:30:30 +02:00
|
|
|
config MS_postfix
|
|
|
|
bool "postfix"
|
2006-08-17 23:56:21 +02:00
|
|
|
config MS_exim
|
2006-08-16 22:30:30 +02:00
|
|
|
bool "exim"
|
|
|
|
endchoice
|
|
|
|
config MAIL_SERVER
|
|
|
|
string
|
|
|
|
default sendmail if MS_sendmail
|
|
|
|
default postfix if MS_postfix
|
|
|
|
default exim if MS_exim
|
|
|
|
|
|
|
|
choice
|
|
|
|
prompt "Postscript package"
|
|
|
|
config GS_espgs
|
|
|
|
bool "espgs"
|
|
|
|
config GS_ghostscript
|
|
|
|
bool "ghostscript"
|
|
|
|
endchoice
|
|
|
|
config GHOSTSCRIPT
|
|
|
|
string
|
|
|
|
default espgs if GS_espgs
|
|
|
|
default ghostscript if GS_ghostscript
|
|
|
|
|
|
|
|
choice
|
|
|
|
prompt "Kerberos 5"
|
2006-08-16 22:51:39 +02:00
|
|
|
config KER_mitkrb
|
2006-08-16 22:30:30 +02:00
|
|
|
bool "mitkrb"
|
|
|
|
config KER_heimdal
|
2006-08-17 23:19:23 +02:00
|
|
|
bool "heimdal"
|
2006-08-16 22:30:30 +02:00
|
|
|
endchoice
|
|
|
|
config KBR5
|
|
|
|
string
|
|
|
|
default heimdal if KER_heimdal
|
|
|
|
default mitkrb if KER_mitkrb
|
|
|
|
|
|
|
|
choice
|
2006-08-17 23:42:26 +02:00
|
|
|
prompt "Window package"
|
2006-08-16 22:30:30 +02:00
|
|
|
config WIN_xorg7
|
|
|
|
bool "Xorg7"
|
|
|
|
config WIN_xorg
|
|
|
|
bool "Xorg"
|
|
|
|
config WIN_xfree86
|
|
|
|
bool "xfree86"
|
2006-08-17 23:19:23 +02:00
|
|
|
endchoice
|
2006-08-16 22:30:30 +02:00
|
|
|
config X11
|
|
|
|
string
|
|
|
|
default xorg7 if WIN_xorg7
|
|
|
|
default xorg if WIN_xorg
|
|
|
|
default xfree86 if WIN_xfree86
|
2006-08-17 05:57:20 +02:00
|
|
|
endmenu
|
2006-08-16 22:30:30 +02:00
|
|
|
|
2006-08-17 23:19:23 +02:00
|
|
|
choice
|
2006-08-17 23:11:14 +02:00
|
|
|
prompt "Dependency level"
|
2006-08-17 04:22:40 +02:00
|
|
|
default DEPLVL_2
|
2006-08-17 23:19:23 +02:00
|
|
|
|
2006-08-17 04:22:40 +02:00
|
|
|
config DEPLVL_1
|
2006-08-16 22:30:30 +02:00
|
|
|
bool "Required dependencies only"
|
2006-08-17 23:19:23 +02:00
|
|
|
|
2006-08-17 04:22:40 +02:00
|
|
|
config DEPLVL_2
|
2006-08-16 22:30:30 +02:00
|
|
|
bool "Required and recommended dependencies"
|
2006-08-17 23:19:23 +02:00
|
|
|
|
2006-08-17 04:22:40 +02:00
|
|
|
config DEPLVL_3
|
2006-08-16 22:30:30 +02:00
|
|
|
bool "Required, recommended and optional dependencies"
|
2006-08-17 23:19:23 +02:00
|
|
|
|
2006-08-16 22:30:30 +02:00
|
|
|
endchoice
|
|
|
|
config optDependency
|
|
|
|
int
|
2006-08-17 04:22:40 +02:00
|
|
|
default 1 if DEPLVL_1
|
|
|
|
default 2 if DEPLVL_2
|
|
|
|
default 3 if DEPLVL_3
|
2006-08-17 23:19:23 +02:00
|
|
|
|
|
|
|
|
2006-08-16 22:30:30 +02:00
|
|
|
config SUDO
|
2006-08-15 13:35:19 +02:00
|
|
|
bool "Build as User"
|
|
|
|
default y
|
|
|
|
help
|
|
|
|
Select if sudo will be used (you want build as a normal user)
|
|
|
|
otherwise sudo is not needed (you want build as root)
|
|
|
|
EOF
|
|
|
|
) >> $outFile
|
2006-08-17 23:38:31 +02:00
|
|
|
echo "done"
|
2006-08-15 13:35:19 +02:00
|
|
|
|
|
|
|
|