Skip to content

Commit 49beacb

Browse files
author
zenobit
committed
renew_ready: Use old function
1 parent 901a25b commit 49beacb

32 files changed

+98
-65
lines changed

dh

Lines changed: 67 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,27 @@ echo "$MSG_RUNNING"
1818

1919
while true
2020
do
21+
function variables_set() {
22+
# DEBUG mod
23+
#bash -x ./dh 2>&1 | tee output.log
24+
#progname="${progname:="${0##*/}"}"
25+
progname="DistroHopper"
26+
version="0.80"
27+
#GTK_THEME="alt-dialog"
28+
DH_CONFIG_DIR="$HOME/.config/distrohopper"
29+
DH_CONFIG="$DH_CONFIG_DIR/distrohopper.conf"
30+
DH_ICON_DIR="/usr/share/icons/distrohopper"
31+
PATH_PREFIX="/usr/bin/"
32+
TMP_DIR="/tmp"
33+
terminal="sakura"
34+
replace='"!"'
35+
#export "DH_CONFIG_DIR" "DH_CONFIG" "replace" "DH_ICON_DIR" "PATH_PREFIX" "TMP_DIR" "terminal"
36+
check_and_set_mode
37+
# Set traps to catch the signals and exit gracefully
38+
trap "exit" INT
39+
trap "exit" EXIT
40+
}
41+
2142
function bugs_notice_show() {
2243
echo ""
2344
echo "$MSG_DONE"
@@ -92,27 +113,6 @@ do
92113
[ -f "$PATH_PREFIX/fzf" ] || echo "$MSG_FZF"
93114
}
94115

95-
function variables_set() {
96-
# DEBUG mod
97-
#bash -x ./dh 2>&1 | tee output.log
98-
#progname="${progname:="${0##*/}"}"
99-
progname="DistroHopper"
100-
version="0.80"
101-
#GTK_THEME="alt-dialog"
102-
DH_CONFIG_DIR="$HOME/.config/distrohopper"
103-
DH_CONFIG="$DH_CONFIG_DIR/distrohopper.conf"
104-
DH_ICON_DIR="/usr/share/icons/distrohopper"
105-
PATH_PREFIX="/usr/bin/"
106-
TMP_DIR="/tmp"
107-
terminal="sakura"
108-
replace='"!"'
109-
#export "DH_CONFIG_DIR" "DH_CONFIG" "replace" "DH_ICON_DIR" "PATH_PREFIX" "TMP_DIR" "terminal"
110-
check_and_set_mode
111-
# Set traps to catch the signals and exit gracefully
112-
trap "exit" INT
113-
trap "exit" EXIT
114-
}
115-
116116
function desktop_entry_create() {
117117
cat <<EOF > ${DESKTOP_FILE}
118118
[Desktop Entry]
@@ -149,7 +149,7 @@ EOF
149149
type='Application'
150150
name='DistroHopper'
151151
comment='Quickly download, create and run VM of any#TODO operating system.'
152-
version='0.77b'
152+
version="${version}"
153153
execmd="sh -c 'cd ${VMS_DIR} && dh g'"
154154
if [ "$interminal" == "yes" ]; then
155155
terminal='true'
@@ -241,16 +241,13 @@ EOF
241241

242242
function virtual_machines_update_ready() {
243243
cd "$VMS_DIR" || exit 1
244-
rm "$DH_CONFIG_DIR"/ready/*.desktop
245-
# for files in "$VMS_DIR"/*; do
246-
# if [ ! -e *.conf ]; then
247-
# echo $"No .conf files found"
248-
# return
249-
# fi
250-
for vm_conf in *.conf; do
251-
if [ "$vm_conf" == "distrohopper.conf" ]; then
252-
continue # skip processing distrohopper.conf
244+
rm "$DH_CONFIG_DIR"/ready/*.desktop 2>/dev/null
245+
for vm_conf in $(pwd)
246+
do
247+
if [ "${vm_conf}" == "distrohopper.conf" ]; then
248+
echo "continue" # skip processing distrohopper.conf
253249
fi
250+
echo "creating..."
254251
vm_desktop=$(basename "$VMS_DIR/$vm_conf" .conf)
255252
# Use fuzzy matching to find the best matching icon file (ready to run VMs)
256253
icon_name=$(basename "$VMS_DIR/$vm_conf" .conf | cut -d'-' -f -2)
@@ -266,16 +263,51 @@ EOF
266263
type='Application'
267264
name="${vm_desktop}"
268265
comment='Quickly download, create and run VM of any#TODO operating system.'
269-
version='0.77b'
266+
version="${version}"
270267
execmd="sh -c 'cd ${VMS_DIR} && ${portable_prefix}quickemu -vm ${vm_conf};$SHELL'"
271268
icon="${icon_file}"
272269
categories='System;Virtualization;'
273270
desktop_entry_create
274271
done
275272
}
276273

274+
function renew_ready() {
275+
cd "$VMS_DIR" || exit 1
276+
# for files in "$VMS_DIR"/*; do
277+
# if [ ! -e *.conf ]; then
278+
# echo $"No .conf files found"
279+
# return
280+
# fi
281+
for vm_conf in *.conf; do
282+
if [ "$vm_conf" == "distrohopper.conf" ]; then
283+
continue # skip processing distrohopper.conf
284+
fi
285+
vm_desktop=$(basename "$VMS_DIR/$vm_conf" .conf)
286+
# Use fuzzy matching to find the best matching icon file (ready to run VMs)
287+
icon_name=$(basename "$VMS_DIR/$vm_conf" .conf | cut -d'-' -f -2)
288+
icon_file=$(find "$DH_ICON_DIR" -type f -iname "${icon_name// /}.*")
289+
# If no icon was found, try shorter name (ready to run VMs)
290+
if [ -z "$icon_file" ]; then
291+
icon_name=$(basename "$VMS_DIR/$vm_conf" .conf | cut -d'-' -f1)
292+
icon_file=$(find "$DH_ICON_DIR" -type f -iname "${icon_name// /}.*")
293+
elif [ -z "$icon_file" ]; then
294+
icon_file="$DH_ICON_DIR/tux.svg"
295+
fi
296+
# content of desktop files (ready to run VMs)
297+
cat <<EOF > "$DH_CONFIG_DIR"/ready/"$vm_desktop".desktop
298+
[Desktop Entry]
299+
Type=Application
300+
Name=$vm_desktop
301+
Exec=sh -c 'cd ${VMS_DIR} && ${portable_prefix}quickemu -vm ${vm_conf}'
302+
Icon=$icon_file
303+
Categories=System;Virtualization;
304+
305+
EOF
306+
done
307+
}
308+
277309
function virtual_machines_update_supported() {
278-
rm "$DH_CONFIG_DIR"/supported/*.desktop
310+
rm "$DH_CONFIG_DIR"/supported/*.desktop
279311
echo "$MSG_INTERM"
280312
run_in_terminal
281313
# get supported VMs
@@ -692,7 +724,8 @@ EOF
692724
;;
693725
r|ready)
694726
echo "$MSG_U_READY"
695-
virtual_machines_update_ready
727+
#virtual_machines_update_ready
728+
renew_ready
696729
shift
697730
;;
698731
t|tui)

supported/agarimos.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Name=agarimos
55
GenericName=
66
Comment=
77
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'
8-
Icon=/home/zen/Git/DistroHopper/icons/agarimos.png
8+
Icon=/home/zen/Git/DistroHopper/icons/agarimos.svg
99
Terminal=sakura
1010
X-MultipleArgs=
1111
Type=Application

supported/arco.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Name=arco
55
GenericName=
66
Comment=
77
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'
8-
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
8+
Icon=/home/zen/Git/DistroHopper/icons/arco.svg
99
Terminal=sakura
1010
X-MultipleArgs=
1111
Type=Application

supported/athenaos.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Name=athenaos
55
GenericName=
66
Comment=
77
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'
8-
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
8+
Icon=/home/zen/Git/DistroHopper/icons/athenaos.svg
99
Terminal=sakura
1010
X-MultipleArgs=
1111
Type=Application

supported/biglinux.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Name=biglinux
55
GenericName=
66
Comment=
77
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'
8-
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
8+
Icon=/home/zen/Git/DistroHopper/icons/biglinux.svg
99
Terminal=sakura
1010
X-MultipleArgs=
1111
Type=Application

supported/bodhi.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Name=bodhi
55
GenericName=
66
Comment=
77
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'
8-
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
8+
Icon=/home/zen/Git/DistroHopper/icons/bodhi.svg
99
Terminal=sakura
1010
X-MultipleArgs=
1111
Type=Application

supported/chimera.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Name=chimera
55
GenericName=
66
Comment=
77
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'
8-
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
8+
Icon=/home/zen/Git/DistroHopper/icons/chimera.svg
99
Terminal=sakura
1010
X-MultipleArgs=
1111
Type=Application

supported/dietpi.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Name=dietpi
55
GenericName=
66
Comment=
77
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'
8-
Icon=/home/zen/Git/DistroHopper/icons/dietpi.png
8+
Icon=/home/zen/Git/DistroHopper/icons/dietpi.svg
99
Terminal=sakura
1010
X-MultipleArgs=
1111
Type=Application

supported/edubuntu.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Name=edubuntu
55
GenericName=
66
Comment=
77
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'
8-
Icon=/home/zen/Git/DistroHopper/icons/tux.svg
8+
Icon=/home/zen/Git/DistroHopper/icons/edubuntu.svg
99
Terminal=sakura
1010
X-MultipleArgs=
1111
Type=Application

supported/gabeeos.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Name=gabeeos
55
GenericName=
66
Comment=
77
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'
8-
Icon=/home/zen/Git/DistroHopper/icons/gabeeos.png
8+
Icon=/home/zen/Git/DistroHopper/icons/gabeeos.svg
99
Terminal=sakura
1010
X-MultipleArgs=
1111
Type=Application

0 commit comments

Comments
 (0)