Compare commits

..

No commits in common. "93beadb519ca7f83a1f7f9a1f6e4d0b3605cb6c3" and "42e9b6bd7f5a67e8506cee25431ab29f67f1f743" have entirely different histories.

View File

@ -172,10 +172,8 @@ case "$operation_system" in
;;
esac
info "Verifying image..."
info "Verifying checksum..."
if [ -z "$image_checksum" ]; then
for ext in sha1 sha512 md5; do
for ext in sha1 sha512; do
sha_download_url="$download_url.$ext"
info "Image Checksum is not defined. Try to download image signature from $sha_download_url."
if wget -q --method=HEAD "$sha_download_url"; then
@ -188,6 +186,7 @@ if [ -z "$image_checksum" ]; then
done
fi
info "Verifying image..."
if [[ -v image_checksum ]]
then
(info "Checking md5 checksum..." && echo "$image_checksum $image_path"| md5sum -c -) ||
@ -198,45 +197,6 @@ if [[ -v image_checksum ]]
warning "Verification is not possible. No checksum is defined."
fi
info "Verifying signature..."
signature_download_url="$download_url.sig"
info "Try to download image signature from $signature_download_url."
if wget -q --method=HEAD "$signature_download_url"; then
signature_name="${image_name}.sig"
signature_path="${image_folder}${signature_name}"
info "Download the signature file"
if wget -q -O "$signature_path" "$signature_download_url"; then
info "Extract the key ID from the signature file"
key_id=$(gpg --status-fd 1 --verify "$signature_path" "$image_path" 2>&1 | grep 'NO_PUBKEY' | awk '{print $NF}')
if [ -n "$key_id" ]; then
info "Check if the key is already in the keyring"
if gpg --list-keys "$key_id" > /dev/null 2>&1; then
info "Key $key_id already in keyring."
else
info "Import the public key"
gpg --keyserver keyserver.ubuntu.com --recv-keys "$key_id"
fi
info "Verify the signature again after importing the key"
if gpg --verify "$signature_path" "$image_path"; then
info "Signature verification succeeded."
else
warning "Signature verification failed."
fi
else
warning "No public key found in the signature file."
fi
else
warning "Failed to download the signature file."
fi
else
warning "No signature found under $signature_download_url."
fi
make_mount_folders
set_partition_paths
@ -261,36 +221,23 @@ if [ "$transfer_image" = "y" ]
info "Starting image transfer..."
if [ "$distribution" = "arch" ]
then
# Default size of the boot partition
default_boot_size="+300M"
# Prompt to adjust the boot partition size
question "What size should the boot partition be? (Default: $default_boot_size):" && read -r boot_size
boot_size=${boot_size:-$default_boot_size}
# Use the provided size or the default size
info "The boot partition will be set to $boot_size."
# Partitioning with the specified size
info "Creating partitions..." &&
(
echo "o" # Type o. This will clear out any partitions on the drive.
echo "p" # Type p to list partitions. There should be no partitions left
echo "n" # Type n,
echo "p" # then p for primary,
echo "1" # 1 for the first partition on the drive,
echo "" # Default start sector
echo "$boot_size" # Size of the boot partition
echo "t" # Type t,
echo "c" # then c to set the first partition to type W95 FAT32 (LBA).
echo "n" # Type n,
echo "p" # then p for primary,
echo "2" # 2 for the second partition on the drive,
echo "" # Default start sector
echo "" # Default end sector
echo "w" # Write the partition table and exit by typing w.
) | fdisk "$device_path" || error
( echo "o" #Type o. This will clear out any partitions on the drive.
echo "p" #Type p to list partitions. There should be no partitions left
echo "n" #Type n,
echo "p" #then p for primary,
echo "1" #1 for the first partition on the drive,
echo "" #Default start sector
echo "+300M" #then type +300M for the last sector.
echo "t" #Type t,
echo "c" #then c to set the first partition to type W95 FAT32 (LBA).
echo "n" #Type n,
echo "p" #then p for primary,
echo "2" #2 for the second partition on the drive,
echo "" #Default start sector
echo "" #Default end sector
echo "w" #Write the partition table and exit by typing w.
)| fdisk "$device_path" || error
info "Format boot partition..." &&
mkfs.vfat "$boot_partition_path" || error