#!/bin/bash # # priority: 500 # # Generate GPG keys # # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # # $Id: gpg,v 1.6 2006/05/18 17:34:10 mlhuang Exp $ # # Source function library and configuration . /etc/plc.d/functions . /etc/planetlab/plc_config # Be verbose set -x case "$1" in start) if [ ! -f $PLC_ROOT_GPG_KEY_PUB -o ! -f $PLC_ROOT_GPG_KEY ] ; then # Generate new GPG keyring MESSAGE=$"Generating GPG keys" dialog "$MESSAGE" mkdir -p $(dirname $PLC_ROOT_GPG_KEY_PUB) mkdir -p $(dirname $PLC_ROOT_GPG_KEY) # Temporarily replace /dev/random with /dev/urandom to # avoid running out of entropy. rm -f /dev/random mknod /dev/random c 1 9 gpg --homedir=/root --no-tty --yes \ --batch --gen-key <"/etc/pki/rpm-gpg/RPM-GPG-KEY-$PLC_NAME" check if rpm -q gpg-pubkey ; then rpm --allmatches -e gpg-pubkey check fi rpm --import /etc/pki/rpm-gpg/* check result "$MESSAGE" ;; esac exit $ERRORS