aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgkeys-ldap/bin/update-seeds.sh33
-rw-r--r--gkeys-ldap/etc/update-seeds.conf10
2 files changed, 36 insertions, 7 deletions
diff --git a/gkeys-ldap/bin/update-seeds.sh b/gkeys-ldap/bin/update-seeds.sh
index b8b4bfb..f096cb8 100755
--- a/gkeys-ldap/bin/update-seeds.sh
+++ b/gkeys-ldap/bin/update-seeds.sh
@@ -15,9 +15,23 @@ clone_api(){
git clone ${API_URL}
}
+clone_gkey_seeds(){
+ local target=dirname ${GKEY_SEEDS_DIR}
+ cd target
+ git clone ${GKEY_SEEDS_URL}
+}
+
# start update process
echo "Beginning seed file update"
+echo " *** updating gkey-seeds repo"
+# update api checkout
+if [[ ! -d ${GKEY_SEEDS_DIR} ]]; then
+ clone_gkey_seeds
+else
+ cd ${GKEY_SEEDS_DIR} && git pull
+fi
+
echo " *** updating api.gentoo.org repo"
# update api checkout
if [[ ! -d ${API_DIR} ]]; then
@@ -31,20 +45,31 @@ cd ${GKEYS_DIR}
gkeys-ldap update-seeds -C gentoo-devs || 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
+if ! diff -q ${GKEYS_DIR}/${GKEYS_SEEDS} ${GKEY_SEEDS_DIR}/${GKEY_SEEDS} > /dev/null ;then
echo " *** Spotted differences"
echo " *** Updating old seeds with a new one"
- # copy seeds to api
+ # copy seeds to gkey-seeds
echo " ... cp ${GKEYS_SEEDS} ${API_DIR}/${API_SEEDS}"
- cp ${GKEYS_SEEDS} ${API_DIR}/${API_SEEDS}
+ cp ${GKEYS_SEEDS} ${GKEY_SEEDS_DIR}/${GKEY_SEEDS}
else
success " *** No changes detected"
+ exit 0
fi
echo "Signing new developers.seeds file"
-gkeys sign -n ${GKEYS_SIGN} -F ${API_DIR}/${API_SEEDS} || die " *** Signing failed... exiting"
+gkeys sign -n ${GKEYS_SIGN} -F ${GKEY_SEEDS_DIR}/${GKEY_SEEDS} || die " *** Signing failed... exiting"
+
+echo "Committing changes to gkey-seeds repo..."
+cd ${GKEY_SEEDS_DIR}
+git add ${GKEY_SEEDS} || die " *** Failed to add modified ${GKEYS_SEEDS} file"
+git add ${GKEY_SEEDS}.${GKEYS_SIG} || die " *** Failed to add ${GKEYS_SEEDS}.sig file"
+git commit -m "${GKEYS_COMMIT_MSG}" || die " *** Failed to commit updates"
+git push origin master || die " *** git push failed"
+cd ..
echo "Committing changes to api repo..."
+cp ${GKEY_SEEDS_DIR}/${GKEY_SEEDS} ${API_DIR}/${API_SEEDS} || die " *** Failed to copy modified ${GKEYS_SEEDS} file"
+cp ${GKEY_SEEDS_DIR}/${GKEY_SEEDS}.${GKEYS_SIG} ${API_DIR}/${API_SEEDS}.${GKEYS_SIG} || die " *** Failed to copy modified ${GKEYS_SEEDS}.${GKEYS_SIG} file"
cd ${API_DIR}
git add ${API_SEEDS} || die " *** Failed to add modified ${GKEYS_SEEDS} file"
git add ${API_SEEDS}.${GKEYS_SIG} || die " *** Failed to add ${GKEYS_SEEDS}.sig file"
diff --git a/gkeys-ldap/etc/update-seeds.conf b/gkeys-ldap/etc/update-seeds.conf
index eb05c92..5b87b48 100644
--- a/gkeys-ldap/etc/update-seeds.conf
+++ b/gkeys-ldap/etc/update-seeds.conf
@@ -1,11 +1,15 @@
#!/bin/sh
-export API_DIR="/var/lib/gkeys/api"
+export GKEYS_DIR="/var/lib/gkeys"
+
+export API_DIR="${GKEYS_DIR}/api"
export API_SEEDS="files/gentoo-keys/seeds/gentoo-devs.seeds"
export API_URL="git+ssh://git@git.gentoo.org/proj/api.git"
+export GKEY_SEEDS_DIR="${GKEYS_DIR}/gkey-seeds"
+export GKEY_SEEDS="gentoo-devs.seeds"
+export GKEY_SEEDS_URL="git+ssh://git@git.gentoo.org/proj/gkey-seeds.git"
export GKEYS_COMMIT_MSG="Gentoo-keys: Update gentoo-devs.seeds"
-#export GKEYS_CONF="/var/lib/gkeys/gkeys.conf"
-export GKEYS_DIR="/var/lib/gkeys"
+#export GKEYS_CONF="${GKEYS_DIR}/gkeys.conf"
export GKEYS_SEEDS="seeds/gentoo-devs.seeds"
export GKEYS_SIG="sig"
export GKEYS_SIGN="gkeys"