Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

biliup命令安装 #338

Open
itgoyo opened this issue Nov 19, 2023 · 1 comment
Open

biliup命令安装 #338

itgoyo opened this issue Nov 19, 2023 · 1 comment

Comments

@itgoyo
Copy link
Owner

itgoyo commented Nov 19, 2023

wget -O install.sh https://image.biliup.me/install.sh && chmod +x install.sh && bash install.sh

#!/bin/bash

# ANSI转义码,设置高亮
highlight="\e[1;31m"  # 1是高亮,31是红色
reset="\e[0m"         # 重置文字属性

# 获取终端宽度
columns=$(tput cols)

# 要显示的 ASCII 艺术
ascii_art='
     _      _  _  _               
    | |    (_)| |(_)              
    | |__   _ | | _  _   _  _ __  
    | '"'"'_ \ | || || || | | || '"'"'_ \ 
    | |_) || || || || |_| || |_) |
    |_.__/ |_||_||_| \__,_|| .__/ 
                           | |    
                           |_|
    biliup社区论坛:https://biliup.me'

# 计算居中的空格数量
padding=$((($columns - 47) / 2))

# 显示居中的 ASCII 艺术
echo -e "${highlight}$(echo "$ascii_art" | sed "s/^/$(printf "%${padding}s")/")${reset}"

read -p "是否要启用安装脚本?(Y/N): " choice
if [ "$choice" = "Y" ] || [ "$choice" = "y" ]; then
    echo -e "${highlight}启用安装脚本...${reset}"

    set -e

    echo -e "${highlight}开始更新软件包列表...${reset}"
    apt update && apt upgrade -y
    echo -e "${highlight}软件包列表更新完成。${reset}"

    echo -e "${highlight}开始安装 python3-dev...${reset}"
    apt install -y python3-dev
    echo -e "${highlight}python-dev 安装完成。${reset}"

    echo -e "${highlight}开始安装 ffmpeg...${reset}"
    apt install -y ffmpeg
    echo -e "${highlight}ffmpeg 安装完成。${reset}"

    echo -e "${highlight}开始安装 nodejs...${reset}"
    apt install -y nodejs
    echo -e "${highlight}nodejs 安装完成。${reset}"

    echo -e "${highlight}开始安装 pip...${reset}"
    apt install -y python3-pip
    echo -e "${highlight}pip 安装完成。${reset}"

    # 获取Python3的版本号
    python_version=$(python3 --version | cut -d " " -f2)

    # 使用sort命令和版本比较来决定使用哪个pip命令
    if printf '3.11\n%s' "$python_version" | sort -V | head -n1 | grep -q '3.11'; then
        echo -e "${highlight}Python3的版本是 $python_version, 使用pip install --break-system-packages来安装...${reset}"
        pip_install_cmd="pip install --break-system-packages"
    else
        echo -e "${highlight}Python3的版本是 $python_version, 使用标准pip install来安装...${reset}"
        pip_install_cmd="pip install"
    fi

    # 使用之前选择的命令来安装 biliup
    country=$(curl -s ipinfo.io/country)
    if [ "$country" = "CN" ]; then
        echo -e "${highlight}您的 IP 地址显示为中国,正在使用南阳理工镜像源安装 biliup...${reset}"
        sudo PIP_INDEX_URL=https://mirror.nyist.edu.cn/pypi/web/simple/ $pip_install_cmd biliup
    else
        echo -e "${highlight}您的 IP 地址显示为非中国,正在使用默认源安装 biliup...${reset}"
        $pip_install_cmd biliup
    fi

    echo -e "${highlight}所有安装步骤完成!!${reset}"
else
    echo -e "${highlight}已取消安装脚本。${reset}"
fi
@itgoyo
Copy link
Owner Author

itgoyo commented Feb 28, 2024

sudo vim /lib/systemd/system/frpc.service

[Unit]
Description=frpc
Wants=network-online.target
After=network.target network-online.target
Requires=network-online.target
[Service]
ExecStart=/home/itgoyo/frpc -c /home/itgoyo/frpc.ini
ExecStop=/bin/kill $MAINPID
Restart=always
RestartSec=5
StartLimitInterval=0
[Install]
WantedBy=multi-user.target

开启服务
systemctl start frpc
开机自启动
systemctl enable frpc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant