mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
reworked renew_supported
This commit is contained in:
parent
a39cc83b6e
commit
fc9457da2b
1 changed files with 16 additions and 62 deletions
78
dh
78
dh
|
@ -208,8 +208,8 @@ function renew_supported() {
|
||||||
"$prefix"quickget | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > "$DH_CONFIG_DIR/supported.md"
|
"$prefix"quickget | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > "$DH_CONFIG_DIR/supported.md"
|
||||||
while read -r get_name; do
|
while read -r get_name; do
|
||||||
vm_desktop=$(echo "$get_name" | tr ' ' '_')
|
vm_desktop=$(echo "$get_name" | tr ' ' '_')
|
||||||
releases=$("$prefix"quickget "$vm_desktop" | grep 'Releases' | cut -d':' -f2 | sed 's/^ //')
|
releases=$("$prefix"quickget "$vm_desktop" | grep 'Releases' | cut -d':' -f2 | sed 's/^ //' | sed 's/ *$//')
|
||||||
editions=$("$prefix"quickget "$vm_desktop" | grep 'Editions' | cut -d':' -f2 | sed 's/^ //')
|
editions=$("$prefix"quickget "$vm_desktop" | grep 'Editions' | cut -d':' -f2 | sed 's/^ //' | sed 's/ *$//')
|
||||||
icon_name="$DH_ICON_DIR/$get_name"
|
icon_name="$DH_ICON_DIR/$get_name"
|
||||||
if [ -f "$icon_name.svg" ]; then
|
if [ -f "$icon_name.svg" ]; then
|
||||||
icon_file="$icon_name.svg"
|
icon_file="$icon_name.svg"
|
||||||
|
@ -218,79 +218,38 @@ function renew_supported() {
|
||||||
else
|
else
|
||||||
icon_file="$DH_ICON_DIR/tux.svg"
|
icon_file="$DH_ICON_DIR/tux.svg"
|
||||||
fi
|
fi
|
||||||
|
echo $"Creating desktop file for $vm_desktop..."
|
||||||
|
echo ""
|
||||||
# Check if there are editions
|
# Check if there are editions
|
||||||
if [ -z "$editions" ]; then
|
if [ -z "$editions" ]; then
|
||||||
# Create desktop file for VMs without editions
|
cat <<EOF > "$DH_CONFIG_DIR"/supported/"$vm_desktop".desktop
|
||||||
desktop_file_content="[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=$get_name
|
Name=$get_name
|
||||||
releases=$releases
|
releases=$releases
|
||||||
replace=$replace
|
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 {}\"'
|
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
|
Icon=$icon_file
|
||||||
Categories=System;Virtualization;"
|
Categories=System;Virtualization;
|
||||||
echo "$desktop_file_content" > "$DH_CONFIG_DIR"/supported/"$vm_desktop".desktop
|
|
||||||
|
EOF
|
||||||
else
|
else
|
||||||
# Create desktop file for VMs with editions
|
cat <<EOF > "$DH_CONFIG_DIR"/supported/"$vm_desktop".desktop
|
||||||
# shellcheck disable=2154
|
[Desktop Entry]
|
||||||
desktop_file_content="[Desktop Entry]
|
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=$get_name
|
Name=$get_name
|
||||||
releases=$releases
|
releases=$releases
|
||||||
editions=$editions
|
editions=$editions
|
||||||
replace=$replace
|
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 {}\"'
|
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
|
Icon=$icon_file
|
||||||
Categories=System;Virtualization;"
|
Categories=System;Virtualization;
|
||||||
echo "$desktop_file_content" > "$DH_CONFIG_DIR"/supported/"$vm_desktop".desktop
|
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
done < "$DH_CONFIG_DIR"/supported.md
|
done < "$DH_CONFIG_DIR"/supported.md
|
||||||
}
|
}
|
||||||
|
|
||||||
function renew_supported_test() {
|
|
||||||
rm "$DH_CONFIG_DIR"/test/ubuntu.desktop >/dev/null 2>&1
|
|
||||||
# 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
|
|
||||||
}
|
|
||||||
|
|
||||||
function run_gui() {
|
function run_gui() {
|
||||||
check_gui_dependencies
|
check_gui_dependencies
|
||||||
key=$((RANDOM % 9000 + 1000))
|
key=$((RANDOM % 9000 + 1000))
|
||||||
|
@ -542,11 +501,6 @@ do
|
||||||
isos_to_dir
|
isos_to_dir
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
e|'test')
|
|
||||||
echo $"Running supported test..."
|
|
||||||
renew_supported_test
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
l|language)
|
l|language)
|
||||||
create_translation
|
create_translation
|
||||||
shift
|
shift
|
||||||
|
|
Loading…
Reference in a new issue