#!/bin/bash -e

config_equal()
{
	diff -q -s src/linux/.config config.x86_64 &>/dev/null
}

if config_equal; then
	(cd src/linux && make menuconfig)
else
	[[ -e src ]] && rm -rf src
	makepkg --nobuild --force
	(cd src/linux && make oldconfig)
fi

if ! config_equal; then
	cp src/linux/.config config.x86_64
	updpkgsums
fi
