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