#!/bin/sh file="$1" key="$2" keydir="$3" tmpfile=`mktemp` cp -pf "$file" "$tmpfile" rpm --delsign "$tmpfile" /usr/bin/mga-signpackage "$tmpfile" "$key" "$keydir" while rpmsign -Kv "$tmpfile" 2>&1 | grep BAD do cp -pf "$file" "$tmpfile" /usr/bin/mga-signpackage "$tmpfile" "$key" "$keydir" done mv -f "$tmpfile" "$file"