Multiple locations for ISOs
This commit is contained in:
		
							parent
							
								
									49a0c80cde
								
							
						
					
					
						commit
						efa5742b29
					
				
					 1 changed files with 50 additions and 12 deletions
				
			
		|  | @ -2,14 +2,49 @@ | |||
| # | ||||
| insmod regexp | ||||
| 
 | ||||
| set isopath="/boot/isos" | ||||
| export isopath | ||||
| 
 | ||||
| set isoconfdir="${isoconfig}.d" | ||||
| export isoconfdir | ||||
| 
 | ||||
| if [ -d "${isoconfdir}" ]; then | ||||
| 	echo "${isoconfdir} is a directory" | ||||
| if [ ! -d "${isoconfdir}" ]; then | ||||
| 	echo "Cannot read ${isoconfdir}" | ||||
| 	exit | ||||
| fi | ||||
| 
 | ||||
| # Loop over both FAT32 and ExFAT filesystems | ||||
| isouuids="EAB6-E0E9 0BB2-9158" | ||||
| 
 | ||||
| for isouuid in $isouuids | ||||
| do | ||||
| 
 | ||||
| 	search --no-floppy --fs-uuid --set=isodev $isouuid | ||||
| 	set isopath="/isos" | ||||
| 
 | ||||
| 	set isoroot="(${isodev})${isopath}" | ||||
| 
 | ||||
| 	if [ ! -d "${isoroot}" ]; then | ||||
| 		echo "Ignoring invalid iso root at ${isoroot}" | ||||
| 		sleep 1 | ||||
| 		continue | ||||
| 	fi | ||||
| 
 | ||||
| 	# split isoroot again | ||||
| 	echo "Found iso root at ${isoroot}" | ||||
| 
 | ||||
| 	regexp \ | ||||
| 		--set 1:isodev \ | ||||
| 		--set 2:isopath \ | ||||
| 		"^(\(.*\))?(.*)\$" "${isoroot}" | ||||
| 
 | ||||
| 	echo "isodev: ${isodev}" | ||||
| 	echo "isopath: ${isopath}" | ||||
| 
 | ||||
| 	# Export the variables | ||||
| 	export isoroot | ||||
| 	export isopath | ||||
| 	export isodev | ||||
| 
 | ||||
| 	# Read appropriate iso configs | ||||
| 	echo "Reading ${isoconfdir}" | ||||
| 	for conf in ${isoconfdir}/*.cfg; do | ||||
| 		if [ ! -f "$conf" ]; then | ||||
| 			echo "No valid configuration to read" | ||||
|  | @ -20,12 +55,15 @@ if [ -d "${isoconfdir}" ]; then | |||
| 		source "${conf}" | ||||
| 	done | ||||
| 
 | ||||
| 	menuentry ' ' { true } | ||||
| 	sleep 1 | ||||
| done | ||||
| 
 | ||||
| 	menuentry "[Esc] Back to Menu" { | ||||
| 		configfile "${prefix}/grub.cfg" | ||||
| 	} | ||||
| else | ||||
| 	echo "Cannot read ${isoconfdir}" | ||||
| fi | ||||
| # let the echos be readable | ||||
| echo "Waiting for 5 seconds..." | ||||
| sleep 5 | ||||
| 
 | ||||
| menuentry ' ' { true } | ||||
| 
 | ||||
| menuentry "[Esc] Back to Menu" { | ||||
| 	configfile "${prefix}/grub.cfg" | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue