|
1 | 1 | #!/bin/bash
|
2 | 2 | set -e -o pipefail
|
3 | 3 | . /etc/functions
|
| 4 | +. /etc/gui_functions |
4 | 5 |
|
5 | 6 | TRACE_FUNC
|
6 | 7 |
|
7 | 8 | # Post processing of keys
|
8 | 9 |
|
9 |
| -# Import user's keys |
10 |
| -gpg --import /.gnupg/keys/*.key /.gnupg/keys/*.asc 2>/dev/null || true |
| 10 | +# Good system clock is required for GPG to work properly. |
| 11 | +# if system year is less then 2024, prompt user to set correct time |
| 12 | +if [ "$(date +%Y)" -lt 2024 ]; then |
| 13 | + if whiptail_warning --title "System Time Incorrect" \ |
| 14 | + --yesno "The system time is incorrect. Please set the correct time." \ |
| 15 | + 0 80 --yes-button Continue --no-button Skip --clear; then |
| 16 | + change-time.sh |
| 17 | + fi |
| 18 | +fi |
| 19 | + |
| 20 | +# Import user's keys if they exist |
| 21 | +if [ -d /.gnupg/keys ]; then |
| 22 | + # This is legacy location for user's keys. cbfs-init takes for granted that keyring and trustdb are in /.gnupg |
| 23 | + # oem-factory-reset generates keyring and trustdb which cbfs-init dumps to /.gnupg |
| 24 | + # TODO: Remove individual key imports. This is still valid for distro keys only below. |
| 25 | + gpg --import /.gnupg/keys/*.key /.gnupg/keys/*.asc 2>/dev/null || warn "Importing user's keys failed" |
| 26 | +fi |
11 | 27 |
|
12 | 28 | # Import trusted distro keys allowed for ISO signing
|
13 |
| -gpg --homedir=/etc/distro/ --import /etc/distro/keys/* 2>/dev/null || true |
| 29 | +gpg --homedir=/etc/distro/ --import /etc/distro/keys/* 2>/dev/null || warn "Importing distro keys failed" |
14 | 30 | #Set distro keys trust level to ultimate (trust anything that was signed with these keys)
|
15 |
| -gpg --homedir=/etc/distro/ --list-keys --fingerprint --with-colons|sed -E -n -e 's/^fpr:::::::::([0-9A-F]+):$/\1:6:/p' |gpg --homedir=/etc/distro/ --import-ownertrust 2>/dev/null || true |
16 |
| -gpg --homedir=/etc/distro/ --update-trust 2>/dev/null || true |
| 31 | +gpg --homedir=/etc/distro/ --list-keys --fingerprint --with-colons|sed -E -n -e 's/^fpr:::::::::([0-9A-F]+):$/\1:6:/p' |gpg --homedir=/etc/distro/ --import-ownertrust 2>/dev/null || warn "Setting distro keys ultimate trust failed" |
| 32 | +gpg --homedir=/etc/distro/ --update-trust 2>/dev/null || warn "Updating distro keys trust failed" |
17 | 33 |
|
18 | 34 | # Add user's keys to the list of trusted keys for ISO signing
|
19 |
| -gpg --export | gpg --homedir=/etc/distro/ --import 2>/dev/null || true |
| 35 | +gpg --export | gpg --homedir=/etc/distro/ --import 2>/dev/null || warn "Adding user's keys to distro keys failed" |
0 commit comments