diff options
author | 2014-12-20 13:17:27 -0800 | |
---|---|---|
committer | 2014-12-22 14:57:48 -0800 | |
commit | a153cacf6b47788c9a017c37f78469e009e4ffff (patch) | |
tree | 249a0ea9461276ed921ff5c56b08a474626080f8 /gkeys-ldap/bin | |
parent | Merge pull request #35 from gentoo/dol-sen-PR (diff) | |
download | gentoo-keys-a153cacf6b47788c9a017c37f78469e009e4ffff.tar.gz gentoo-keys-a153cacf6b47788c9a017c37f78469e009e4ffff.tar.bz2 gentoo-keys-a153cacf6b47788c9a017c37f78469e009e4ffff.zip |
Move the 3 pkgs into their own *-pkg dir
This makes releasing each pkg independently easier.
testpath: Update paths for the new directory structure
Diffstat (limited to 'gkeys-ldap/bin')
-rwxr-xr-x | gkeys-ldap/bin/gkeys-ldap | 50 | ||||
-rwxr-xr-x | gkeys-ldap/bin/update-seeds.sh | 55 |
2 files changed, 105 insertions, 0 deletions
diff --git a/gkeys-ldap/bin/gkeys-ldap b/gkeys-ldap/bin/gkeys-ldap new file mode 100755 index 0000000..3d23ac1 --- /dev/null +++ b/gkeys-ldap/bin/gkeys-ldap @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +'''Gentoo-keys is a gpg key manager for managing + gentoo's gpg-signing keys. It is these keys that are + used to verify and validate release media, etc.. + + Distributed under the terms of the GNU General Public License v2 + + Copyright: + (c) 2011 Brian Dolbec + Distributed under the terms of the GNU General Public License v2 + + Author(s): + Brian Dolbec <dolsen@gentoo.org> + +''' + +from __future__ import print_function + +from gkeyldap.cli import Main + +import os +import sys + + +# This block ensures that ^C interrupts are handled quietly. +try: + import signal + + def exithandler(signum,frame): + signal.signal(signal.SIGINT, signal.SIG_IGN) + signal.signal(signal.SIGTERM, signal.SIG_IGN) + print() + sys.exit(1) + + signal.signal(signal.SIGINT, exithandler) + signal.signal(signal.SIGTERM, exithandler) + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + +except KeyboardInterrupt: + print() + sys.exit(1) + +root = None +if 'ROOT' in os.environ: + root = os.environ['ROOT'] + +main = Main(root=root) +main() diff --git a/gkeys-ldap/bin/update-seeds.sh b/gkeys-ldap/bin/update-seeds.sh new file mode 100755 index 0000000..94852a1 --- /dev/null +++ b/gkeys-ldap/bin/update-seeds.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# $Id: update-seeds.sh,v 0.2.1 2014/10/12 dolsen Exp $ + +# configuration to run from a checkout with a custom config +cwd=$(pwd) +source ${cwd}/update-seeds.conf +source ${cwd}/testpath + +die(){ echo "$@" 1>&2; echo ""; exit 1; } +success(){ echo "$@"; echo ""; exit 0; } + +clone_api(){ + local target=dirname ${API_DIR} + cd target + git clone ${API_URL} +} + +# start update process +echo "Beginning seed file update" + +echo " *** updating api.gentoo.org repo" +# update api checkout +if [[ ! -d ${API_DIR} ]]; then + clone_api +else + cd ${API_DIR} && git pull +fi + +echo " *** Fetching new seeds from LDAP" +cd ${GKEYS_DIR} +gkey-ldap -c ${GKEYS_CONF} updateseeds || die "Seed file generation failed... aborting" + +echo " *** Checking if seed files are up-to-date" +if ! diff -q ${GKEYS_DIR}/${GKEYS_SEEDS} ${API_DIR}/${API_SEEDS} > /dev/null ;then + echo " *** Spotted differences" + echo " *** Updating old seeds with a new one" + # copy seeds to api + echo " ... cp ${GKEYS_SEEDS} ${API_DIR}/${API_SEEDS}" + cp ${GKEYS_SEEDS} ${API_DIR}/${API_SEEDS} +else + success " *** No changes detected" +fi + +echo "Signing new developers.seeds file" +gkeys -c ${GKEYS_CONF} sign -n ${GKEYS_SIGN} -F ${API_DIR}/${API_SEEDS} || die " *** Signing failed... exiting" + +echo "Committing changes to api repo..." +cd ${API_DIR} +git add ${API_SEEDS} || die " *** Failed to add modified developers.seeds file" +git add ${API_SEEDS}.${GKEYS_SIG} || die " *** Failed to add developer.seeds.sig file" +git commit -m "${GKEYS_COMMIT_MSG}" || die " *** Failed to commit updates" +git push origin master || die " *** git push failed" + +success "Successfully updated developer.seeds" + |