72 lines
2.1 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../uclibc/conffiles-functions.in
# Copyright (C) 2006 - 2007 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
# $conffiles is a list of patters of the form
# ^[XO-] <pattern> [<value>]
# X means enable, O disable, and - removes it
# pattern can use '*' as a wildcard for [^ #]
# optionaly can set a value different that y
conffiles_apply() {
local file= rule=
local action= prerule= value= x=
if [ ! -f $builddir/config.sed ]; then
for file in $conffiles $extraconffiles; do if [ -f "$file" ]; then
sed -e '/^[ \t]*$/d;' -e '/^[ \t]*#.*/d;' "$file" |
while read action prerule value x; do
rule="$(echo $prerule | sed 's/\*/[^ #]*/')"
rule="^\(# \)\?\($rule\)[= ].*\$"
if [ -z "$value" ]; then
value='y'
fi
case "$action" in
X) echo "apply_conffiles: rule $prerule=$value." >&2
echo "s,$rule,\2=$value,g" >> $builddir/config.sed
;;
O) echo "apply_conffiles: rule unset $prerule." >&2
echo "s,$rule,# \2 is not set,g" >> $builddir/config.sed
;;
-) echo "apply_conffiles: rule remove $prerule." >&2
echo "s,$rule,,g" >> $builddir/config.sed
;;
*)
abort "apply_conffiles: bad rule $action $prerule $value"
;;
esac
done
fi ; done
fi
sed -f $builddir/config.sed .config
}
# get default config, and filter considering <n>
# levels, because new options can appear and other disappear
conffiles_loop() {
local loops="${1:-1}"
shift
cp -v .config .config.1
j=2 ; for (( i=0 ; i<loops ; i++, j++ )) {
conffiles_apply > .config.$j
cp -v .config.$j .config
eval $MAKE "$@" oldconfig
(( j++ )) ; cp -v .config .config.$j
}
}