rpmrebuildで更新するrpmを全てバックアップする

前回の亜種

#!/bin/sh
COLOR_RED="\e[31;1m"
COLOR_GREEN="\e[32;1m"
COLOR_OFF="\e[m"

TEXT_OK="[ ${COLOR_GREEN}成功${COLOR_OFF} ]"
TEXT_NG="[ ${COLOR_RED}失敗${COLOR_OFF} ]"
TEXT_ERROR="[ ${COLOR_RED}ERROR${COLOR_OFF} ]"

IFS=$'\n'
for LINE in `echo "n" | yum update | egrep "^ [^ ]" | egrep "[0-9]+ (k|M|G)$" | sed -e "s/^ //g" | sed -e "s/ \+/ /g"`; do
  package=`echo ${LINE} | cut -f1 -d' '`
  arch=`echo ${LINE} | cut -f2 -d' '`
  if rpm -q ${package}; then
    ionice -c2 nice -n 19 rpmrebuild --verify=no ${package}.${arch}
  fi
done
sh ./rebuildpkgall.sh 2> /tmp/rebuildpkgall.log