#!/bin/bash 
# Summary	Shell script to automate importing all the GPG KEYS for new 
# Title		gpgkey-import
# Version	1.0
# License	GPL V2.  
# Written	Derek Pappas and amended by Gavin Henry for http://FedoraNEWS.ORG.
# Edited	Tue Mar 16 2004

# User must be root
  ROOT_UID=0   # Root has $UID 0.
  
  if [ "$UID" -eq "$ROOT_UID" ] 
  then
    echo "You are root, we can continue."
  else
    echo "You are just an ordinary user, so this script won't work!!!"
  exit 0
  fi
  


# Begin tasks:
  echo "Getting the keys.  Please wait a while."
  lynx -dump http://freshrpms.net/packages/RPM-GPG-KEY.txt > RPM-GPG-KEY.txt
  echo "Got the first key."
  lynx -dump http://newrpms.sunsite.dk/gpg-pubkey-newrpms.txt > gpg-pubkey-newrpms.txt 
  echo "Got the second key."
  lynx -dump http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt > RPM-GPG-KEY.dag.txt 
  echo "Got the third key."
  lynx -dump http://atrpms.physik.fu-berlin.de/RPM-GPG-KEY.atrpms > RPM-GPG-KEY.atrpms 
  echo "Got the fourth key."
  lynx -dump http://people.ecsc.co.uk/%7Ematt/gpg/mattatecscdotcodotuk.asc > mattatecscdotcodotuk.asc 
  echo "Got the fifth key."
  #lynx -dump http://www.jpackage.org/jpackage.asc > jpackage.asc 
  #echo "Got the last key."

  echo "GPG is importing the keys. Please wait a while."
  gpg --import RPM-GPG-KEY.txt
  echo "Imported the first key."
  gpg --import gpg-pubkey-newrpms.txt 
  echo "Imported the second key."
  gpg --import RPM-GPG-KEY.dag.txt 
  echo "Imported the third key."
  gpg --import RPM-GPG-KEY.atrpms
  echo "Imported the fourth key."
  gpg --import mattatecscdotcodotuk.asc
  echo "Imported the fifth key."
  #gpg --import jpackage.asc
  #echo "Imported the last key."
    
    
  echo "RPM is importing the keys. Please wait a while." $blue
  rpm --import RPM-GPG-KEY.txt
  echo "Imported the first key."
  rpm --import gpg-pubkey-newrpms.txt
  echo "Imported the second key."
  rpm --import RPM-GPG-KEY.dag.txt
  echo "Imported the third key."
  rpm --import RPM-GPG-KEY.atrpms 
  echo "Imported the fourth key."
  rpm --import mattatecscdotcodotuk.asc 
  echo "Imported the fifth key."
  #rpm --import jpackage.asc 
  #echo "Imported the last key."

# exit cleanly and echo complete message
  echo "All GPG KEYS have been successfully imported, thank you.
        Please visit http://FedoraNEWS.ORG for more howtos, tutorials and articles."
        
  exit 0
