mirror of
				https://github.com/kevinveenbirkenbach/linux-image-manager.git
				synced 2025-11-04 01:18:10 +00:00 
			
		
		
		
	Implemented uuid seeding for boot partition
This commit is contained in:
		@@ -47,6 +47,7 @@ make_working_folder(){
 | 
			
		||||
set_root_variables(){
 | 
			
		||||
  info "Setting root variables..." &&
 | 
			
		||||
  root_partition_uuid=$(blkid "$root_partition_path" -s UUID -o value) &&
 | 
			
		||||
  boot_partition_uuid=$(blkid "$boot_partition_uuid" -s UUID -o value) &&
 | 
			
		||||
  root_mapper_name="arch-root-$root_partition_uuid" &&
 | 
			
		||||
  root_mapper_path="/dev/mapper/$root_mapper_name" || error
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -231,11 +231,15 @@ if mount | grep -q "$boot_partition_path"
 | 
			
		||||
    fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
fstab_path="$root_mount_path""etc/fstab" &&
 | 
			
		||||
info "Seeding UUID to $fstab_path to avoid path conflicts..." &&
 | 
			
		||||
sed -i "s/mmcblk0p1/UUID=$boot_partition_uuid/g" "$fstab_path" &&
 | 
			
		||||
info "Content of $fstab_path:$(cat "$fstab_path")" || error
 | 
			
		||||
 | 
			
		||||
info "Define target paths..." &&
 | 
			
		||||
target_home_path="$root_mount_path""home/" &&
 | 
			
		||||
target_username=$(ls "$target_home_path") &&
 | 
			
		||||
target_user_home_folder_path="$target_home_path$target_username/" &&
 | 
			
		||||
 | 
			
		||||
target_user_ssh_folder_path="$target_user_home_folder_path"".ssh/" &&
 | 
			
		||||
target_authorized_keys="$target_user_ssh_folder_path""authorized_keys" &&
 | 
			
		||||
question "Should the ssh-key be copied to the image?(y/N)" && read -r copy_ssh_key || error
 | 
			
		||||
@@ -364,7 +368,6 @@ if [ "$encrypt_system" == "y" ]
 | 
			
		||||
    info "Generating mkinitcpio..." &&
 | 
			
		||||
    echo "mkinitcpio -vP || exit 1" | chroot "$root_mount_path" /bin/bash &&
 | 
			
		||||
 | 
			
		||||
    fstab_path="$root_mount_path""etc/fstab" &&
 | 
			
		||||
    fstab_insert_line="UUID=$root_partition_uuid  / ext4    defaults,noatime  0  1" &&
 | 
			
		||||
    info "Configuring $fstab_path..." || error
 | 
			
		||||
    if grep -q "$fstab_insert_line" "$fstab_path"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user