#!/bin/sh set -e B="$(dirname $0)" if [ "$1" = "amd" ]; then BASE="archbase.config" CONFIG="overlay.config amd.config" elif [ "$1" = "intel" ]; then BASE="archbase.config" CONFIG="overlay.config intel.config" elif [ "$1" = "virt" ]; then BASE="" CONFIG="virt.config" else BASE="archbase.config" CONFIG="overlay.config" fi ################################################################################# # First just deploy base configuration (provided or just kernel default) if [ -z "$BASE" ]; then make defconfig else cp "$B/$BASE" .config fi # Apply changes in config for CNF in $CONFIG; do while read L; do echo "$L" | grep -qE "^[[:space:]]*$" && continue # ignore empty lines echo "$L" | grep -qE "#.*" && continue # Ignore comments # Remove lines with changed settings sed -i "#^$(echo "$L" | grep -oE '^CONFIG_.*=')#d" .config # Put config echo "$L" >> .config done < "$B/$CNF" done # As next step run olddefconfig (note: stderr contains some output about overrided # options so I am ignoring it) make olddefconfig 2>/dev/null # Now let's check that configuration for CNF in $CONFIG; do EC=0 while read L; do echo "$L" | grep -qE "^[[:space:]]*$" && continue # ignore empty lines echo "$L" | grep -qE "#.*" && continue # Ignore comments OPTION="$(echo "$L" | grep -oE '^CONFIG_.*=')" VALUE="$(echo "$L" | grep -oE '=.*$')" if [ "$VALUE" = "=n" ]; then # Handle =n and "not set" as being same if grep -qE "^$OPTION=y" .config; then EC=1 echo -e "\e[1;31m$CNF:\e[0m$L" fi else if ! grep -qE "^$L$" .config; then EC=1 echo -e "\e[1;31m$CNF:\e[0m$L" fi fi done < "$B/$CNF" done exit $EC