source: trunk/packages/xen-common/xen-common/buildconfigs/create_config.sh @ 77

Last change on this file since 77 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 1.4 KB
Line 
1#!/bin/sh
2set -e
3
4
5# Parse arguments
6#
7if [ $# -lt 1 -o $# -gt 4 ]; then
8    echo "Usage: $0 config-file EXTRAVERSION XEN_TARGET_ARCH XEN_SYSTYPE"
9    exit 1
10fi
11
12config_file=$1
13extraversion=$2
14target_arch=$3
15systype=$4
16
17
18# Start with initial config skeleton file, if any.
19# Derive from linux-defconfig_xen_x86_32 otherwise.
20#
21skeleton=buildconfigs/linux-defconfig_${extraversion}_${target_arch}${systype}
22[ -r $skeleton ] || skeleton=buildconfigs/linux-defconfig_xen_x86_32
23[ -r $skeleton.local ] && skeleton=$skeleton.local
24cp $skeleton $config_file
25
26
27# Update
28#
29filter_template="s/^#\{0,1\} *\(CONFIG[^= ]*\).*/\/^#\\\{0,1\\\} *\1[= ].*\/d/p"
30config_dirs="buildconfigs/conf.linux buildconfigs/conf.linux-${target_arch} buildconfigs/conf.linux-${extraversion} buildconfigs/conf.linux-${target_arch}-${extraversion}"
31
32for config_dir in $config_dirs
33do
34    if [ -d $config_dir ]; then
35        # processing is done in alphanumeric order
36        find $config_dir -type f | sort | while read update
37        do
38            # create the filter rules in a temp file
39            filter_rules=`mktemp -t xenupdateconf.XXXXXXXXXX`
40            sed -n "${filter_template}" < $update > $filter_rules
41
42            # filter the config file in place, removing any options that
43            # will be updated.
44            sed -f $filter_rules -i $config_file
45            cat $update >> $config_file
46
47            # clean up
48            rm -f $filter_rules
49        done
50    fi
51done
Note: See TracBrowser for help on using the repository browser.