dracut/newdracut.sh

18 lines
477 B
Bash
Raw Normal View History

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