_check()
{
  if [ $? -eq 0 ]; then
   echo -e "\033[1;34m > \033[1;39m Done \033[1;0m";return 0
   else
   echo -e "\033[1;34m > \033[1;31m Fail \033[1;0m";return 1
  fi
}

_build()
{
  cp -rf /usr/share/gfxboot /tmp >/dev/null
  make -C /tmp/gfxboot/themes/upstream
}

post_install() {
echo -e "\n \033[1;30m   ------------------------------\n \033[1;0m"
echo -e "\033[1;34m :: \033[1;39m Building ... please wait \033[1;0m"
  _build >/dev/null 2>&1
  _check
  if  ! [ -f /boot/message ]; then
     echo -e "\033[1;34m :: \033[1;39m Copy message to /boot/message \033[1;0m"
     cp /tmp/gfxboot/themes/upstream/message /boot/message
     _check
  else
    echo -e "\033[1;34m :: \033[1;39m mv message to /boot/message.old \033[1;0m"
	mv /boot/message /boot/message.old
	 _check
	 echo -e "\033[1;34m :: \033[1;39m Copy message to /boot/message \033[1;0m"
     cp -f /tmp/gfxboot/themes/upstream/message /boot/message
     _check
  fi

  echo -e "\n \033[1;30m   ------------------------------\n \033[1;0m"
  echo -e "\033[1;34m > \033[1;39m man gfxboot  , /usr/share/doc/gfxboot/gfxboot.html :) \033[1;0m"
  echo -e "\n \033[1;30m   ------------------------------\n \033[1;0m"
}

post_upgrade() {
 post_install $1
}

post_remove() {
 /bin/true
}

op=$1
shift

$op $*