isolate code to scan kernel drivers
This commit is contained in:
		
							parent
							
								
									ea5247d72e
								
							
						
					
					
						commit
						af688e8862
					
				| @ -19,14 +19,14 @@ echo_cyan "Installing scripts..." | ||||
| install_init_script | ||||
| 
 | ||||
| echo_cyan "Installing kernel modules..." | ||||
| install_module "$(df -T / | awk '{ print $2 }' | tail -1)" | ||||
| # # Uncomment this section if you want to grab modules from the guest OS | ||||
| # scan_modules | ||||
| install_module virtio_net | ||||
| install_module btrfs | ||||
| install_module virtio_blk | ||||
| install_module msr | ||||
| install_module sev-guest | ||||
| install_module dm_crypt | ||||
| disk_driver=$(lshw -c disk 2>/dev/null | grep -oE 'driver=[a-z\-\_]+' | cut -d '=' -f2) | ||||
| [[ -n $disk_driver ]] && install_module "$disk_driver" | ||||
| 
 | ||||
| echo_cyan "Building module dependency tree..." | ||||
| cp /lib/modules/${KERNEL}/modules.{order,builtin,builtin.modinfo} "${ROOT}/lib/modules/${KERNEL}/" | ||||
|  | ||||
| @ -132,6 +132,19 @@ _install_module() { | ||||
|   done <<< "$( echo "$depends" )" | ||||
| } | ||||
| 
 | ||||
| scan_modules() { | ||||
|   local drivers='' mod='' | ||||
|   install_module "$(df -T / | awk '{ print $2 }' | tail -1)" | ||||
| 
 | ||||
|   drivers=$(lshw -c disk 2>/dev/null | grep -oE 'driver=[a-z\_\-]+' | cut -d '=' -f2; | ||||
|     lshw -c network 2>/dev/null | grep -oE 'driver=[a-z\_\-]+' | cut -d '=' -f2) | ||||
| 
 | ||||
|   while read -r mod; do | ||||
|     [[ -z $mod ]] && continue | ||||
|     _install_module "$mod" | ||||
|   done <<< "$( echo "$drivers" )" | ||||
| } | ||||
| 
 | ||||
| create_archive() { | ||||
|   local archive="detee-$(hostnamectl hostname)-${KERNEL}.cpio.gz" | ||||
|   echo_cyan "Creating archive $archive" | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user