3 # A script to setup your git area to contribute back to SXEmacs
5 # (C) 2008 Nelson Ferreira
7 # This program is free software; you can redistribute it and/or modify it
8 # under a BSD-like licence.
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions are met:
12 # Redistributions of source code must retain the above copyright notice, this
13 # list of conditions and the following disclaimer.
14 # Redistributions in binary form must reproduce the above copyright notice,
15 # this list of conditions and the following disclaimer in the documentation
16 # and/or other materials provided with the distribution.
17 # Neither the name of the Technical University of Berlin nor the names of its
18 # contributors may be used to endorse or promote products derived from this
19 # software without specific prior written permission.
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 # POSSIBILITY OF SUCH DAMAGE.
33 echo "If you have any questions or concerns about how to contribute "
34 echo "to SXEmacs, ask us on freenode channel #sxemacs"
35 USER_EMAIL=$(git config user.email)
36 if [ -z "$USER_EMAIL" ]; then
37 echo "You need to setup your email address with:"
38 echo " git config user.email <your email address>"
41 USER_NAME=$(git config user.name)
42 if [ -z "$USER_NAME" ]; then
43 echo "You need to configure git with your name:"
44 echo " git config user.name \"John Doe\""
47 git branch --track for-steve origin/master
48 git checkout for-steve
49 if ! type gpg > dev/null 2>&1 ; then
50 echo "MANDATORY: Please install gpg and create/install your private key."
54 SIGNKEY=$(git config user.signingkey)
55 if [ -z "$SIGNKEY" ]; then
56 KEYGUESS=$(gpg --list-keys $USER_EMAIL |\
57 awk '/^pub/ { split($2,k,"/"); print k[2] }')
58 echo "You need to setup your GPG signing key:"
59 echo " git config user.signingkey ${KEYGUESS:-<GPG key signature>}"
62 CO_ALIAS=$(git config alias.co)
63 if [ -z "$CO_ALIAS" ]; then
64 echo "RECOMMENDED: It is recommended you define the 'co' alias"
65 echo " to quickly switch betwen the master and "
66 echo " for-steve branches."
67 echo " git config alias.co checkout"
69 REMOTE=$(git remote | grep -v origin)
71 for word in $(git config user.name); do
72 INITIALS="${INITIALS}$(echo $w | cut -c1)"
74 DEVKEYTAG=$(git show devkey.$INITIALS | grep Tagger | sed 's/^Tagger: //')
75 EXPECTEDTAG="$USER_NAME <$USER_EMAIL>"
76 if [ -z "$DEVKEYTAG" ]; then
77 echo "RECOMMENDED: It is recommended you tag (and push) your "
78 echo " GPG public key as devkey.${INITIALS}:"
80 echo " git tag -s devkey.$INITIALS \ "
81 echo " -m 'Public key for $USER_NAME <$USER_EMAIL>' \ "
82 echo " $(gpg --armor --export $USER_EMAL | \ "
83 echo " git hash-object -w --stdin)"
85 echo "Don't forget to push the tag to your remote:"
86 echo " git push <myremote> devkey.${INITIALS}"
88 elif [ "$DEVKEYTAG" != "EXPECTEDTAG" ]; then
89 LONGDEVKEYTAG=$(git show devkey.$INITIALS.$SIGNKEY | grep Tagger)
90 if [ -z "$LONGDEVKEYTAG" ]; then
91 echo "It seems there is someone else using your initials for a key:"
93 echo "RECOMMENDED: It is recommended you tag (and push) your "
94 echo " GPG public key as devkey.${INITIALS}.${SIGNKEY}:"
96 echo " git tag -s devkey.${INITIALS}.${SIGNKEY} \ "
97 echo " -m 'Public key for $USER_NAME <$USER_EMAIL>' \ "
98 echo " $(gpg --armor --export $USER_EMAL | \ "
99 echo " git hash-object -w --stdin)"
101 echo "Don't forget to push the tag to your remote:"
102 echo " git push <myremote> devkey.${INITIALS}.${SIGNKEY}"
104 MAINTAINER=$(git show maintaner-pgp | grep Tagger | sed 's/^Tagger: //')
105 if ! gpg list-keys "$MAINTAINER" > /devnull 2>&1 ; then
106 echo "RECOMMENDED: You should import the maintainers key to your "
107 echo " key ring so you can verify objects on the repository"
108 echo " git show maintainer-pgp | gpg --import"
111 if [ -z "$REMOTE" ]; then
112 echo "MANDATORY: You now must configure your remote repository "
113 echo " location using:"
114 echo " git remote add <myremote> <repository location>"
116 echo " We recommend that you use 'myremote' explicitly"
117 echo " for the remote name, but it can be whatever name"
118 echo " you wish, except origin"
119 echo " The repository location can be either a git server"
120 echo " git://example.com/sxemacs.git"
121 echo " or an ssh accessible location:"
122 echo " ssh://user@example.com/~/path/to/git"
123 echo " in this last case it is VERY convenient that you "
124 echo " setup SSH public key authentication."
126 echo "Please verify that one of these remotes is for your SXEmacs "
127 echo "public repository"
133 echo "Make sure to read the SPPM for more information."
134 echo "Info node: (sppm)Setting up a publicly accessible repo"