diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-07-23 06:38:52 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-07-23 06:38:52 +0000 |
commit | c6bb16a9f97008e1663cf99eba900d82ee9559b9 (patch) | |
tree | cdc12d262c81bb36f0276f06fb7abc964fdbed6b /abuild-keygen.in | |
parent | 571e0567110dcc5737898a6ff5721ae6c10bfbb4 (diff) | |
download | abuild-c6bb16a9f97008e1663cf99eba900d82ee9559b9.tar.bz2 abuild-c6bb16a9f97008e1663cf99eba900d82ee9559b9.tar.xz |
abuild-keygen: use -a to add the needed config setting
So basicly, running 'abuild-keygen -a -i' will be all you need to do to
be able to use abuild-sign and install the signed packages.
Diffstat (limited to 'abuild-keygen.in')
-rw-r--r-- | abuild-keygen.in | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/abuild-keygen.in b/abuild-keygen.in index 65737f0..29e9b40 100644 --- a/abuild-keygen.in +++ b/abuild-keygen.in @@ -20,6 +20,7 @@ usage() { echo "abuild-keygen $abuild_ver" echo "usage: abuild-keygen [-ih]" echo "options:" + echo " -a Set PACKAGER_PRIVKEY=<generated key> in $abuild_userconf" echo " -i Install public key into /etc/apk/keys using sudo" echo " -h Show this help" echo "" @@ -46,8 +47,9 @@ else default_name="$USER" fi -while getopts "hi" opt; do +while getopts "ahi" opt; do case $opt in + a) append_config=yes;; h) usage;; i) install_pubkey=yes; esac @@ -69,7 +71,7 @@ pubkey="$privkey.pub" # generate the private key in a subshell with stricter umask ( -umask 0077 +umask 0007 openssl genrsa -out "$privkey" 2048 ) openssl rsa -in "$privkey" -pubout -out "$pubkey" @@ -87,7 +89,22 @@ else echo "$privkey" fi +if [ -n "$append_config" ]; then + if [ -f "$abuild_userconf" ]; then + # comment out the existing values + sed -i -e 's/^\(PACKAGER_PRIVKEY=.*\)/\#\1/' "$abuild_userconf" + fi + echo "PACKAGER_PRIVKEY=\"$privkey\"" >> "$abuild_userconf" +else + echo "" + echo "You might want add following line to $abuild_userconf:" + echo "" + echo "PACKAGER_PRIVKEY=\"$privkey\"" + echo "" +fi + echo "" -echo "Please remember to make a safe backup of $privkey" +echo "Please remember to make a safe backup of your private key:" +echo "$privkey" echo "" |