2023-02-08 21:01:48 +00:00
|
|
|
#!/bin/bash
|
2018-04-30 02:58:44 +00:00
|
|
|
set -e -o pipefail
|
|
|
|
. /etc/functions
|
2024-09-06 12:44:11 +00:00
|
|
|
. /etc/gui_functions
|
2018-04-30 02:58:44 +00:00
|
|
|
|
2024-02-01 19:30:31 +00:00
|
|
|
TRACE_FUNC
|
2023-02-18 17:58:43 +00:00
|
|
|
|
2018-04-30 02:58:44 +00:00
|
|
|
# Post processing of keys
|
2018-05-18 02:52:11 +00:00
|
|
|
|
2024-09-03 18:28:45 +00:00
|
|
|
# Good system clock is required for GPG to work properly.
|
|
|
|
# if system year is less then 2024, prompt user to set correct time
|
|
|
|
if [ "$(date +%Y)" -lt 2024 ]; then
|
2024-09-06 12:44:11 +00:00
|
|
|
if whiptail_warning --title "System Time Incorrect" \
|
|
|
|
--yesno "The system time is incorrect. Please set the correct time." \
|
|
|
|
0 80 --yes-button Continue --no-button Skip --clear; then
|
|
|
|
change-time.sh
|
|
|
|
fi
|
2024-09-03 18:28:45 +00:00
|
|
|
fi
|
|
|
|
|
2024-09-03 18:49:42 +00:00
|
|
|
# Import user's keys if they exist
|
|
|
|
if [ -d /.gnupg/keys ]; then
|
|
|
|
# This is legacy location for user's keys. cbfs-init takes for granted that keyring and trustdb are in /.gnupg
|
|
|
|
# oem-factory-reset generates keyring and trustdb which cbfs-init dumps to /.gnupg
|
|
|
|
# TODO: Remove individual key imports. This is still valid for distro keys only below.
|
|
|
|
gpg --import /.gnupg/keys/*.key /.gnupg/keys/*.asc 2>/dev/null || warn "Importing user's keys failed"
|
|
|
|
fi
|
2018-04-30 02:58:44 +00:00
|
|
|
|
2018-05-18 02:52:11 +00:00
|
|
|
# Import trusted distro keys allowed for ISO signing
|
2024-09-03 18:28:45 +00:00
|
|
|
gpg --homedir=/etc/distro/ --import /etc/distro/keys/* 2>/dev/null || warn "Importing distro keys failed"
|
2019-02-08 17:38:38 +00:00
|
|
|
#Set distro keys trust level to ultimate (trust anything that was signed with these keys)
|
2024-09-03 18:28:45 +00:00
|
|
|
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"
|
|
|
|
gpg --homedir=/etc/distro/ --update-trust 2>/dev/null || warn "Updating distro keys trust failed"
|
2019-02-08 17:38:38 +00:00
|
|
|
|
2018-05-18 02:52:11 +00:00
|
|
|
# Add user's keys to the list of trusted keys for ISO signing
|
2024-09-03 18:28:45 +00:00
|
|
|
gpg --export | gpg --homedir=/etc/distro/ --import 2>/dev/null || warn "Adding user's keys to distro keys failed"
|