This commit is contained in:
zenobit 2023-03-21 15:29:47 +01:00
parent d9bd69fc27
commit 37736cf4e6

View file

@ -1,16 +1,11 @@
#!/bin/bash #!/bin/bash
# shellcheck source=./distrohopper.conf
export LC_ALL=C # config path
echo "Updating VMs..."
# distrohopper config file
CONFIG_DIR="$HOME/.config/distrohopper" CONFIG_DIR="$HOME/.config/distrohopper"
source "$CONFIG_DIR/distrohopper.conf" source "$CONFIG_DIR"/distrohopper.conf
# shellcheck source=distrohopper.conf # Renew VMs
# remove desktop files (ready to run VMs) renew_ready() {
rm -r "$CONFIG_DIR/ready" echo "Updating VMs..."
mkdir "$CONFIG_DIR/ready"
# Enter ditrohopper VMs dir # Enter ditrohopper VMs dir
cd "$VMS_DIR" || exit cd "$VMS_DIR" || exit
# check for VMs .conf files (ready to run VMs) # check for VMs .conf files (ready to run VMs)
@ -38,10 +33,9 @@ Categories=System;Virtualization;"
# create desktop files (ready to run VMs) # create desktop files (ready to run VMs)
echo "$desktop_file_content" > "$CONFIG_DIR"/ready/"$vm_desktop".desktop echo "$desktop_file_content" > "$CONFIG_DIR"/ready/"$vm_desktop".desktop
done done
}
# remove desktop files (supported VMs) renew_supported() {
rm -r "$CONFIG_DIR/supported"
mkdir "$CONFIG_DIR/supported"
# get supported VMs # get supported VMs
quickget | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > "$CONFIG_DIR/supported.md" quickget | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > "$CONFIG_DIR/supported.md"
while read -r get_name; do while read -r get_name; do
@ -63,7 +57,7 @@ while read -r get_name; do
Type=Application Type=Application
Name=$get_name Name=$get_name
releases=$releases 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 {}\"' 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 Icon=$icon_file
Categories=System;Virtualization;" Categories=System;Virtualization;"
@ -82,3 +76,9 @@ Categories=System;Virtualization;"
echo "$desktop_file_content" > "$CONFIG_DIR"/supported/"$vm_desktop".desktop echo "$desktop_file_content" > "$CONFIG_DIR"/supported/"$vm_desktop".desktop
fi fi
done < "$CONFIG_DIR"/supported.md done < "$CONFIG_DIR"/supported.md
}
renew_supported
renew_ready
echo "Done"