feat: nekoray app downloader function
This commit is contained in:
parent
f86f0108bc
commit
0e54e4f2d0
5 changed files with 61 additions and 11 deletions
|
@ -12,7 +12,7 @@ window {
|
||||||
|
|
||||||
window>box {
|
window>box {
|
||||||
min-height: 30px;
|
min-height: 30px;
|
||||||
margin: 4px;
|
margin: 6px;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
padding: 5px 4px;
|
padding: 5px 4px;
|
||||||
background-color: @backgrounddark;
|
background-color: @backgrounddark;
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
#workspaces,
|
|
||||||
#tray {
|
|
||||||
padding: 0px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#tray menu * {
|
#tray menu * {
|
||||||
all: unset;
|
all: unset;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +22,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#workspaces * {
|
#workspaces * {
|
||||||
font-size: 11px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#workspaces button {
|
#workspaces button {
|
||||||
|
|
12
scripts/app-installer/nekoray.sh
Executable file
12
scripts/app-installer/nekoray.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ../utils/main.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
|
||||||
|
}
|
||||||
|
|
||||||
|
install_nekoray
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source ../utils/main.sh
|
|
|
@ -4,7 +4,7 @@ log() {
|
||||||
local timestamp=$(date +"%T")
|
local timestamp=$(date +"%T")
|
||||||
local message="======> $1 : $timestamp"
|
local message="======> $1 : $timestamp"
|
||||||
|
|
||||||
echo -e "\n$message"
|
echo -e "\n$message\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_sudo() {
|
check_sudo() {
|
||||||
|
@ -20,3 +20,49 @@ check() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_command() {
|
||||||
|
if ! command -v $1 &>/dev/null; then
|
||||||
|
log "$1 is not installed. Please install $1 to continue."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ask_prompt() {
|
||||||
|
local question="$1"
|
||||||
|
while true; do
|
||||||
|
read -p "$question (Y/N): " choice
|
||||||
|
case "$choice" in
|
||||||
|
[Yy]) return 0 ;;
|
||||||
|
[Nn]) return 1 ;;
|
||||||
|
*) echo "Please enter Y or N." ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
download_file() {
|
||||||
|
check_command wget
|
||||||
|
|
||||||
|
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
|
||||||
|
echo "Continuing with existing file: $file_path"
|
||||||
|
wget -c -O "$tmp_dir/$filename" "$url"
|
||||||
|
else
|
||||||
|
echo "Deleted existing file: $file_path"
|
||||||
|
wget -O "$tmp_dir/$filename" "$url"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
wget -O "$tmp_dir/$filename" "$url"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "File downloaded successfully: $tmp_dir/$filename"
|
||||||
|
else
|
||||||
|
echo "Failed to download file from $url"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue