diff options
Diffstat (limited to 'src/keygen.sh')
-rwxr-xr-x | src/keygen.sh | 35 |
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 | |||
3 | gpg_set_ultimate_trust() | 2 | gpg_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() | |||
54 | doublecheck() | 53 | doublecheck() |
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 | ||
61 | silent() | 60 | silent() |
@@ -77,18 +76,19 @@ noisy() | |||
77 | 76 | ||
78 | new_child() | 77 | new_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 | ||
91 | ls -lL "$(which kiki)" | ||
92 | 92 | ||
93 | child_dir=$1 | 93 | child_dir=$1 |
94 | 94 | ||
@@ -102,9 +102,16 @@ mkdir "$child_dir" | |||
102 | trap -- 'umount "$child_dir"; rmdir "$child_dir"' EXIT | 102 | trap -- 'umount "$child_dir"; rmdir "$child_dir"' EXIT |
103 | mount -t tmpfs -o mode=0700 tmpfs "$child_dir" | 103 | mount -t tmpfs -o mode=0700 tmpfs "$child_dir" |
104 | 104 | ||
105 | if [ "$PARENT_ROOT" ] | ||
106 | then | ||
107 | parent_root=$PARENT_ROOT | ||
108 | else | ||
109 | parent_root= | ||
110 | fi | ||
111 | |||
105 | silent | 112 | silent |
106 | init | 113 | init "$parent_root" |
107 | new_child "$child_dir" | 114 | new_child "$child_dir" "$parent_root" |
108 | noisy | 115 | noisy |
109 | 116 | ||
110 | trap EXIT | 117 | trap EXIT |