mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	test: supported edition (ubuntu)
This commit is contained in:
		
							parent
							
								
									cecab60053
								
							
						
					
					
						commit
						3a7cc73b8f
					
				
					 1 changed files with 49 additions and 0 deletions
				
			
		
							
								
								
									
										49
									
								
								dh
									
										
									
									
									
								
							
							
						
						
									
										49
									
								
								dh
									
										
									
									
									
								
							|  | @ -215,6 +215,50 @@ Categories=System;Virtualization;" | ||||||
| 	done < "$DH_CONFIG_DIR"/supported.md | 	done < "$DH_CONFIG_DIR"/supported.md | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | renew_supported_test() { | ||||||
|  | 	rm "$DH_CONFIG_DIR"/test/ubuntu.desktop | ||||||
|  | 	# get supported VMs | ||||||
|  | 	"$prefix"quickget | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > "$DH_CONFIG_DIR/ubuntu.md" | ||||||
|  | 	while read -r get_name; do | ||||||
|  | 		vm_desktop=ubuntu | ||||||
|  | 		releases=$("$prefix"quickget "$vm_desktop" | grep 'Releases' | cut -d':' -f2 | sed 's/^ //') | ||||||
|  | 		editions=$("$prefix"quickget "$vm_desktop" | grep 'Editions' | cut -d':' -f2 | sed 's/^ //') | ||||||
|  | 		icon_name="$DH_ICON_DIR/$get_name" | ||||||
|  | 		if [ -f "$icon_name.svg" ]; then | ||||||
|  | 			icon_file="$icon_name.svg" | ||||||
|  | 		elif [ -f "$icon_name.png" ]; then | ||||||
|  | 			icon_file="$icon_name.png" | ||||||
|  | 		else | ||||||
|  | 			icon_file="$DH_ICON_DIR/tux.svg" | ||||||
|  | 		fi | ||||||
|  | 		# Check if there are editions | ||||||
|  | 		if [ -z "$editions" ]; then | ||||||
|  | 			# Create desktop file for VMs without editions | ||||||
|  | 			desktop_file_content="[Desktop Entry] | ||||||
|  | Type=Application | ||||||
|  | Name=$get_name | ||||||
|  | releases=$releases | ||||||
|  | replace=$replace | ||||||
|  | Exec=sh -c 'cd \"$VMS_DIR\" && yad --form --field=\"Release:CB\" \"${releases// /$replace}\" | cut -d\"|\" -f1 | xargs -I{} sh -c \""$prefix"quickget $get_name {}\"' | ||||||
|  | Icon=$icon_file | ||||||
|  | Categories=System;Virtualization;" | ||||||
|  | 			echo "$desktop_file_content" > "$DH_CONFIG_DIR"/test/ubuntu.desktop | ||||||
|  | 		else | ||||||
|  | 			# Create desktop file for VMs with editions | ||||||
|  | 			desktop_file_content="[Desktop Entry] | ||||||
|  | Type=Application | ||||||
|  | Name=$get_name | ||||||
|  | releases=$releases | ||||||
|  | editions=$editions | ||||||
|  | replace=$replace | ||||||
|  | Exec=sh -c 'cd \"$VMS_DIR\" && yad --form --separator=\" \" --field=\"Release:CB\" \"${releases// /$replace}\" --field=\"Edition:CB\" \"${editions// /$replace}\" | xargs -I{} sh -c \"$prefixquickget $get_name {}\"' | ||||||
|  | Icon=$icon_file | ||||||
|  | Categories=System;Virtualization;" | ||||||
|  | 			echo "$desktop_file_content" > "$DH_CONFIG_DIR"/test/ubuntu.desktop | ||||||
|  | 		fi | ||||||
|  | 	done < "$DH_CONFIG_DIR"/test/ubuntu.md | ||||||
|  | } | ||||||
|  | 
 | ||||||
| run_gui() { | run_gui() { | ||||||
| 	check_gui_dependencies | 	check_gui_dependencies | ||||||
| 	key=$((RANDOM % 9000 + 1000)) | 	key=$((RANDOM % 9000 + 1000)) | ||||||
|  | @ -400,6 +444,11 @@ do | ||||||
| 			isos_to_dir | 			isos_to_dir | ||||||
| 			shift | 			shift | ||||||
| 			;; | 			;; | ||||||
|  | 		-e|--test) | ||||||
|  | 			echo "Running supported test..." | ||||||
|  | 			renew_supported_test | ||||||
|  | 			shift | ||||||
|  | 			;; | ||||||
| 		*) | 		*) | ||||||
| 			echo "Invalid option: $1" | 			echo "Invalid option: $1" | ||||||
| 			show_help | 			show_help | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue