fix: structure issues

This commit is contained in:
zenobit 2023-03-24 06:57:02 +01:00
parent 48ba3e48e7
commit 4e18988ce4
1 changed files with 31 additions and 33 deletions

64
dh
View File

@ -23,14 +23,32 @@ Possible arguments:
---------------------------------------------------------" ---------------------------------------------------------"
} }
portable() {
[ -f "$DH_CONFIG" ] && mode_installed || mode_portable
}
mode_portable() {
VMS_DIR="$(pwd)"
DH_CONFIG_DIR="$(pwd)"
DH_ICON_DIR="$(pwd)/icons"
prefix=./
export "VMS_DIR" "DH_CONFIG_DIR" "DH_ICON_DIR" "TERMINAL" "replace" "prefix"
}
mode_installed() {
source "$DH_CONFIG"
prefix=
export "prefix"
}
# installation # installation
check_gui_dependencies() { check_gui_dependencies() {
[ -f "$PREFIX/yad" ] && echo "yad is here" || echo "You are missing yad... [ -f "$PREFIX/yad" ] || echo "You are missing yad...
It's needed for GUI!" It's needed for GUI!"
} }
check_tui_dependencies() { check_tui_dependencies() {
[ -f "$PREFIX/fzf" ] && echo "fzf is here" || echo "You are missing fzf... [ -f "$PREFIX/fzf" ] || echo "You are missing fzf...
It's needed for TUI!" It's needed for TUI!"
} }
@ -55,14 +73,11 @@ set_variables() {
} }
create_structure() { create_structure() {
source distrohopper.conf
echo "creating config dir..." echo "creating config dir..."
mkdir -p "$DH_CONFIG_DIR" mkdir -p "$DH_CONFIG_DIR"
echo "creating ready dir..."
mkdir -p "$DH_CONFIG_DIR/ready"
echo "creating supported dir..."
mkdir -p "$DH_CONFIG_DIR/supported"
echo "creating icons dir as root..." echo "creating icons dir as root..."
sudo mkdir -p "$DH_ICON_DIR" mkdir -p "$DH_ICON_DIR" >/dev/null 2>&1 || sudo mkdir -p "$DH_ICON_DIR"
} }
set_dir() { set_dir() {
@ -78,39 +93,22 @@ install_prereq() {
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 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
} }
portable() {
[ -f "$DH_CONFIG" ] && mode_installed || mode_portable
}
mode_portable() {
VMS_DIR="$(pwd)"
DH_CONFIG_DIR="$(pwd)"
DH_ICON_DIR="$(pwd)/icons"
prefix=./
export "VMS_DIR" "DH_CONFIG_DIR" "DH_ICON_DIR" "TERMINAL" "replace" "prefix"
}
mode_installed() {
source "$DH_CONFIG"
prefix=
export "prefix"
}
install_dh() { install_dh() {
source distrohopper.conf cp dh quickget quickemu macrecovery windowskey "$PREFIX" >/dev/null 2>&1 || sudo cp dh quickget quickemu macrecovery windowskey "$PREFIX"
sudo cp dh quickget quickemu macrecovery windowskey "$PREFIX"
# quickget also to config directory for adding new distros... # quickget also to config directory for adding new distros...
cp quickget "$DH_CONFIG_DIR" cp quickget "$DH_CONFIG_DIR/"
echo "copying icons to root..." echo "Copying icons..."
sudo cp "icons/"* "$DH_ICON_DIR/" cp icons/* "$DH_ICON_DIR/" >/dev/null 2>&1 || sudo cp icons/* "$DH_ICON_DIR/"
echo "copying to config dir..." echo "Copying to config dir..."
cp -r * "$DH_CONFIG_DIR/" cp -r ready "$DH_CONFIG_DIR/"
cp -r supported "$DH_CONFIG_DIR/"
} }
install_process() { install_process() {
check_tui_dependencies check_tui_dependencies
check_gui_dependencies check_gui_dependencies
check_quickemu_dependencies #check_quickemu_dependencies
echo "Creating directory structure..." \ echo "Creating directory structure..." \
&& create_structure \ && create_structure \
&& echo "Setting up directory..." \ && echo "Setting up directory..." \