Gentoo Archives: gentoo-commits

From: Brian Dolbec <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys-ldap/bin/
Date: Sat, 07 Jul 2018 05:24:06
Message-Id: 1530940934.0cef7485299fc61aea928eeb669fcfb7cbaa55fb.dolsen@gentoo
1 commit: 0cef7485299fc61aea928eeb669fcfb7cbaa55fb
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jul 4 23:49:47 2018 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 7 05:22:14 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=0cef7485
7
8 gkeys-ldap updateseeds.sh: Shellcheck cleanup
9
10 Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>
11
12 gkeys-ldap/bin/update-seeds.sh | 52 +++++++++++++++++++++---------------------
13 1 file changed, 26 insertions(+), 26 deletions(-)
14
15 diff --git a/gkeys-ldap/bin/update-seeds.sh b/gkeys-ldap/bin/update-seeds.sh
16 index a2e0f87..a29de66 100755
17 --- a/gkeys-ldap/bin/update-seeds.sh
18 +++ b/gkeys-ldap/bin/update-seeds.sh
19 @@ -1,4 +1,4 @@
20 -#!/bin/sh
21 +#!/bin/bash
22 # $Id: update-seeds.sh,v 0.2.1 2014/10/12 dolsen Exp $
23
24 FORCE=${1}
25 @@ -6,22 +6,22 @@ HAS_UPDATES=false
26
27 # configuration to run from a checkout with a custom config
28 cwd=$(pwd)
29 -source ${cwd}/update-seeds.conf
30 -source ${cwd}/testpath
31 +source "${cwd}/update-seeds.conf"
32 +source "${cwd}/testpath"
33
34 die(){ echo "$@" 1>&2; exit 1; }
35 success(){ echo "$@"; exit 0; }
36
37 clone_api(){
38 - local target=dirname ${API_DIR}
39 - cd target
40 - git clone ${API_URL}
41 + local target=dirname "${API_DIR}"
42 + cd target || die " *** Failed to change directory... exiting"
43 + git clone "${API_URL}"
44 }
45
46 clone_gkey_seeds(){
47 - local target=dirname ${GKEY_SEEDS_DIR}
48 - cd target
49 - git clone ${GKEY_SEEDS_URL}
50 + local target=dirname "${GKEY_SEEDS_DIR}"
51 + cd target || die " *** Failed to change directory... exiting"
52 + git clone "${GKEY_SEEDS_URL}"
53 }
54
55 # start update process
56 @@ -29,56 +29,56 @@ echo "Beginning seed file update"
57
58 echo " *** updating gkey-seeds repo"
59 # update api checkout
60 -if [[ ! -d ${GKEY_SEEDS_DIR} ]]; then
61 +if [[ ! -d "${GKEY_SEEDS_DIR}" ]]; then
62 clone_gkey_seeds
63 else
64 - cd ${GKEY_SEEDS_DIR} && git pull
65 + cd "${GKEY_SEEDS_DIR}" && git pull
66 fi
67
68 echo " *** updating api.gentoo.org repo"
69 # update api checkout
70 -if [[ ! -d ${API_DIR} ]]; then
71 +if [[ ! -d "${API_DIR}" ]]; then
72 clone_api
73 else
74 - cd ${API_DIR} && git pull
75 + cd "${API_DIR}" && git pull
76 fi
77
78 echo " *** Fetching new seeds from LDAP"
79 -cd ${GKEYS_DIR}
80 +cd "${GKEYS_DIR}" || die " *** Failed to change directory... exiting"
81 gkeys-ldap update-seeds -C gentoo-devs || die "Seed file generation failed... aborting"
82
83 echo " *** Checking if seed files are up-to-date"
84 -if ! diff -q ${GKEYS_DIR}/${GKEYS_SEEDS} ${GKEY_SEEDS_DIR}/${GKEY_SEEDS} > /dev/null ;then
85 +if ! diff -q "${GKEYS_DIR}/${GKEYS_SEEDS}" "${GKEY_SEEDS_DIR}/${GKEY_SEEDS}" > /dev/null ;then
86 HAS_UPDATES=true
87 fi
88 -if [[ "${FORCE}" == "force" || ${HAS_UPDATES} ]] ; then
89 +if [[ "${FORCE}" == "force" || "${HAS_UPDATES}" ]] ; then
90 echo " *** Spotted differences"
91 echo " *** Updating old seeds with a new one"
92 # copy seeds to gkey-seeds
93 echo " ... cp ${GKEYS_SEEDS} ${API_DIR}/${API_SEEDS}"
94 - cp ${GKEYS_SEEDS} ${GKEY_SEEDS_DIR}/${GKEY_SEEDS}
95 + cp "${GKEYS_SEEDS}" "${GKEY_SEEDS_DIR}/${GKEY_SEEDS}"
96 else
97 success " *** No changes detected"
98 exit 0
99 fi
100
101 echo "Signing new developers.seeds file"
102 -gkeys sign -n ${GKEYS_SIGN} -F ${GKEY_SEEDS_DIR}/${GKEY_SEEDS} || die " *** Signing failed... exiting"
103 +gkeys sign -n "${GKEYS_SIGN}" -F "${GKEY_SEEDS_DIR}/${GKEY_SEEDS}" || die " *** Signing failed... exiting"
104
105 echo "Committing changes to gkey-seeds repo..."
106 -cd ${GKEY_SEEDS_DIR}
107 -git add ${GKEY_SEEDS} || die " *** Failed to add modified ${GKEYS_SEEDS} file"
108 -git add ${GKEY_SEEDS}.${GKEYS_SIG} || die " *** Failed to add ${GKEYS_SEEDS}.sig file"
109 +cd "${GKEY_SEEDS_DIR}" || die " *** Failed to change directory... exiting"
110 +git add "${GKEY_SEEDS}" || die " *** Failed to add modified ${GKEYS_SEEDS} file"
111 +git add "${GKEY_SEEDS}.${GKEYS_SIG}" || die " *** Failed to add ${GKEYS_SEEDS}.sig file"
112 git commit -S -m"${GKEYS_COMMIT_MSG}" || die " *** Failed to commit updates"
113 git push --signed origin master || die " *** git push failed"
114 cd ..
115
116 echo "Committing changes to api repo..."
117 -cp ${GKEY_SEEDS_DIR}/${GKEY_SEEDS} ${API_DIR}/${API_SEEDS} || die " *** Failed to copy modified ${GKEYS_SEEDS} file"
118 -cp ${GKEY_SEEDS_DIR}/${GKEY_SEEDS}.${GKEYS_SIG} ${API_DIR}/${API_SEEDS}.${GKEYS_SIG} || die " *** Failed to copy modified ${GKEYS_SEEDS}.${GKEYS_SIG} file"
119 -cd ${API_DIR}
120 -git add ${API_SEEDS} || die " *** Failed to add modified ${GKEYS_SEEDS} file"
121 -git add ${API_SEEDS}.${GKEYS_SIG} || die " *** Failed to add ${GKEYS_SEEDS}.sig file"
122 +cp "${GKEY_SEEDS_DIR}/${GKEY_SEEDS}" "${API_DIR}/${API_SEEDS}" || die " *** Failed to copy modified ${GKEYS_SEEDS} file"
123 +cp "${GKEY_SEEDS_DIR}/${GKEY_SEEDS}.${GKEYS_SIG}" "${API_DIR}/${API_SEEDS}.${GKEYS_SIG}" || die " *** Failed to copy modified ${GKEYS_SEEDS}.${GKEYS_SIG} file"
124 +cd "${API_DIR}" || die " *** Failed to change directory... exiting"
125 +git add "${API_SEEDS}" || die " *** Failed to add modified ${GKEYS_SEEDS} file"
126 +git add "${API_SEEDS}.${GKEYS_SIG}" || die " *** Failed to add ${GKEYS_SEEDS}.sig file"
127 git commit -S -m "${GKEYS_COMMIT_MSG}" || die " *** Failed to commit updates"
128 git push --signed origin master || die " *** git push failed"