mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
dh next
This commit is contained in:
parent
00d0165368
commit
ff5155730c
1 changed files with 66 additions and 74 deletions
102
dh
102
dh
|
@ -36,8 +36,31 @@ set_variables() {
|
||||||
#GTK_THEME="alt-dialog"
|
#GTK_THEME="alt-dialog"
|
||||||
DH_CONFIG_DIR="$HOME/.config/distrohopper"
|
DH_CONFIG_DIR="$HOME/.config/distrohopper"
|
||||||
DH_CONFIG="$DH_CONFIG_DIR/distrohopper.conf"
|
DH_CONFIG="$DH_CONFIG_DIR/distrohopper.conf"
|
||||||
export LC_ALL=C
|
DH_ICON_DIR="/usr/share/icons/distrohopper"
|
||||||
source "$DH_CONFIG" || install_process
|
PREFIX="/usr/bin/"
|
||||||
|
TERMINAL=sakura
|
||||||
|
replace='"!"'
|
||||||
|
source "$DH_CONFIG" >/dev/null 2>&1 \
|
||||||
|
&& cd "$VMS_DIR" \
|
||||||
|
&& export "DH_CONFIG_DIR" \
|
||||||
|
"DH_CONFIG" \
|
||||||
|
"DH_ICON_DIR" \
|
||||||
|
"PREFIX" \
|
||||||
|
"TERMINAL" \
|
||||||
|
"replace" \
|
||||||
|
|| echo "Not installed yet!" \
|
||||||
|
&& VMS_DIR="$(pwd)" \
|
||||||
|
&& DH_CONFIG_DIR="$(pwd)" \
|
||||||
|
&& DH_ICON_DIR="$(pwd)"/icons \
|
||||||
|
&& export "VMS_DIR" \
|
||||||
|
"DH_CONFIG_DIR" \
|
||||||
|
"DH_ICON_DIR" \
|
||||||
|
"TERMINAL" \
|
||||||
|
"replace" \
|
||||||
|
&& echo "Using current: $VMS_DIR directory!"
|
||||||
|
echo "DistroHopper v$version"
|
||||||
|
echo "quickemu v$(quickemu --version)
|
||||||
|
"
|
||||||
# Set traps to catch the signals and exit gracefully
|
# Set traps to catch the signals and exit gracefully
|
||||||
trap "exit" INT
|
trap "exit" INT
|
||||||
trap "exit" EXIT
|
trap "exit" EXIT
|
||||||
|
@ -89,7 +112,7 @@ install_process() {
|
||||||
&& run_once \
|
&& run_once \
|
||||||
&& echo "Creating directory structure..." \
|
&& echo "Creating directory structure..." \
|
||||||
&& create_structure \
|
&& create_structure \
|
||||||
&& echo "Setting directory..." \
|
&& echo "Setting up directory..." \
|
||||||
&& set_dir \
|
&& set_dir \
|
||||||
&& echo "Installing needed..." \
|
&& echo "Installing needed..." \
|
||||||
&& echo "For now voidlinux only" \
|
&& echo "For now voidlinux only" \
|
||||||
|
@ -99,19 +122,6 @@ install_process() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# basic
|
# basic
|
||||||
enter_vms_dir() {
|
|
||||||
cd "$VMS_DIR" || set_dir
|
|
||||||
}
|
|
||||||
|
|
||||||
# DistroHopper info
|
|
||||||
show_info() {
|
|
||||||
progname="${progname:="${0##*/}"}"
|
|
||||||
version="0.6"
|
|
||||||
echo "DistroHopper v$version"
|
|
||||||
echo "quickemu v$(quickemu --version)
|
|
||||||
"
|
|
||||||
}
|
|
||||||
|
|
||||||
renew_supported() {
|
renew_supported() {
|
||||||
# get supported VMs
|
# get supported VMs
|
||||||
quickget | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > "$DH_CONFIG_DIR/supported.md"
|
quickget | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > "$DH_CONFIG_DIR/supported.md"
|
||||||
|
@ -156,9 +166,12 @@ Categories=System;Virtualization;"
|
||||||
}
|
}
|
||||||
|
|
||||||
renew_ready() {
|
renew_ready() {
|
||||||
source "$DH_CONFIG"
|
|
||||||
cd "$VMS_DIR" || exit 1
|
cd "$VMS_DIR" || exit 1
|
||||||
# check for VMs .conf files (ready to run VMs)
|
# check for VMs .conf files (ready to run VMs)
|
||||||
|
if [ ! -e *.conf ]; then
|
||||||
|
echo "No .conf files found"
|
||||||
|
return
|
||||||
|
fi
|
||||||
for vm_conf in *.conf; do
|
for vm_conf in *.conf; do
|
||||||
vm_desktop=$(basename "$VMS_DIR/$vm_conf" .conf)
|
vm_desktop=$(basename "$VMS_DIR/$vm_conf" .conf)
|
||||||
# Use fuzzy matching to find the best matching icon file (ready to run VMs)
|
# Use fuzzy matching to find the best matching icon file (ready to run VMs)
|
||||||
|
@ -185,10 +198,9 @@ Categories=System;Virtualization;"
|
||||||
|
|
||||||
run_gui() {
|
run_gui() {
|
||||||
key=$((RANDOM % 9000 + 1000))
|
key=$((RANDOM % 9000 + 1000))
|
||||||
yad --plug="$key" --tabnum=1 --monitor --icons --listen --read-dir="$DH_CONFIG_DIR"/ready --sort-by-name --no-buttons --borders=0 --icon-size=48 --item-width=76 &
|
yad --plug="$key" --tabnum=1 --monitor --icons --listen --read-dir="$DH_CONFIG_DIR"/ready --sort-by-name --no-buttons --borders=0 --icon-size=46 --item-width=76 &
|
||||||
yad --plug="$key" --tabnum=2 --monitor --icons --listen --read-dir="$DH_CONFIG_DIR"/supported --sort-by-name --no-buttons --borders=0 --icon-size=48 --item-width=76 &
|
yad --plug="$key" --tabnum=2 --monitor --icons --listen --read-dir="$DH_CONFIG_DIR"/supported --sort-by-name --no-buttons --borders=0 --icon-size=46 --item-width=76 &
|
||||||
yad --plug="$key" --tabnum=3 --monitor --icons --listen --read-dir="$DH_CONFIG_DIR" --sort-by-name --no-buttons --borders=0 --icon-size=48 --item-width=76 &
|
yad --dynamic --notebook --key="$key" --monitor --listen --window-icon="$DH_ICON_DIR"/hop.svg --width=900 --height=900 --title="DistroHopper" --tab="run VM" --tab="download VM" --tab="settings" --button "test"
|
||||||
yad --dynamic --notebook --key="$key" --monitor --window-icon="$DH_ICON_DIR"/hop.svg --width=900 --height=800 --title="DistroHopper" --listen --no-buttons --tab="run VM" --tab="download VM" --tab="settings" --button "test"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
run_tui() {
|
run_tui() {
|
||||||
|
@ -308,28 +320,14 @@ add_distro() {
|
||||||
|
|
||||||
# run
|
# run
|
||||||
set_variables
|
set_variables
|
||||||
show_info
|
case "$1" in
|
||||||
|
d) set_dir;;
|
||||||
if [ "$1" = "d" ] ; then
|
i) echo "Starting installation..." && install_process;;
|
||||||
set_dir
|
s) echo "Updating supported VMs..." && renew_supported;;
|
||||||
echo "New dir is: $VMS_DIR"
|
t) echo "You are master! Running TUI..." && run_tui;;
|
||||||
elif [ "$1" = "i" ] ; then
|
r) echo "Updating ready VMs..." && renew_ready;;
|
||||||
echo "Starting installation..."
|
a) echo "Adding new distro started..." && add_distro;;
|
||||||
install_process
|
h) echo "Possible arguments are:
|
||||||
elif [ "$1" = "s" ] ; then
|
|
||||||
echo "Updating supported VMs..."
|
|
||||||
renew_supported
|
|
||||||
elif [ "$1" = "t" ] ; then
|
|
||||||
echo "You are master! Running TUI..."
|
|
||||||
run_tui
|
|
||||||
elif [ "$1" = "r" ] ; then
|
|
||||||
echo "Updating ready VMs..."
|
|
||||||
renew_ready
|
|
||||||
elif [ "$1" = "a" ] ; then
|
|
||||||
echo "Adding new distro started..."
|
|
||||||
add_distro
|
|
||||||
elif [ "$1" = "h" ] ; then
|
|
||||||
echo "Posible argumets are:
|
|
||||||
d Set where VMs are stored
|
d Set where VMs are stored
|
||||||
i Install DistroHopper
|
i Install DistroHopper
|
||||||
s Update supported VMs
|
s Update supported VMs
|
||||||
|
@ -338,18 +336,12 @@ elif [ "$1" = "h" ] ; then
|
||||||
a Add new distro to quickget
|
a Add new distro to quickget
|
||||||
h Show this help
|
h Show this help
|
||||||
o Copy all ISOs to target dir (for Ventoy)
|
o Copy all ISOs to target dir (for Ventoy)
|
||||||
p Push changed quickget to quickemu project"
|
p Push changed quickget to quickemu project";;
|
||||||
elif [ "$1" = "o" ] ; then
|
o) echo "Copying ISOs to dir. It will take some time..." && isos_to_dir;;
|
||||||
echo "Copying ISOs to dir. It will take some time..."
|
p) echo "Nothing here yet!";;
|
||||||
isos_to_dir
|
*) echo "You can show help if you run 'dh h'
|
||||||
elif [ "$1" = "p" ] ; then
|
Starting DistroHopper GUI..." && run_gui;;
|
||||||
echo "Nothing here yet!"
|
esac
|
||||||
else
|
|
||||||
echo "You can show help if you run 'dh h'"
|
|
||||||
echo "Starting DistroHopper GUI..."
|
|
||||||
run_gui
|
|
||||||
fi
|
|
||||||
|
|
||||||
some_bugs
|
some_bugs
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue