-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
preparation_before_release.sh
executable file
·107 lines (96 loc) · 3.83 KB
/
preparation_before_release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script will install and configure GPG key.
set -e
LOCAL_SVN_DIR=local_svn_dir
ROOT_SVN_URL=https://dist.apache.org/repos/dist/
DEV_REPO=dev
RELEASE_REPO=release
BEAM_REPO=beam
cd ~
echo "=================Checking GPG Key===================="
echo "You need a GPG key which reflects your Apache account."
echo "Do you want to generate a new GPG key associated with your Apache account? [y|N]"
read confirmation
if [[ $confirmation = "y" ]]; then
echo "===============Generating new GPG key================"
sudo apt-get install rng-tools # Get more entropy for creating a GPG key.
sudo rngd -r /dev/urandom
echo "NOTE: When creating the key, please select the type to be RSA and RSA (default), and the size to be 4096 bit long."
gpg --full-generate-key
fi
echo "================Listing all GPG keys================="
gpg --list-keys
echo "Please copy the public key which is associated with your Apache account:"
read pub_key
echo "===========Configuring git signing key==============="
git config --global user.signingkey $pub_key
git config --list
echo "===========Adding your key into KEYS file============"
echo "It's required to append your key into KEYS file in dist.apache.org"
echo "Have you put your key in KEYS? [y|N]"
read confirmation
if [[ $confirmation != "y" ]]; then
echo "Please input your name: "
read name
echo "======Starting updating KEYS file in dev repo===="
if [[ -d ${LOCAL_SVN_DIR} ]]; then
rm -rf ${LOCAL_SVN_DIR}
fi
mkdir ${LOCAL_SVN_DIR}
cd ${LOCAL_SVN_DIR}
svn co ${ROOT_SVN_URL}/${DEV_REPO}/${BEAM_REPO}
cd ${BEAM_REPO}
(gpg --list-sigs ${name} && gpg --armor --export ${name}) >> KEYS
svn status
echo "Please review all changes. Do you confirm to commit? [y|N]"
read commit_confirmation
if [[ $commit_confirmation = "y" ]]; then
svn commit --no-auth-cache KEYS
else
echo "Not commit new changes into ${ROOT_SVN_URL}${DEV_REPO}/${BEAM_REPO}/KEYS"
fi
cd ~
rm -rf ${LOCAL_SVN_DIR}/${BEAM_REPO}
echo "Only a PMC member can write into dist.apache.org's release KEYS. Are you a PMC member? [y|N]"
read pmc_permission
if [[ $pmc_permission != "y" ]]; then
echo "Please ask a PMC member to help you add your key in dev@ list."
echo "Skip adding key into ${ROOT_SVN_URL}${RELEASE_REPO}/${BEAM_REPO}/KEYS"
else
cd ~/${LOCAL_SVN_DIR}
echo "===Starting updating KEYS file in release repo==="
svn co ${ROOT_SVN_URL}/${RELEASE_REPO}/${BEAM_REPO}
cd ${BEAM_REPO}
(gpg --list-sigs ${name} && gpg --armor --export ${name}) >> KEYS
svn status
echo "Please review all changes. Do you confirm to commit? [y|N]"
read commit_confirmation
if [[ $commit_confirmation = "y" ]]; then
svn commit --no-auth-cache KEYS
else
echo "Not commit new changes into ${ROOT_SVN_URL}/${DEV_REPO}/${BEAM_REPO}${RELEASE_REPO}/KEYS"
fi
fi
cd ~
rm -rf ${LOCAL_SVN_DIR}
fi
echo "================Setting up gpg agent================="
eval $(gpg-agent --daemon --no-grab --write-env-file $HOME/.gpg-agent-info)
export GPG_TTY=$(tty)
export GPG_AGENT_INFO