aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2014-10-12 20:44:17 -0700
committerBrian Dolbec <dolsen@gentoo.org>2014-10-16 12:03:50 -0700
commitbe64b35550eec6f1c3fbe3ab241d5f2a08a0f676 (patch)
tree6bf3fb2f9de4fce1c8c1337f4dfe69a7f9fab9d3 /bin
parentgkeys/config.py: Prevent tracebacks for key not in the options or defaults (diff)
downloadgentoo-keys-be64b35550eec6f1c3fbe3ab241d5f2a08a0f676.tar.gz
gentoo-keys-be64b35550eec6f1c3fbe3ab241d5f2a08a0f676.tar.bz2
gentoo-keys-be64b35550eec6f1c3fbe3ab241d5f2a08a0f676.zip
gkeyldap: Initial commit of an update-seeds script and config
Chmod update-seeds.sh Remove extra whitespace, sort option settings.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/update-seeds.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/bin/update-seeds.sh b/bin/update-seeds.sh
new file mode 100755
index 0000000..94852a1
--- /dev/null
+++ b/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"
+