#!/bin/sh

red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'

# 横幅
echo -e "${yellow}  ___    ___ ___  ___  ___       __   ________  ________      ${plain}"
echo -e "${yellow} |\\  \\  /  /|\\  \\|\\  \\|\\  \\     |\\  \\|\\   __  \\|\\   ___  \\    ${plain}"
echo -e "${yellow} \\ \\  \\/  / \\ \\  \\\\\\  \\ \\  \\    \\ \\  \\ \\  \\|\\  \\ \\  \\\\ \\  \\   ${plain}"
echo -e "${yellow}  \\ \\    / / \\ \\  \\\\\\  \\ \\  \\  __\\ \\  \\ \\   __  \\ \\  \\\\ \\  \\  ${plain}"
echo -e "${yellow}   \\/  /  /   \\ \\  \\\\\\  \\ \\  \\|\\__\\_\\  \\ \\  \\ \\  \\ \\  \\\\ \\  \\ ${plain}"
echo -e "${yellow} __/  / /      \\ \\_______\\ \\____________\\ \\__\\ \\__\\ \\__\\\\ \\__\\"
echo -e "${yellow}|\\___/ /        \\|_______|\\|____________|\\|__|\\|__|\\|__| \\|__|${plain}"
echo -e "${yellow}\\|___|/${plain}"
echo -e "-------------------------" 
# 命令菜单
echo -e  "${red}请选择要执行的操作：${plain}"
echo -e "${green}1. 安装Alpine Xrayr${plain}"
echo -e "${green}2. 安装Alpine V2bX${plain}"
echo -e "${green}3. 安装Alpine X-ui${plain}"
echo -e "${green}4. 重启Alpine-XrayR${plain}"
echo -e "${green}5. 更新脚本${plain}"
echo -e "${yellow}*. 退出${plain}"

# 读取用户输入
read -p "请输入选项数字:" choice
# 执行用户选择的操作
case "$choice" in
    1)
        echo "正在执行安装Alpine Xrayr..."
        wget -N https://github.com/Cd1s/alpineXrayR/releases/download/one-click/install-xrayr.sh && chmod +x install-xrayr.sh && bash install-xrayr.sh
        ;;
    2)
        echo "正在执行安装Alpine V2bX..."
        wget https://raw.githubusercontent.com/yuwan027/AlpineV2bX/master/AlpineV2bX.sh && bash AlpineV2bX.sh
        ;;
    3)
        echo "正在执行安装Alpine X-ui..."
        apk add curl && apk add bash && bash <(curl -Ls https://raw.githubusercontent.com/Lynn-Becky/Alpine-x-ui/main/alpine-xui.sh)
        ;;
    4)
        echo "正在执行重启 Alpine-XrayR..."
        /etc/init.d/XrayR restart
        ;;
    5)
        echo "正在拉取更新"
        wget --no-check-certificate -O /root/alpine.sh https://script.yuwan.org/alpine.sh
	cp /root/alpine.sh /usr/local/bin/alpine
	chmod +x /usr/local/bin/alpine
	chmod +x /root/alpine.sh
	;;
    *)
        echo "无效的选择，请重新运行脚本并输入有效的选项。"
        exit 0
	;;
esac

