#!/bin/bash
#Usage: /bin/bash import_OS_GPG_key.sh
#Create 2017-07-07 By RuanShengChang
#Mail:rscpass@163.com
#Used for CentOS5.x CentOS6.x CentOS7.x
#info:download CentOS GPG Key and import to SystemError
CentOS5()
{
cd /etc/pki/rpm-gpg
curl -O -L https://www.centos.org/keys/RPM-GPG-KEY-CentOS-5
for i in /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-*
do
/bin/rpm --import $i >>/tmp/import.log
done
}
CentOS6()
{
/usr/bin/wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 https://www.centos.org/keys/RPM-GPG-KEY-CentOS-6
/usr/bin/wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6 https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Debug-6
/usr/bin/wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Testing-6 https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Testing-6
/usr/bin/wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Security-6 https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Security-6
for i in /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-*
do
/bin/rpm --import $i >>/tmp/import.log
done
}
CentOS7()
{
wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7
wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6 https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Debug-7
wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Testing-6 https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Testing-7
for i in /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-*
do
/bin/rpm --import $i >>/tmp/import.log
done
}
version=`cat /etc/redhat-release | awk '{print $3}'|awk -F '.' '{print $1}' `
if [ $version -eq 5 ];then
echo "CentOS5 GPG KEY Will be Installed"
CentOS5
elif [ $version -eq 6 ];then
echo "CentOS6 GPG KEY Will be Installed"
CentOS6
else
echo "CentOS7 GPG KEY Will be Installed"
CentOS7
fi
2017-07-07
批量导入官方YUM_GPG-KEY脚本: import_OS_GPG_key.sh
评论
发表评论
姓 名: