summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/keygen.sh35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/keygen.sh b/src/keygen.sh
index 5b48512..90237af 100755
--- a/src/keygen.sh
+++ b/src/keygen.sh
@@ -1,5 +1,4 @@
1#!/bin/sh 1#!/bin/sh
2
3gpg_set_ultimate_trust() 2gpg_set_ultimate_trust()
4{ 3{
5 local keygrip 4 local keygrip
@@ -28,8 +27,8 @@ init()
28 fi 27 fi
29 28
30 kiki init ${root:+--chroot "$root"} 29 kiki init ${root:+--chroot "$root"}
31 add encrypt ${root:+"$root/root/.gnupg"} 30 # add encrypt ${root:+"$root/root/.gnupg"}
32 add sign ${root:+"$root/root/.gnupg"} 31 # add sign ${root:+"$root/root/.gnupg"}
33 32
34 ( 33 (
35 [ "$root" ] && export GNUPGHOME="$root/root/.gnupg/" 34 [ "$root" ] && export GNUPGHOME="$root/root/.gnupg/"
@@ -54,8 +53,8 @@ sync()
54doublecheck() 53doublecheck()
55{ 54{
56 local o='--ignore-time-conflict' 55 local o='--ignore-time-conflict'
57 gpg2 $o --clearsign </dev/null | gpg2 $o --homedir "$1"/root/.gnupg --verify 56 gpg2 $o --clearsign --homedir "$2"/root/.gnupg </dev/null | gpg2 $o --homedir "$1"/root/.gnupg --verify
58 gpg2 $o --clearsign --homedir "$1"/root/.gnupg </dev/null | gpg2 $o --verify 57 gpg2 $o --clearsign --homedir "$1"/root/.gnupg </dev/null | gpg2 $o --homedir "$2"/root/.gnupg --verify
59} 58}
60 59
61silent() 60silent()
@@ -77,18 +76,19 @@ noisy()
77 76
78new_child() 77new_child()
79{ 78{
80 local root="$1" 79 local child_root="$1" parent_root="$2"
81 init "$root" 80 init "$child_root"
82 81
83 sync "$root" '' 82 sync "$child_root" "$parent_root"
84 sync '' "$root" 83 sync "$parent_root" "$child_root"
85 84
86 gpg2 --check-trustdb 85 gpg2 --check-trustdb --homedir "$parent_root"/root/.gnupg
87 gpg2 --check-trustdb --homedir "$root"/root/.gnupg 86 gpg2 --check-trustdb --homedir "$child_root"/root/.gnupg
88 87
89 doublecheck "$root" 88 doublecheck "$child_root" "$parent_root"
90} 89}
91 90
91ls -lL "$(which kiki)"
92 92
93child_dir=$1 93child_dir=$1
94 94
@@ -102,9 +102,16 @@ mkdir "$child_dir"
102trap -- 'umount "$child_dir"; rmdir "$child_dir"' EXIT 102trap -- 'umount "$child_dir"; rmdir "$child_dir"' EXIT
103mount -t tmpfs -o mode=0700 tmpfs "$child_dir" 103mount -t tmpfs -o mode=0700 tmpfs "$child_dir"
104 104
105if [ "$PARENT_ROOT" ]
106then
107 parent_root=$PARENT_ROOT
108else
109 parent_root=
110fi
111
105silent 112silent
106init 113init "$parent_root"
107new_child "$child_dir" 114new_child "$child_dir" "$parent_root"
108noisy 115noisy
109 116
110trap EXIT 117trap EXIT