Alexander Graf 1562f9
#!/bin/bash
Alexander Graf 1562f9
Alexander Graf 1562f9
#############################################################################
Alexander Graf 1562f9
# Copyright (c) 2011 SUSE
Alexander Graf 1562f9
# All Rights Reserved.
Alexander Graf 1562f9
#
Alexander Graf 1562f9
# This program is free software; you can redistribute it and/or
Alexander Graf 1562f9
# modify it under the terms of version 2 of the GNU General Public License as
Alexander Graf 1562f9
# published by the Free Software Foundation.
Alexander Graf 1562f9
#
Alexander Graf 1562f9
# This program is distributed in the hope that it will be useful,
Alexander Graf 1562f9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Alexander Graf 1562f9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
Alexander Graf 1562f9
# GNU General Public License for more details.
Alexander Graf 1562f9
#
Alexander Graf 1562f9
# You should have received a copy of the GNU General Public License
Alexander Graf 1562f9
# along with this program; if not, contact Novell, Inc.
Alexander Graf 1562f9
#
Alexander Graf 1562f9
# To contact Novell about this file by physical or electronic mail,
Alexander Graf 1562f9
# you may find current contact information at www.novell.com
Alexander Graf 1562f9
#############################################################################
Alexander Graf 1562f9
Alexander Graf 1562f9
# we try to find config options that are the same in all
Alexander Graf 1562f9
# configs we pass as parameters
Alexander Graf 1562f9
Alexander Graf 1562f9
if [ ! "$1" ]; then
Alexander Graf 1562f9
    echo "Common config checker"
Alexander Graf 1562f9
    echo
Alexander Graf 1562f9
    echo "Allows for new architectures to find out which options"
Alexander Graf 1562f9
    echo "are generic SUSE options so we can set them too."
Alexander Graf 1562f9
    echo
Alexander Graf 1562f9
    echo "Usage: $0 <config> <config> ..."
Alexander Graf 1562f9
    exit 1
Alexander Graf 1562f9
fi
Alexander Graf 1562f9
Alexander Graf 1562f9
TMPFILE=/tmp/common_tmp.$$
Alexander Graf 1562f9
sort "$@" | uniq -d -c > $TMPFILE
Alexander Graf 1562f9
CONF_NR="$#"
Alexander Graf 1562f9
Alexander Graf 1562f9
while read COUNT LINE OPTION_NO; do
Alexander Graf 1562f9
    if [ "${LINE:0:7}" = "CONFIG_" ]; then
Alexander Graf 1562f9
        OPTION=$(echo $LINE | cut -d = -f 1)
Alexander Graf 1562f9
    elif [ "${OPTION_NO:0:7}" = "CONFIG_" ]; then
Alexander Graf 1562f9
        OPTION=$OPTION_NO
Alexander Graf 1562f9
    else
Alexander Graf 1562f9
        continue
Alexander Graf 1562f9
    fi
Alexander Graf 1562f9
    if [ "$COUNT" = "$CONF_NR" ]; then
Alexander Graf 1562f9
        echo "$LINE" "$OPTION_NO"
Alexander Graf 1562f9
    fi
Alexander Graf 1562f9
done < $TMPFILE