Harald Hoyer 126bbe
#!/bin/bash
Harald Hoyer 126bbe
Harald Hoyer 126bbe
if [[ -e "$HOME/git/dracut/$1" ]]; then
Harald Hoyer 126bbe
    srcrpm="$HOME/git/dracut/$1"
Harald Hoyer 126bbe
else
Harald Hoyer 126bbe
    srcrpm="$1"
Harald Hoyer 126bbe
fi
Harald Hoyer 126bbe
Harald Hoyer 126bbe
[[ -f $srcrpm ]] || exit 0
Harald Hoyer 126bbe
Harald Hoyer 126bbe
cp dracut.spec dracut.spec.old
Harald Hoyer 126bbe
for i in *.patch; do git rm -f $i;done
Harald Hoyer 126bbe
Harald Hoyer 126bbe
if rpm -ivh --define "_srcrpmdir $PWD" --define "_specdir $PWD" --define "_sourcedir $PWD" "$srcrpm"; then
Harald Hoyer 126bbe
	ls *.patch &>/dev/null && git add *.patch
Harald Hoyer 126bbe
	perl -n -e 'if ($do_print) {print "$_" ;}; if (/^%changelog/) { $do_print=1; }' < dracut.spec.old >> dracut.spec
Harald Hoyer 126bbe
fi