5 # Update node package repository metadata and sign packages
7 # Mark Huang <mlhuang@cs.princeton.edu>
8 # Copyright (C) 2006 The Trustees of Princeton University
13 # Source function library and configuration
14 . /etc/plc.d/functions
15 . /etc/planetlab/plc_config
22 if [ "$PLC_BOOT_ENABLED" != "1" ] ; then
26 MESSAGE=$"Signing and indexing node packages"
32 if [[ -z "$@" ]] ; then
33 # use all subdirs in install-rpms by default
34 repositories=/var/www/html/install-rpms/*
40 for repository in $repositories ; do
46 # Create a stamp once the package gets signed
47 mkdir $repository/signed-stamps
49 for package in $repository/*.rpm ; do
50 stamp=$repository/signed-stamps/$(basename $package).signed
51 # If package is newer than signature stamp
52 if [ $package -nt $stamp ] ; then
53 packages="$packages $package"
54 stamps="$stamps $stamp"
57 if [ $package -nt $repository/headers/header.info ] ; then
60 # Or createrepo database
61 if [ $package -nt $repository/repodata/repomd.xml ] ; then
66 if [ -n "$packages" ] ; then
67 # Sign RPMS. setsid detaches rpm from the terminal,
68 # allowing the (hopefully blank) GPG password to be
69 # entered from stdin instead of /dev/tty.
71 --define "_signature gpg" \
72 --define "_gpg_path /etc/planetlab" \
73 --define "_gpg_name $PLC_MAIL_SUPPORT_ADDRESS" \
74 --resign $packages && touch $stamps
78 # Update yum metadata. yum-arch createrepo sometimes leaves behind
79 # .oldheaders and .olddata directories accidentally.
80 rm -rf $repository/{.oldheaders,.olddata}
82 # Old command is yum-arch
83 if [ $yum_arch -eq 1 ] ; then
88 # New command is createrepo
89 if [ $createrepo -eq 1 ] ; then
90 if [ -f $repository/yumgroups.xml ] ; then
91 createrepo -g yumgroups.xml $repository
93 createrepo $repository
103 if [[ -z "$@" ]] ; then
104 # use all subdirs in install-rpms by default
105 repositories=/var/www/html/install-rpms/*
111 for repository in $repositories ; do
112 rm -rf $repository/signed-stamps
113 rm -rf $repository/repodata
114 rm -rf $repository/headers
118 echo "Usage: $0 start|clean [repo ..]"