mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-19 22:50:08 +08:00
Merge 4dc217bd5c into adef6cd4af
This commit is contained in:
commit
a1a4330034
@ -1,27 +1,32 @@
|
|||||||
## Linux 安装
|
## Linux Installation
|
||||||
|
|
||||||
### Debian 系发行版
|
For installation, you can use this script:
|
||||||
|
```sh
|
||||||
|
sh install-nekoray.sh
|
||||||
|
```
|
||||||
|
|
||||||
使用 Debian 系发行版时,推荐使用 .deb 包安装:
|
### Debian-Based Distributions
|
||||||
|
|
||||||
|
For Debian-based distributions, it is recommended to use the `.deb` package for installation:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo apt install ./nekoray-*-debian-x64.deb
|
sudo apt install ./nekoray-*-debian-x64.deb
|
||||||
```
|
```
|
||||||
|
|
||||||
安装完成后,桌面快捷方式启动自带参数 `-appdata`,如果想要直接启动并使用之前的配置,注意附带本参数。
|
After installation, the desktop shortcut will launch with the `-appdata` parameter. If you want to launch directly and use previous configurations, make sure to include this parameter.
|
||||||
|
|
||||||
### Arch 系发行版
|
### Arch-Based Distributions
|
||||||
|
|
||||||
使用 Arch 系发行版时,推荐从 ```aur``` 或 ```archlinuxcn``` 安装:
|
For Arch-based distributions, it is recommended to install from `AUR` or `archlinuxcn`:
|
||||||
|
|
||||||
#### AUR
|
#### AUR
|
||||||
##### 最新稳定版
|
##### Latest Stable Version
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
[yay/paru] -S nekoray
|
[yay/paru] -S nekoray
|
||||||
```
|
```
|
||||||
|
|
||||||
##### 最新 Git 版 (开发版)
|
##### Latest Git Version (Development Version)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
[yay/paru] -S nekoray-git
|
[yay/paru] -S nekoray-git
|
||||||
@ -29,53 +34,61 @@ sudo apt install ./nekoray-*-debian-x64.deb
|
|||||||
|
|
||||||
#### archlinuxcn
|
#### archlinuxcn
|
||||||
|
|
||||||
##### 最新稳定版
|
##### Latest Stable Version
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo pacman -S nekoray
|
sudo pacman -S nekoray
|
||||||
```
|
```
|
||||||
|
|
||||||
##### 最新 Git 版 (开发版)
|
##### Latest Git Version (Development Version)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo pacman -S nekoray-git
|
sudo pacman -S nekoray-git
|
||||||
```
|
```
|
||||||
|
|
||||||
### 其他发行版
|
### Other Distributions
|
||||||
|
|
||||||
下载 .zip 文件,解压到合适的路径,开箱即用。
|
Download the `.zip` file, extract it to a suitable directory, and use it right away.
|
||||||
|
|
||||||
或下载 .AppImage,并使用 `chmod +x nekoray-*-AppImage-x64.AppImage` 给予可执行权限。
|
Alternatively, download the `.AppImage` file and grant execution permissions using:
|
||||||
|
|
||||||
具体使用方法见下文。
|
```shell
|
||||||
|
chmod +x nekoray-*-AppImage-x64.AppImage
|
||||||
|
```
|
||||||
|
|
||||||
## Linux 运行
|
Refer to the following sections for detailed usage instructions.
|
||||||
|
|
||||||
**使用 Linux 系统相信您已具备基本的排错能力,
|
## Linux Usage
|
||||||
本项目不提供特定发行版/架构的支持,预编译文件不能满足您的需求时,请自行编译/适配。**
|
|
||||||
|
|
||||||
已知部分 Linux 发行版无法使用、非 x86_64 暂无适配,可以尝试自行编译。
|
**Using a Linux system implies that you have basic troubleshooting skills.
|
||||||
|
This project does not provide specific support for distributions/architectures. If the precompiled files do not meet your needs, please compile/adjust them yourself.**
|
||||||
|
|
||||||
目前 Release 便携包解压后,有两种使用方法:
|
Note: Some Linux distributions are known to be incompatible, and there is no current support for non-x86_64 architectures. You may attempt to compile the software yourself.
|
||||||
|
|
||||||
1. System: 若要使用系统的 Qt5 运行库,请执行 `./nekoray`
|
For the current release, portable packages can be used in two ways after extraction:
|
||||||
2. Bundle: 若要使用预编译的 Qt 运行库,请执行 `./launcher`
|
|
||||||
|
|
||||||
### Bundle
|
1. **System Mode**: To use the system's Qt5 runtime library, execute `./nekoray`.
|
||||||
|
2. **Bundle Mode**: To use the precompiled Qt runtime library, execute `./launcher`.
|
||||||
|
|
||||||
要求:已安装主流的发行版和 xcb 桌面环境。
|
### Bundle Mode
|
||||||
|
|
||||||
运行: `./launcher` 或 部分系统可双击打开
|
**Requirements**: A mainstream distribution with an xcb desktop environment installed.
|
||||||
|
|
||||||
launcher 参数
|
**Run**: Execute `./launcher`, or double-click to open on some systems.
|
||||||
|
|
||||||
* `./launcher -- -appdata` ( `--` 后的参数传递给主程序 )
|
Launcher parameters:
|
||||||
* `-debug` Debug mode
|
|
||||||
|
|
||||||
Ubuntu 22.04: `sudo apt install libxcb-xinerama0`
|
- `./launcher -- -appdata` (Parameters after `--` are passed to the main program.)
|
||||||
|
- `-debug` Debug mode
|
||||||
|
|
||||||
### System
|
For Ubuntu 22.04:
|
||||||
|
```shell
|
||||||
|
sudo apt install libxcb-xinerama0
|
||||||
|
```
|
||||||
|
|
||||||
要求:已安装主流的发行版和 xcb 桌面环境,已安装 Qt5.12 ~ Qt5.15 环境。
|
### System Mode
|
||||||
|
|
||||||
|
**Requirements**: A mainstream distribution with an xcb desktop environment installed and a Qt5.12 ~ Qt5.15 environment set up.
|
||||||
|
|
||||||
|
**Run**: Execute `./nekoray`, or double-click to open on some systems. If it fails to run, it is recommended to use the Bundle version.
|
||||||
|
|
||||||
运行: `./nekoray` 或 部分系统可双击打开。如果无法运行,建议使用 Bundle 版。
|
|
||||||
|
|||||||
162
docs/install-nekoray.sh
Executable file
162
docs/install-nekoray.sh
Executable file
@ -0,0 +1,162 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
NEKORAY_URL="https://api.github.com/repos/MatsuriDayo/nekoray/releases"
|
||||||
|
NEKORAY_FILE_NAME="NekoRay"
|
||||||
|
NEKORAY_DESKTOPFILE="$HOME/.local/share/applications/nekoray.desktop"
|
||||||
|
WGET_TIMEOUT="15"
|
||||||
|
|
||||||
|
# Colors for terminal output
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
# ASCII Banner
|
||||||
|
echo -e "\n${GREEN}NekoRay Installer${NC}\n"
|
||||||
|
|
||||||
|
# Function to check prerequisites
|
||||||
|
check_prerequisites() {
|
||||||
|
if ! command -v unzip &> /dev/null; then
|
||||||
|
echo -e "unzip is not installed.\nInstall unzip in your system.\nFor example: sudo apt install unzip"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! command -v wget &> /dev/null; then
|
||||||
|
echo -e "wget is not installed.\nInstall wget in your system.\nFor example: sudo apt install wget"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install NekoRay
|
||||||
|
install_nekoray() {
|
||||||
|
# Fetch available versions
|
||||||
|
echo "Fetching available versions..."
|
||||||
|
VERSIONS=$(wget --timeout=$WGET_TIMEOUT -q -O- $NEKORAY_URL | grep -Eo '"tag_name": "[^"]+' | cut -d '"' -f 4)
|
||||||
|
|
||||||
|
if [ -z "$VERSIONS" ]; then
|
||||||
|
echo "Failed to fetch available versions. Please check your internet connection or the repository URL."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ask user to select a version
|
||||||
|
echo "Available versions:"
|
||||||
|
select VERSION in $VERSIONS; do
|
||||||
|
if [ -n "$VERSION" ]; then
|
||||||
|
echo "You selected version: $VERSION"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "Invalid selection. Please choose a valid version."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Fetch the download URL
|
||||||
|
echo "Fetching download URL for version: $VERSION"
|
||||||
|
DOWNLOAD_URL=$(wget --timeout=$WGET_TIMEOUT -q -O- $NEKORAY_URL |
|
||||||
|
grep -E "browser_download_url" |
|
||||||
|
grep "$VERSION" |
|
||||||
|
grep "linux64" |
|
||||||
|
head -n 1 |
|
||||||
|
cut -d '"' -f 4)
|
||||||
|
|
||||||
|
if [ -z "$DOWNLOAD_URL" ]; then
|
||||||
|
echo "Failed to find download URL for version $VERSION."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Debugging: Print download URL
|
||||||
|
echo "Download URL: $DOWNLOAD_URL"
|
||||||
|
|
||||||
|
# Download the file
|
||||||
|
echo "Downloading NekoRay..."
|
||||||
|
if ! wget --timeout=$WGET_TIMEOUT -q --show-progress --progress=bar:force -O /tmp/nekoray.zip "$DOWNLOAD_URL"; then
|
||||||
|
echo "Failed to download NekoRay from $DOWNLOAD_URL."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract the file
|
||||||
|
echo "Extracting NekoRay..."
|
||||||
|
if ! unzip /tmp/nekoray.zip -d "$HOME/$NEKORAY_FILE_NAME"; then
|
||||||
|
echo "Failed to extract the downloaded file."
|
||||||
|
rm /tmp/nekoray.zip
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
rm /tmp/nekoray.zip
|
||||||
|
|
||||||
|
# Check for renamed executable and icon
|
||||||
|
EXECUTABLE_PATH="$HOME/$NEKORAY_FILE_NAME/nekoray/nekoray"
|
||||||
|
ICON_PATH="$HOME/$NEKORAY_FILE_NAME/nekoray/nekoray.png"
|
||||||
|
|
||||||
|
if [ ! -f "$EXECUTABLE_PATH" ]; then
|
||||||
|
EXECUTABLE_PATH="$HOME/$NEKORAY_FILE_NAME/nekoray/nekobox"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$ICON_PATH" ]; then
|
||||||
|
ICON_PATH="$HOME/$NEKORAY_FILE_NAME/nekoray/nekobox.png"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create Desktop icon for current user
|
||||||
|
[ -e "$NEKORAY_DESKTOPFILE" ] && rm "$NEKORAY_DESKTOPFILE"
|
||||||
|
|
||||||
|
echo "Creating desktop entry..."
|
||||||
|
cat <<EOT >> "$NEKORAY_DESKTOPFILE"
|
||||||
|
[Desktop Entry]
|
||||||
|
Name=NekoRay
|
||||||
|
Comment=NekoRay
|
||||||
|
Exec=$EXECUTABLE_PATH
|
||||||
|
Icon=$ICON_PATH
|
||||||
|
Terminal=false
|
||||||
|
StartupWMClass=NekoRay,nekoray,Nekoray,nekoRay
|
||||||
|
Type=Application
|
||||||
|
Categories=Network
|
||||||
|
EOT
|
||||||
|
|
||||||
|
# Set permissions
|
||||||
|
echo "Setting permissions..."
|
||||||
|
chown "$USER:$USER" "$HOME/$NEKORAY_FILE_NAME/" -R
|
||||||
|
chmod +x "$EXECUTABLE_PATH" -R
|
||||||
|
|
||||||
|
echo -e "\nDone! NekoRay version $VERSION installed. Type 'NekoRay' in your desktop search to launch it."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to remove NekoRay
|
||||||
|
remove_nekoray() {
|
||||||
|
if [ -d "$HOME/$NEKORAY_FILE_NAME" ]; then
|
||||||
|
echo "Removing NekoRay..."
|
||||||
|
rm -rf "$HOME/$NEKORAY_FILE_NAME"
|
||||||
|
[ -e "$NEKORAY_DESKTOPFILE" ] && rm "$NEKORAY_DESKTOPFILE"
|
||||||
|
echo "NekoRay has been removed."
|
||||||
|
else
|
||||||
|
echo "NekoRay is not installed."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to upgrade NekoRay
|
||||||
|
upgrade_nekoray() {
|
||||||
|
echo "Upgrading NekoRay..."
|
||||||
|
remove_nekoray
|
||||||
|
install_nekoray
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main menu
|
||||||
|
echo "Choose an option:"
|
||||||
|
echo "1) Install NekoRay"
|
||||||
|
echo "2) Remove NekoRay"
|
||||||
|
echo "3) Upgrade NekoRay"
|
||||||
|
read -rp "Enter your choice: " CHOICE
|
||||||
|
|
||||||
|
case $CHOICE in
|
||||||
|
1)
|
||||||
|
check_prerequisites
|
||||||
|
install_nekoray
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
remove_nekoray
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
check_prerequisites
|
||||||
|
upgrade_nekoray
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid choice. Exiting."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user