renew_ready: Use old function

This commit is contained in:
zenobit 2023-10-04 00:24:04 +02:00
parent 901a25bda8
commit 49beacbf4c
32 changed files with 98 additions and 65 deletions

101
dh
View File

@ -18,6 +18,27 @@ echo "$MSG_RUNNING"
while true
do
function variables_set() {
# DEBUG mod
#bash -x ./dh 2>&1 | tee output.log
#progname="${progname:="${0##*/}"}"
progname="DistroHopper"
version="0.80"
#GTK_THEME="alt-dialog"
DH_CONFIG_DIR="$HOME/.config/distrohopper"
DH_CONFIG="$DH_CONFIG_DIR/distrohopper.conf"
DH_ICON_DIR="/usr/share/icons/distrohopper"
PATH_PREFIX="/usr/bin/"
TMP_DIR="/tmp"
terminal="sakura"
replace='"!"'
#export "DH_CONFIG_DIR" "DH_CONFIG" "replace" "DH_ICON_DIR" "PATH_PREFIX" "TMP_DIR" "terminal"
check_and_set_mode
# Set traps to catch the signals and exit gracefully
trap "exit" INT
trap "exit" EXIT
}
function bugs_notice_show() {
echo ""
echo "$MSG_DONE"
@ -92,27 +113,6 @@ do
[ -f "$PATH_PREFIX/fzf" ] || echo "$MSG_FZF"
}
function variables_set() {
# DEBUG mod
#bash -x ./dh 2>&1 | tee output.log
#progname="${progname:="${0##*/}"}"
progname="DistroHopper"
version="0.80"
#GTK_THEME="alt-dialog"
DH_CONFIG_DIR="$HOME/.config/distrohopper"
DH_CONFIG="$DH_CONFIG_DIR/distrohopper.conf"
DH_ICON_DIR="/usr/share/icons/distrohopper"
PATH_PREFIX="/usr/bin/"
TMP_DIR="/tmp"
terminal="sakura"
replace='"!"'
#export "DH_CONFIG_DIR" "DH_CONFIG" "replace" "DH_ICON_DIR" "PATH_PREFIX" "TMP_DIR" "terminal"
check_and_set_mode
# Set traps to catch the signals and exit gracefully
trap "exit" INT
trap "exit" EXIT
}
function desktop_entry_create() {
cat <<EOF > ${DESKTOP_FILE}
[Desktop Entry]
@ -149,7 +149,7 @@ EOF
type='Application'
name='DistroHopper'
comment='Quickly download, create and run VM of any#TODO operating system.'
version='0.77b'
version="${version}"
execmd="sh -c 'cd ${VMS_DIR} && dh g'"
if [ "$interminal" == "yes" ]; then
terminal='true'
@ -241,7 +241,38 @@ EOF
function virtual_machines_update_ready() {
cd "$VMS_DIR" || exit 1
rm "$DH_CONFIG_DIR"/ready/*.desktop
rm "$DH_CONFIG_DIR"/ready/*.desktop 2>/dev/null
for vm_conf in $(pwd)
do
if [ "${vm_conf}" == "distrohopper.conf" ]; then
echo "continue" # skip processing distrohopper.conf
fi
echo "creating..."
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)
icon_file=$(find "$DH_ICON_DIR" -type f -iname "${icon_name// /}.*")
# If no icon was found, try shorter name (ready to run VMs)
if [ -z "$icon_file" ]; then
icon_name=$(basename "$VMS_DIR/$vm_conf" .conf | cut -d'-' -f1)
icon_file=$(find "$DH_ICON_DIR" -type f -iname "${icon_name// /}.*")
elif [ -z "$icon_file" ]; then
icon_file="$DH_ICON_DIR/tux.svg"
fi
DESKTOP_FILE="${DH_CONFIG_DIR}/ready/${vm_desktop}.desktop"
type='Application'
name="${vm_desktop}"
comment='Quickly download, create and run VM of any#TODO operating system.'
version="${version}"
execmd="sh -c 'cd ${VMS_DIR} && ${portable_prefix}quickemu -vm ${vm_conf};$SHELL'"
icon="${icon_file}"
categories='System;Virtualization;'
desktop_entry_create
done
}
function renew_ready() {
cd "$VMS_DIR" || exit 1
# for files in "$VMS_DIR"/*; do
# if [ ! -e *.conf ]; then
# echo $"No .conf files found"
@ -262,20 +293,21 @@ EOF
elif [ -z "$icon_file" ]; then
icon_file="$DH_ICON_DIR/tux.svg"
fi
DESKTOP_FILE="${DH_CONFIG_DIR}/ready/${vm_desktop}.desktop"
type='Application'
name="${vm_desktop}"
comment='Quickly download, create and run VM of any#TODO operating system.'
version='0.77b'
execmd="sh -c 'cd ${VMS_DIR} && ${portable_prefix}quickemu -vm ${vm_conf};$SHELL'"
icon="${icon_file}"
categories='System;Virtualization;'
desktop_entry_create
# content of desktop files (ready to run VMs)
cat <<EOF > "$DH_CONFIG_DIR"/ready/"$vm_desktop".desktop
[Desktop Entry]
Type=Application
Name=$vm_desktop
Exec=sh -c 'cd ${VMS_DIR} && ${portable_prefix}quickemu -vm ${vm_conf}'
Icon=$icon_file
Categories=System;Virtualization;
EOF
done
}
function virtual_machines_update_supported() {
rm "$DH_CONFIG_DIR"/supported/*.desktop
rm "$DH_CONFIG_DIR"/supported/*.desktop
echo "$MSG_INTERM"
run_in_terminal
# get supported VMs
@ -692,7 +724,8 @@ EOF
;;
r|ready)
echo "$MSG_U_READY"
virtual_machines_update_ready
#virtual_machines_update_ready
renew_ready
shift
;;
t|tui)

View File

@ -5,7 +5,7 @@ Name=agarimos
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "latest" --field="Edition:CB" "plasma"!"xfce"!"lxqt"!"gnome" | xargs -I{} sh -c "./quickget agarimos {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/agarimos.png
Icon=/home/zen/Git/DistroHopper/icons/agarimos.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=arco
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "v21.09.08"!"v21.09.11"!"v21.11.04"!"v21.11.05"!"v22.01.10"!"v22.03.07"!"v22.04.02"!"v22.05.02"!"v22.06.07"!"v22.07.03"!"v22.09.04"!"v22.10.02"!"v22.11.02"!"v22.12.02"!"v23.01.03"!"v23.02.02"!"v23.03.01"!"v23.04.03"!"v23.05.04"!"v23.06.02"!"v23.07.01"!"v23.09.03"!"v23.10.01" --field="Edition:CB" "large"!"small" | xargs -I{} sh -c "./quickget arco {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/arco.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=athenaos
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "23.06.23" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget athenaos {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/athenaos.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=biglinux
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "kde" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget biglinux {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/biglinux.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=bodhi
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "7.0.0" --field="Edition:CB" "standard"!"hwe"!"s76" | xargs -I{} sh -c "./quickget bodhi {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/bodhi.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=chimera
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "latest" --field="Edition:CB" "base"!"gnome" | xargs -I{} sh -c "./quickget chimera {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/chimera.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=dietpi
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "bios"!"uefi" --field="Edition:CB" "bookworm"!"bookworm-installer"!"bullseye"!"bullseye-installer" | xargs -I{} sh -c "./quickget dietpi {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/dietpi.png
Icon=/home/zen/Git/DistroHopper/icons/dietpi.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=edubuntu
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "23.04" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget edubuntu {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/edubuntu.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=gabeeos
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "latest" --field="Edition:CB" "openbox"!"qtile" | xargs -I{} sh -c "./quickget gabeeos {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/gabeeos.png
Icon=/home/zen/Git/DistroHopper/icons/gabeeos.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=haiku
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "r1beta3"!"r1beta4" --field="Edition:CB" "x86_64"!"x86_gcc2h" | xargs -I{} sh -c "./quickget haiku {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/haiku.png
Icon=/home/zen/Git/DistroHopper/icons/haiku.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=holoiso
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "4.5" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget holoiso {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/holoiso.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=kolibrios
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "latest" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget kolibrios {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/kolibrios.png
Icon=/home/zen/Git/DistroHopper/icons/kolibrios.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=lite
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "6.0"!"6.2"!"6.4"!"6.6" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget lite {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/lite.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=mageia
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "8" --field="Edition:CB" "Plasma"!"GNOME"!"Xfce" | xargs -I{} sh -c "./quickget mageia {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/mageia.png
Icon=/home/zen/Git/DistroHopper/icons/mageia.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=mint
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "20.2"!"20.3"!"21"!"21.1"!"21.2" --field="Edition:CB" "cinnamon"!"mate"!"xfce" | xargs -I{} sh -c "./quickget mint {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/mint.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=miyo
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "2022" --field="Edition:CB" "Kwin"!"Deboot-Ceres"!"JWM"!"Openbox"!"MATE" | xargs -I{} sh -c "./quickget miyo {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/miyo.png
Icon=/home/zen/Git/DistroHopper/icons/miyo.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=openindiana
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "20230421" --field="Edition:CB" "gui"!"text"!"minimal" | xargs -I{} sh -c "./quickget openindiana {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/openindiana.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=oracle
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "7.7"!"7.8"!"7.9"!"8.4"!"8.5"!"8.6"!"9.0" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget oracle {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/oracle.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=rocky
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "8.3"!"8.4"!"8.5"!"8.6"!"8.7"!"9.0"!"9.1" --field="Edition:CB" "minimal"!"dvd"!"boot" | xargs -I{} sh -c "./quickget rocky {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/rocky.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=slax
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "latest" --field="Edition:CB" "Debian"!"Slackware" | xargs -I{} sh -c "./quickget slax {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/slax.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=slitaz
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "preferred"!"core"!"core64"!"loram"!"core-5in1"!"preinit" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget slitaz {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/slitaz.png
Icon=/home/zen/Git/DistroHopper/icons/slitaz.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=tinycore
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --separator=" " --field="Release:CB" "14.0" --field="Edition:CB" "Core"!"TinyCore"!"CorePlus"!"CorePure64"!"TinyCorePure64" | xargs -I{} sh -c "./quickget tinycore {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/tinycore.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=tuxedoos
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "2" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget tuxedoos {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/tuxedoos.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=ubuntu-server
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "18.04"!"20.04"!"22.04"!"23.04"!"daily-live" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget ubuntu-server {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/ubuntu-server.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=ubuntu-unity
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "23.04"!"daily-live"!"daily-canary" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget ubuntu-unity {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/ubuntu-unity.png
Icon=/home/zen/Git/DistroHopper/icons/ubuntu-unity.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=ubuntucinnamon
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "23.04"!"daily-live"!"daily-canary" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget ubuntucinnamon {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/ubuntucinnamon.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=vanillaos
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "22.10" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget vanillaos {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/vanillaos.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=ventoy
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "1.0.95" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget ventoy {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/ventoy.png
Icon=/home/zen/Git/DistroHopper/icons/ventoy.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=voidpup
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "latest" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget voidpup {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/voidpup.png
Icon=/home/zen/Git/DistroHopper/icons/voidpup.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=vx
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "6.0" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget vx {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/vx.svg
Terminal=sakura
X-MultipleArgs=
Type=Application

View File

@ -5,7 +5,7 @@ Name=xero
GenericName=
Comment=
Exec=sh -c 'cd /home/zen/Git/DistroHopper && yad --form --field="Release:CB" "kde" | cut -d"|" -f1 | xargs -I{} sh -c "./quickget xero {}";/usr/bin/fish'
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
Icon=/home/zen/Git/DistroHopper/icons/xero.svg
Terminal=sakura
X-MultipleArgs=
Type=Application