mirror of
https://github.com/linuxboot/heads.git
synced 2025-01-30 08:03:55 +00:00
Remove gnupg pubkey export in oem-factory-reset
Since #758 is merged, users have a option to export GnuPG pubkey if necessary. Thus, we they do not need to insert a USB drive during factory reset. Until now the whole process failed just because a user did not provide a USB drive instead. This shall be fixed by this commit
This commit is contained in:
parent
8dc5b7616a
commit
19cd15cf96
@ -311,21 +311,11 @@ if [ "$prompt_output" == "y" \
|
||||
};done
|
||||
fi
|
||||
|
||||
## sanity check the USB, GPG key, and boot device before proceeding further
|
||||
|
||||
# mount USB, then remount rw
|
||||
echo -e "\nChecking for USB media...\n"
|
||||
# ensure /media not mounted
|
||||
umount /media 2>/dev/null
|
||||
# mount-usb will detect and prompt if no USB inserted
|
||||
if ! mount-usb rw 2>/tmp/error; then
|
||||
ERROR=$(tail -n 1 /tmp/error)
|
||||
whiptail_error_die "Unable to mount USB on /media:\n\n${ERROR}"
|
||||
fi
|
||||
## sanity check the GPG key, and boot device before proceeding further
|
||||
|
||||
# ensure GPG key connected
|
||||
echo -e "\nChecking for GPG Key...\n"
|
||||
# USB kernel modules already loaded via mount-usb
|
||||
enable_usb
|
||||
if ! gpg --card-status >/dev/null 2>&1 ; then
|
||||
whiptail_error "Can't access GPG Key; remove and reinsert, then press Enter to retry."
|
||||
if ! gpg --card-status >/dev/null 2>/tmp/error ; then
|
||||
@ -381,19 +371,12 @@ if [ "$CUSTOM_PASS" != "" ]; then
|
||||
ADMIN_PIN_DEF=$CUSTOM_PASS
|
||||
fi
|
||||
|
||||
## export generated key to USB
|
||||
echo -e "\nExporting generated key to USB...\n"
|
||||
# export pubkey to file
|
||||
echo -e "\nExporting generated key...\n"
|
||||
if ! gpg --export --armor $GPG_GEN_KEY > "${PUBKEY}" 2>/tmp/error ; then
|
||||
ERROR=$(tail -n 1 /tmp/error)
|
||||
whiptail_error_die "GPG Key gpg export to file failed!\n\n$ERROR"
|
||||
fi
|
||||
# copy to USB
|
||||
if ! cp "${PUBKEY}" "/media/${GPG_GEN_KEY}.asc" 2>/tmp/error ; then
|
||||
ERROR=$(tail -n 1 /tmp/error)
|
||||
whiptail_error_die "Key export error: unable to copy ${GPG_GEN_KEY}.asc to /media:\n\n$ERROR"
|
||||
fi
|
||||
umount /media 2>/dev/null
|
||||
|
||||
## flash generated key to ROM
|
||||
echo -e "\nReading current firmware...\n(this will take a minute or two)\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user