mirror of
https://github.imc.re/void-land/hyprland-void-dots
synced 2025-04-26 17:33:43 +02:00
refactor: scripts
This commit is contained in:
parent
67ff5b5f9f
commit
bdfc365ebb
5 changed files with 1 additions and 103 deletions
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source ../utils/init.sh
|
|
||||||
|
|
||||||
DOWNLOAD_URL="https://github.com/MatsuriDayo/nekoray/releases/download/3.26/nekoray-3.26-2023-12-09-linux64.zip"
|
|
||||||
FILE_NAME="nekoray.zip"
|
|
||||||
|
|
||||||
install_nekoray() {
|
|
||||||
download_file "$DOWNLOAD_URL" "$FILE_NAME"
|
|
||||||
extract_file "/tmp/$FILE_NAME"
|
|
||||||
move_to_opt "/tmp/nekoray"
|
|
||||||
}
|
|
||||||
|
|
||||||
install_nekoray
|
|
|
@ -54,91 +54,3 @@ ask_prompt() {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
download_file() {
|
|
||||||
check_command wget
|
|
||||||
params_required "URL" "$1"
|
|
||||||
|
|
||||||
local url="$1"
|
|
||||||
local tmp_dir="/tmp"
|
|
||||||
local filename="${2:-$(basename "$url")}"
|
|
||||||
local file_path="$tmp_dir/$filename"
|
|
||||||
|
|
||||||
if [ -e "$file_path" ]; then
|
|
||||||
if ask_prompt "File $file_path already exists. Do you want to continue ?"; then
|
|
||||||
log "Continuing with existing file: $file_path"
|
|
||||||
wget -q --show-progress -c -O "$tmp_dir/$filename" "$url"
|
|
||||||
else
|
|
||||||
log "Deleted existing file: $file_path"
|
|
||||||
wget -q --show-progress -O "$tmp_dir/$filename" "$url"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
wget -q --show-progress -O "$tmp_dir/$filename" "$url"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
log "File downloaded successfully: $tmp_dir/$filename"
|
|
||||||
else
|
|
||||||
log "Failed to download file from $url"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
extract_file() {
|
|
||||||
params_required "File" "$1"
|
|
||||||
check_command unzip
|
|
||||||
|
|
||||||
local file_path="$1"
|
|
||||||
local tmp_dir="/tmp"
|
|
||||||
local target_destination=${2:-$tmp_dir}
|
|
||||||
|
|
||||||
if [ ! -e $file_path ]; then
|
|
||||||
log "File $file_path not found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
unzip -o $file_path -d $target_destination
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
log "File extracted successfully: $tmp_dir/$file_path"
|
|
||||||
else
|
|
||||||
log "Failed to extract file !"
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
move_to_opt() {
|
|
||||||
params_required "Source" "$1"
|
|
||||||
|
|
||||||
local source_path="$1"
|
|
||||||
|
|
||||||
if [ -z "$source_path" ]; then
|
|
||||||
log "No source path provided."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "$source_path" ]; then
|
|
||||||
log "Source path '$source_path' does not exist."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$source_path" ] && [ ! -f "$source_path" ]; then
|
|
||||||
log "Source path '$source_path' is neither a directory nor a file."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local filename="$(basename "$source_path")"
|
|
||||||
local destination="/opt/$filename"
|
|
||||||
|
|
||||||
if [ -e "$destination" ]; then
|
|
||||||
if ask_prompt "File or directory '$destination' already exists in /opt. Do you want to cancel ?"; then
|
|
||||||
log "Continuing with existing file or directory: $destination"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
log "Deleting existing file or directory: $destination"
|
|
||||||
sudo rm -rf "$destination"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
sudo mv "$source_path" "$destination"
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
2
stow.sh
2
stow.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source .scripts/utils/init.sh
|
source .scripts/utils/init.sh
|
||||||
source .scripts/utils/_links.sh
|
source .scripts/utils/_symlinks.sh
|
||||||
|
|
||||||
DOTS_CONFIG_DIR="$(pwd)/linux-configs"
|
DOTS_CONFIG_DIR="$(pwd)/linux-configs"
|
||||||
DOTFILES_DIR="$DOTS_CONFIG_DIR/dotfiles"
|
DOTFILES_DIR="$DOTS_CONFIG_DIR/dotfiles"
|
||||||
|
|
Loading…
Add table
Reference in a new issue