* performs gpg-signing only once, stores stamps in repository/signed-stamps/
(still runs yum-arch and createrepo unconditionnally)
* can also cleanup these stamps with packages clean [repo]
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
-# $Id: packages,v 1.3 2006/06/23 20:29:22 mlhuang Exp $
+# $Id: packages,v 1.4 2006/07/19 14:15:15 mlhuang Exp $
#
# Source function library and configuration
#
# Source function library and configuration
dialog "$MESSAGE"
shopt -s nullglob
dialog "$MESSAGE"
shopt -s nullglob
- for repository in /var/www/html/install-rpms/* ; do
+
+ shift
+ if [[ -z "$@" ]] ; then
+ # use all subdirs in install-rpms by default
+ repositories=/var/www/html/install-rpms/*
+ else
+ # else use argv
+ repositories=$@
+ fi
+
+ for repository in $repositories ; do
# Sign all RPMS. setsid detaches rpm from the terminal,
# allowing the (hopefully blank) GPG password to be
# entered from stdin instead of /dev/tty.
packages=
# Sign all RPMS. setsid detaches rpm from the terminal,
# allowing the (hopefully blank) GPG password to be
# entered from stdin instead of /dev/tty.
packages=
+ stamps=
+ # create a stamp once the package gets signed
+ mkdir $repository/signed-stamps
+
for package in $repository/*.rpm ; do
for package in $repository/*.rpm ; do
- packages="$packages $package"
+ stamp=$repository/signed-stamps/$(basename $package).signed
+ # is package newer than stamp ?
+ if [ $package -nt $stamp ] ; then
+ packages="$packages $package"
+ stamps="$stamps $stamp"
+ else
+ echo "Package $package already signed - skipped"
+ fi
done
if [ -n "$packages" ] ; then
echo | setsid rpm \
--define "_signature gpg" \
--define "_gpg_path /etc/planetlab" \
--define "_gpg_name $PLC_MAIL_SUPPORT_ADDRESS" \
done
if [ -n "$packages" ] ; then
echo | setsid rpm \
--define "_signature gpg" \
--define "_gpg_path /etc/planetlab" \
--define "_gpg_name $PLC_MAIL_SUPPORT_ADDRESS" \
+ --resign $packages && touch $stamps
+ clean)
+ shift
+ if [[ -z "$@" ]] ; then
+ # use all subdirs in install-rpms by default
+ repositories=/var/www/html/install-rpms/*
+ else
+ # else use argv
+ repositories=$@
+ fi
+
+ for repository in $repositories ; do
+ rm -rf $repository/signed-stamps
+ done
+ ;;
+ *)
+ echo "Usage: $0 start|clean [repo ..]"
+ ;;