chore: add install script

This commit is contained in:
Vincent Young 2023-02-12 10:04:18 +08:00
parent 45353b6b4d
commit 4ba2339d2f
3 changed files with 47 additions and 1 deletions

View File

@ -2,7 +2,7 @@
* @Author: Vincent Young
* @Date: 2022-10-18 07:32:29
* @LastEditors: Vincent Young
* @LastEditTime: 2023-02-12 09:29:40
* @LastEditTime: 2023-02-12 10:03:26
* @FilePath: /DeepLX/README.md
* @Telegram: https://t.me/missuo
*
@ -30,6 +30,11 @@ Permanently free DeepL API written in Golang
"data": "Hello world",
"id": 8305092005
}
```
### Run on Server
```bash
bash <(curl -Ls https://cpp.li/deeplx)
```
### Run on Mac

14
deeplx.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=DeepLX Service
After=network.target nss-lookup.target
Wants=network.target
[Service]
User=root
Group=root
Type=simple
WorkingDirectory=/usr/bin/
ExecStart=/usr/bin/deeplx
[Install]
WantedBy=multi-user.target

27
install.sh Normal file
View File

@ -0,0 +1,27 @@
###
# @Author: Vincent Young
# @Date: 2023-02-12 09:53:21
# @LastEditors: Vincent Young
# @LastEditTime: 2023-02-12 10:01:57
# @FilePath: /DeepLX/install.sh
# @Telegram: https://t.me/missuo
#
# Copyright © 2023 by Vincent, All Rights Reserved.
###
install_deeplx(){
last_version=$(curl -Ls "https://api.github.com/repos/OwO-Network/DeepLX/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [[ ! -n "$last_version" ]]; then
echo -e "${red}Failed to detect DeepLX version, probably due to exceeding Github API limitations.${plain}"
exit 1
fi
echo -e "DeepLX latest version: ${last_version}, Start install..."
wget -q -N --no-check-certificate -O /usr/bin/deeplx https://github.com/OwO-Network/DeepLX/releases/download/${last_version}/deeplx_linux_amd64
chmod +x /usr/bin/deeplx
wget -q -N --no-check-certificate -O /etc/systemd/system/deeplx.service https://raw.githubusercontent.com/OwO-Network/DeepLX/main/deeplx.service
systemctl daemon-reload
systemctl enable deeplx
echo -e "Installed successfully, listening at 0.0.0.0:1188"
}
install_deeplx