summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryunguowei <yunguo.wei@windriver.com>2017-08-28 00:44:00 +0800
committerLans Zhang <lans.zhang2008@gmail.com>2017-08-28 00:44:00 +0800
commita10fc38e3fa0fc5208ff226b5bfe6233daa994bc (patch)
treedf88f366246b731018249b1b1b5ca8e9e8ce93b5
parent0e6d3a3e1cc45e5c4e5ee2e3ed23f6dd919695ca (diff)
downloadmeta-secure-core-a10fc38e3fa0fc5208ff226b5bfe6233daa994bc.tar.gz
create-user-key-store.sh: Add arguments to specify gpg's key name and email address (#14)
Signed-off-by: Yunguo Wei <yunguo.wei@windriver.com>
-rwxr-xr-xmeta-signing-key/scripts/create-user-key-store.sh28
1 files changed, 27 insertions, 1 deletions
diff --git a/meta-signing-key/scripts/create-user-key-store.sh b/meta-signing-key/scripts/create-user-key-store.sh
index 12da2e7..03c10a1 100755
--- a/meta-signing-key/scripts/create-user-key-store.sh
+++ b/meta-signing-key/scripts/create-user-key-store.sh
@@ -5,6 +5,8 @@ _D=`dirname "$_S"`
5ROOT_DIR="`cd "$_D" && pwd`" 5ROOT_DIR="`cd "$_D" && pwd`"
6 6
7KEYS_DIR="$ROOT_DIR/user-keys" 7KEYS_DIR="$ROOT_DIR/user-keys"
8GPG_KEYNAME=
9GPG_EMAIL=
8 10
9function show_help() 11function show_help()
10{ 12{
@@ -20,6 +22,14 @@ Options:
20 Set the path to save the generated user keys. 22 Set the path to save the generated user keys.
21 Default: `pwd`/user-keys 23 Default: `pwd`/user-keys
22 24
25 -n <gpg key name>
26 Set the gpg's key name
27 Default: SecureCore
28
29 -m <gpg key ower's email address>
30 Set the ower's email address of the gpg key
31 Default: SecureCore@foo.com
32
23 -h|--help 33 -h|--help
24 Show this help information. 34 Show this help information.
25 35
@@ -62,6 +72,12 @@ while [ $# -gt 0 ]; do
62 -d) 72 -d)
63 shift && KEYS_DIR="$1" 73 shift && KEYS_DIR="$1"
64 ;; 74 ;;
75 -n)
76 shift && GPG_KEYNAME="$1"
77 ;;
78 -m)
79 shift && GPG_EMAIL="$1"
80 ;;
65 -h|--help) 81 -h|--help)
66 show_help `basename $0` 82 show_help `basename $0`
67 exit 0 83 exit 0
@@ -193,6 +209,16 @@ create_rpm_user_key() {
193 [ ! -d "$key_dir" ] && mkdir -m 0700 -p "$key_dir" 209 [ ! -d "$key_dir" ] && mkdir -m 0700 -p "$key_dir"
194 210
195 local gpg_key_name="SecureCore" 211 local gpg_key_name="SecureCore"
212 local gpg_email="SecureCore@foo.com"
213
214 if [ ! -z $GPG_KEYNAME ]; then
215 gpg_key_name=$GPG_KEYNAME
216 fi
217
218 if [ ! -z $GPG_EMAIL ]; then
219 gpg_email=$GPG_EMAIL
220 fi
221
196 local priv_key="$key_dir/RPM-GPG-PRIVKEY-$gpg_key_name" 222 local priv_key="$key_dir/RPM-GPG-PRIVKEY-$gpg_key_name"
197 local pub_key="$key_dir/RPM-GPG-KEY-$gpg_key_name" 223 local pub_key="$key_dir/RPM-GPG-KEY-$gpg_key_name"
198 224
@@ -214,7 +240,7 @@ Key-Type: RSA
214Key-Length: 2048 240Key-Length: 2048
215Name-Real: $gpg_key_name 241Name-Real: $gpg_key_name
216Name-Comment: RPM Signing Certificate 242Name-Comment: RPM Signing Certificate
217Name-Email: $gpg_key_name@foo.com 243Name-Email: $gpg_email
218Expire-Date: 0 244Expire-Date: 0
219%pubring $pub_key.pub 245%pubring $pub_key.pub
220%secring $priv_key.sec 246%secring $priv_key.sec