diff --git a/initrd/bin/oem-factory-reset b/initrd/bin/oem-factory-reset index f0707a0c..594b0b2a 100755 --- a/initrd/bin/oem-factory-reset +++ b/initrd/bin/oem-factory-reset @@ -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"