mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
prepare release
This commit is contained in:
parent
69abdb7a08
commit
00d0165368
23 changed files with 427 additions and 467 deletions
6
old/1stRun.desktop
Normal file
6
old/1stRun.desktop
Normal file
|
@ -0,0 +1,6 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=1st Run
|
||||
Exec=1stRun.sh
|
||||
Icon=/usr/share/icons/distroicons/tux.svg
|
||||
Categories=System;Virtualization;Settings;
|
122
old/1stRun.sh
Executable file
122
old/1stRun.sh
Executable file
|
@ -0,0 +1,122 @@
|
|||
#!/bin/bash
|
||||
|
||||
source distrohopper.conf
|
||||
|
||||
# config path
|
||||
DH_CONFIG_DIR="$HOME/.config/distrohopper"
|
||||
|
||||
create_structure() {
|
||||
# create default dirs
|
||||
mkdir -p "$DH_CONFIG_DIR"
|
||||
sudo mkdir -p "$DH_ICON_DIR"
|
||||
# copy everything to config dir
|
||||
cp -r * "$DH_CONFIG_DIR/"
|
||||
# copy icons
|
||||
sudo cp "../icons/"* "$DH_ICON_DIR/"
|
||||
}
|
||||
|
||||
# Set VMs dir
|
||||
set_dir() {
|
||||
NEWDIR="$(yad --file --directory --title="Where to save VMs?")"
|
||||
VMS_DIR="$NEWDIR"
|
||||
echo "VMS_DIR=\"$VMS_DIR\"
|
||||
export \"VMS_DIR\"" >> "$DH_CONFIG"
|
||||
export "VMS_DIR"
|
||||
echo "New dir is: $VMS_DIR"
|
||||
}
|
||||
|
||||
# install prerequisities
|
||||
install_prereq() {
|
||||
# (Void linux)
|
||||
sudo xbps-install -S qemu bash coreutils grep jq procps-ng python3 util-linux sed spice-gtk swtpm usbutils wget xdg-user-dirs xrandr unzip zsync socat
|
||||
}
|
||||
|
||||
# Install distrohopper to all users
|
||||
install_dh() {
|
||||
sudo cp ../dh ../quickget ../quickemu ../macrecovery ../windowskey /usr/bin/
|
||||
}
|
||||
|
||||
# Renew VMs
|
||||
renew_ready() {
|
||||
echo "Updating VMs..."
|
||||
source "$DH_CONFIG"
|
||||
# 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)
|
||||
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// /}.*")
|
||||
fi
|
||||
# If no icon was found, use a default icon (ready to run VMs)
|
||||
if [ -z "$icon_file" ]; then
|
||||
icon_file="$DH_ICON_DIR/tux.svg"
|
||||
fi
|
||||
# content of desktop files (ready to run VMs)
|
||||
desktop_file_content="[Desktop Entry]
|
||||
Type=Application
|
||||
Name=$vm_desktop
|
||||
Exec=sh -c 'cd \"$VMS_DIR\" && quickemu -vm \"$vm_conf\"'
|
||||
Icon=$icon_file
|
||||
Categories=System;Virtualization;"
|
||||
# create desktop files (ready to run VMs)
|
||||
echo "$desktop_file_content" > "$DH_CONFIG_DIR"/ready/"$vm_desktop".desktop
|
||||
done
|
||||
}
|
||||
|
||||
renew_supported() {
|
||||
# get supported VMs
|
||||
quickget | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > "$DH_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/^ //')
|
||||
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 \"quickget $get_name {}\"'
|
||||
Icon=$icon_file
|
||||
Categories=System;Virtualization;"
|
||||
echo "$desktop_file_content" > "$DH_CONFIG_DIR"/supported/"$vm_desktop".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 \"quickget $get_name {}\"'
|
||||
Icon=$icon_file
|
||||
Categories=System;Virtualization;"
|
||||
echo "$desktop_file_content" > "$DH_CONFIG_DIR"/supported/"$vm_desktop".desktop
|
||||
fi
|
||||
done < "$DH_CONFIG_DIR"/supported.md
|
||||
}
|
||||
|
||||
set_dir
|
||||
create_structure
|
||||
install_prereq
|
||||
install_dh
|
||||
renew_supported
|
||||
renew_ready
|
||||
|
||||
echo "Done"
|
6
old/add_distro.desktop
Executable file
6
old/add_distro.desktop
Executable file
|
@ -0,0 +1,6 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Add new distro
|
||||
Exec=add_distro.sh
|
||||
Icon=/usr/share/icons/distroicons/cereus.svg
|
||||
Categories=System;Virtualization;Settings;
|
31
old/add_distro.sh
Executable file
31
old/add_distro.sh
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
TMP_DIR="/tmp"
|
||||
yad --form --field="Pretty name" "" --field="Name" "" --field="Releases" "" --field="Editions" "" --field="URL" "" --field="ISO" "" --field="Checksum file" "" > ${TMP_DIR}/template.tmp
|
||||
|
||||
PRETTY_NAME="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f1)"
|
||||
NAME="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f2)"
|
||||
RELEASES="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f3)"
|
||||
EDITIONS="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f4)"
|
||||
URL="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f5)"
|
||||
ISO="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f6)"
|
||||
CHECKSUM_FILE="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f7)"
|
||||
echo " $NAME) PRETTY_NAME=$PRETTY_NAME;;
|
||||
" > ${TMP_DIR}/${NAME}.tmp
|
||||
{ echo " $NAME \\
|
||||
"; echo "function releases_$NAME() {
|
||||
echo $RELEASES
|
||||
}
|
||||
"; echo "function editions_$NAME() {
|
||||
echo $EDITIONS
|
||||
}
|
||||
"; echo "function get_$NAME() {
|
||||
local EDITION="${1:-}"
|
||||
local HASH=""
|
||||
local ISO="$ISO"
|
||||
local URL="$URL"
|
||||
HASH=\"$(wget -q -O- "${URL}/${CHECKSUM_FILE}" | grep "(${ISO}" | cut -d' ' -f4)\"
|
||||
echo \"${URL}/${ISO} ${HASH}\"
|
||||
}
|
||||
"; } >> ${TMP_DIR}/${NAME}.tmp
|
||||
|
||||
meld ${TMP_DIR}/${NAME}.tmp ../quickget
|
7
old/iso_copy.desktop
Normal file
7
old/iso_copy.desktop
Normal file
|
@ -0,0 +1,7 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=ISOs copy
|
||||
Exec=iso_copy.sh
|
||||
Icon=copy.svg
|
||||
Comment=Copy all ISOs to target dir
|
||||
Categories=System;Virtualization;Settings;
|
10
old/iso_copy.sh
Executable file
10
old/iso_copy.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
DH_CONFIG_DIR="$HOME"/.config/distrohopper
|
||||
DH_CONFIG="$DH_CONFIG_DIR/distrohopper.conf"
|
||||
source "$DH_CONFIG"
|
||||
yad --file --directory > target
|
||||
echo "It will take while..."
|
||||
cd "$VMS_DIR" || exit 1
|
||||
cp */*.iso "$target"
|
||||
echo "Done"
|
6
old/renew.desktop
Normal file
6
old/renew.desktop
Normal file
|
@ -0,0 +1,6 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Renew VMs
|
||||
Exec=renew.sh
|
||||
Icon=/usr/share/icons/distroicons/tux.svg
|
||||
Categories=System;Virtualization;Settings;
|
85
old/renew.sh
Executable file
85
old/renew.sh
Executable file
|
@ -0,0 +1,85 @@
|
|||
#!/bin/bash
|
||||
|
||||
# config path
|
||||
DH_CONFIG_DIR="$HOME/.config/distrohopper"
|
||||
DH_CONFIG="$DH_CONFIG_DIR/distrohopper.conf"
|
||||
source "$DH_CONFIG"
|
||||
# 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)
|
||||
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// /}.*")
|
||||
fi
|
||||
# If no icon was found, use a default icon (ready to run VMs)
|
||||
if [ -z "$icon_file" ]; then
|
||||
icon_file="$DH_ICON_DIR/tux.svg"
|
||||
fi
|
||||
# content of desktop files (ready to run VMs)
|
||||
desktop_file_content="[Desktop Entry]
|
||||
Type=Application
|
||||
Name=$vm_desktop
|
||||
Exec=sh -c 'cd \"$VMS_DIR\" && quickemu -vm \"$vm_conf\"'
|
||||
Icon=$icon_file
|
||||
Categories=System;Virtualization;"
|
||||
# create desktop files (ready to run VMs)
|
||||
echo "$desktop_file_content" > "$DH_CONFIG_DIR"/ready/"$vm_desktop".desktop
|
||||
done
|
||||
}
|
||||
|
||||
renew_supported() {
|
||||
# get supported VMs
|
||||
quickget | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > "$DH_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/^ //')
|
||||
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 \"quickget $get_name {}\"'
|
||||
Icon=$icon_file
|
||||
Categories=System;Virtualization;"
|
||||
echo "$desktop_file_content" > "$DH_CONFIG_DIR"/supported/"$vm_desktop".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 \"quickget $get_name {}\"'
|
||||
Icon=$icon_file
|
||||
Categories=System;Virtualization;"
|
||||
echo "$desktop_file_content" > "$DH_CONFIG_DIR"/supported/"$vm_desktop".desktop
|
||||
fi
|
||||
done < "$DH_CONFIG_DIR"/supported.md
|
||||
}
|
||||
|
||||
renew_supported
|
||||
renew_ready
|
||||
|
||||
echo "Done"
|
6
old/set_dir.desktop
Normal file
6
old/set_dir.desktop
Normal file
|
@ -0,0 +1,6 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Set VMs dir
|
||||
Exec=set_dir.sh
|
||||
Icon=/usr/share/icons/distroicons/cereus.svg
|
||||
Categories=System;Virtualization;Settings;
|
12
old/set_dir.sh
Executable file
12
old/set_dir.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
source distrohopper.conf
|
||||
|
||||
NEWDIR="$(yad --file --directory --title="Where to save VMs?")"
|
||||
VMS_DIR="$NEWDIR"
|
||||
|
||||
echo "VMS_DIR=\"$VMS_DIR\"
|
||||
export \"VMS_DIR\"" >> distrohopper.conf
|
||||
|
||||
export VMS_DIR
|
||||
echo "New dir is: $VMS_DIR"
|
Loading…
Add table
Add a link
Reference in a new issue