mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	renew.sh
This commit is contained in:
		
							parent
							
								
									d9bd69fc27
								
							
						
					
					
						commit
						37736cf4e6
					
				
					 1 changed files with 58 additions and 58 deletions
				
			
		|  | @ -1,20 +1,15 @@ | |||
| #!/bin/bash | ||||
| # shellcheck source=./distrohopper.conf | ||||
| 
 | ||||
| export LC_ALL=C | ||||
| 
 | ||||
| echo "Updating VMs..." | ||||
| # distrohopper config file | ||||
| # config path | ||||
| CONFIG_DIR="$HOME/.config/distrohopper" | ||||
| source "$CONFIG_DIR/distrohopper.conf" | ||||
| # shellcheck source=distrohopper.conf | ||||
| # remove desktop files (ready to run VMs) | ||||
| rm -r "$CONFIG_DIR/ready" | ||||
| mkdir "$CONFIG_DIR/ready" | ||||
| # Enter ditrohopper VMs dir | ||||
| cd "$VMS_DIR" || exit | ||||
| # check for VMs .conf files (ready to run VMs) | ||||
| for vm_conf in *.conf; do | ||||
| source "$CONFIG_DIR"/distrohopper.conf | ||||
| # Renew VMs | ||||
| renew_ready() { | ||||
|     echo "Updating VMs..." | ||||
|     # Enter ditrohopper VMs dir | ||||
|     cd "$VMS_DIR" || exit | ||||
|     # check for VMs .conf files (ready to run VMs) | ||||
|     for vm_conf in *.conf; do | ||||
|         vm_desktop=$(basename "$VMS_DIR/$vm_conf" .conf) | ||||
|         # Use fuzzy matching to find the best matching icon file (ready to run VMs) | ||||
|         icon_name=$(basename "$VMS_DIR/$vm_conf" .conf | cut -d'-' -f -2) | ||||
|  | @ -37,14 +32,13 @@ Icon=$icon_file | |||
| Categories=System;Virtualization;" | ||||
|     # create desktop files (ready to run VMs) | ||||
|     echo "$desktop_file_content" > "$CONFIG_DIR"/ready/"$vm_desktop".desktop | ||||
| done | ||||
|     done | ||||
| } | ||||
| 
 | ||||
| # remove desktop files (supported VMs) | ||||
| rm -r "$CONFIG_DIR/supported" | ||||
| mkdir "$CONFIG_DIR/supported" | ||||
| # get supported VMs | ||||
| quickget | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > "$CONFIG_DIR/supported.md" | ||||
| while read -r get_name; do | ||||
| renew_supported() { | ||||
|     # get supported VMs | ||||
|     quickget | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > "$CONFIG_DIR/supported.md" | ||||
|     while read -r get_name; do | ||||
|         vm_desktop=$(echo "$get_name" | tr ' ' '_') | ||||
|         releases=$(quickget "$vm_desktop" | grep 'Releases' | cut -d':' -f2 | sed 's/^ //') | ||||
|         editions=$(quickget "$vm_desktop" | grep 'Editions' | cut -d':' -f2 | sed 's/^ //') | ||||
|  | @ -63,7 +57,7 @@ while read -r get_name; do | |||
| Type=Application | ||||
| Name=$get_name | ||||
| releases=$releases | ||||
| replace='\"!\"' | ||||
| replace=$replace | ||||
| Exec=sh -c 'cd \"$VMS_DIR\" && yad --form --field=\"Release:CB\" \"${releases// /$replace}\" | cut -d\"|\" -f1 | xargs -I{} sh -c \"quickget $get_name {}\"' | ||||
| Icon=$icon_file | ||||
| Categories=System;Virtualization;" | ||||
|  | @ -81,4 +75,10 @@ Icon=$icon_file | |||
| Categories=System;Virtualization;" | ||||
|             echo "$desktop_file_content" > "$CONFIG_DIR"/supported/"$vm_desktop".desktop | ||||
|         fi | ||||
| done < "$CONFIG_DIR"/supported.md | ||||
|     done < "$CONFIG_DIR"/supported.md | ||||
| } | ||||
| 
 | ||||
| renew_supported | ||||
| renew_ready | ||||
| 
 | ||||
| echo "Done" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue