#!/usr/bin/env bash export DEBIAN_FRONTEND=noninteractive progress_bar_task() { local pid="$1" local label="$2" local width=40 local percent=0 while kill -0 "$pid" 2>/dev/null; do percent=$((percent + 1)) ((percent > 99)) && percent=99 local filled=$((percent * width / 100)) local empty=$((width - filled)) printf "\r\033[K" >&2 printf "[%s] [" "$label" >&2 printf "\033[42m%${filled}s\033[0m" "" | tr ' ' ' ' >&2 printf "%${empty}s" "" >&2 printf "] %3d%%" "$percent" >&2 sleep 0.2 done printf "\r\033[K[%s] [" "$label" >&2 printf "\033[42m%${width}s\033[0m" "" | tr ' ' ' ' >&2 printf "] 100%%\n" >&2 } cecho() { local color="$1" local style="$2" local text if [[ $# -eq 2 ]]; then text="$2" style="" else text="$3" fi local code="" case "$color" in black) code="30" ;; red) code="31" ;; green) code="32" ;; yellow) code="33" ;; blue) code="34" ;; purple) code="35" ;; cyan) code="36" ;; white) code="37" ;; *) code="0" ;; esac case "$style" in bold) code="1;${code}" ;; dim) code="2;${code}" ;; underline) code="4;${code}" ;; esac printf "\033[%sm%s\033[0m\n" "$code" "$text" >&2 } retry() { local max=3 local n=0 until "$@"; do ((n++)) if [[ $n -ge $max ]]; then cecho red bold "[FAIL] $*(已重试 $n 次)" return 1 fi cecho yellow "[RETRY] $*(第 $n 次)" sleep 2 done } apt_run() { local msg="$1" shift apt -o Dpkg::Progress-Fancy="0" "$@" >/dev/null 2>&1 & local pid=$! progress_bar_task "$pid" "$msg" wait "$pid" } clear cecho blue bold "╭────────────────── 初始开荒脚本 ──────────────────╮" cecho blue bold "│ │" cecho blue bold "├── 系统更新 │" cecho blue bold "│ │" cecho blue bold "╰──────────────────────────────────────────────────╯" apt_run "获取资源" update apt_run "更新" upgrade --only-upgrade -y clear cecho blue bold "╭────────────────── 初始开荒脚本 ──────────────────╮" cecho blue bold "│ │" cecho blue bold "├── 系统更新 │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 安装常用工具 │" cecho blue bold "│ │" cecho blue bold "╰──────────────────────────────────────────────────╯" TOOLS=( sudo curl wget vim git zip unzip jq tree lsof trash-cli npm tmux command-not-found uuid-runtime ca-certificates unzip iproute2 whois inetutils-traceroute bash-completion less psmisc file tzdata gnupg lsb-release dnsutils logrotate build-essential python3-pip ) for pkg in "${TOOLS[@]}"; do if dpkg -s "$pkg" >/dev/null 2>&1; then cecho green " —— $pkg 已安装" continue fi apt -o Dpkg::Progress-Fancy="0" install -y "$pkg" >/dev/null 2>&1 & pid=$! progress_bar_task "$pid" "$pkg" wait "$pid" if dpkg -s "$pkg" >/dev/null 2>&1; then cecho green " —— $pkg 已安装" else cecho yellow " —— $pkg 失败" apt_run "修复" --fix-broken install -y dpkg --configure -a >/dev/null 2>&1 apt -o Dpkg::Progress-Fancy="0" install -y "$pkg" >/dev/null 2>&1 & pid=$! progress_bar_task "$pid" "$pkg" wait "$pid" dpkg -s "$pkg" >/dev/null 2>&1 \ && cecho green " —— $pkg 已安装" \ || cecho red " —— $pkg 放弃 " fi done clear cecho blue bold "╭────────────────── 初始开荒脚本 ──────────────────╮" cecho blue bold "│ │" cecho blue bold "├── 系统更新 │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 安装常用工具 │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 环境设置 │" cecho blue bold "│ │" cecho blue bold "╰──────────────────────────────────────────────────╯" update-alternatives --set editor /usr/bin/vim.basic >/dev/null 2>&1 && \ DEBIAN_FRONTEND=noninteractive apt install -y unattended-upgrades \ >/dev/null 2>&1 printf "\n" >&2 dpkg-reconfigure --priority=low unattended-upgrades \ >/dev/null 2>&1 cat > /etc/ssh/sshd_config <<'EOF' #────────────────────────────────────────────────# Include /etc/ssh/sshd_config.d/*.conf #────────────────────────────────────────────────# Port 36222 #────────────────────────────────────────────────# ClientAliveInterval 30 ClientAliveCountMax 99999 TCPKeepAlive yes UseDNS no AllowAgentForwarding yes AllowTcpForwarding yes UsePAM yes X11Forwarding no GatewayPorts yes PrintMotd no #AddressFamily any ListenAddress 0.0.0.0 ListenAddress :: PermitRootLogin yes KbdInteractiveAuthentication no #────────────────────────────────────────────────# AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server #────────────────────────────────────────────────# PasswordAuthentication no PubkeyAuthentication yes #────────────────────────────────────────────────# EOF sed -i 's/^session\s\+optional\s\+pam_motd.so/#&/' /etc/pam.d/sshd sed -i 's/^session\s\+optional\s\+pam_motd.so/#&/' /etc/pam.d/login sed -i 's/^ENABLED=.*/ENABLED=0/' /etc/default/motd-news cat > ~/.bashrc <<'EOF' #────────────────────────────────────────────────────────────────────# case $- in *i*) ;; *) return;; esac #────────────────────────────────────────────────────────────────────# HISTCONTROL=ignoreboth shopt -s histappend HISTSIZE=1000 HISTFILESIZE=2000 shopt -s checkwinsize #────────────────────────────────────────────────────────────────────# [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" #────────────────────────────────────────────────────────────────────# if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi #────────────────────────────────────────────────────────────────────# case "$TERM" in xterm-color|*-256color) color_prompt=yes;; esac #────────────────────────────────────────────────────────────────────# force_color_prompt=yes #────────────────────────────────────────────────────────────────────# if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then color_prompt=yes else color_prompt= fi fi #────────────────────────────────────────────────────────────────────# if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;33m\]\u\[\033[00m\]:\[\033[01;31m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt #────────────────────────────────────────────────────────────────────# case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" ;; *) ;; esac #────────────────────────────────────────────────────────────────────# if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' alias dir='dir --color=auto' alias vdir='vdir --color=auto' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi #────────────────────────────────────────────────────────────────────# export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' alias ll='ls -alF' alias la='ls -A' alias l='ls -CF' alias nr='systemctl restart nginx' #────────────────────────────────────────────────────────────────────# alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' #────────────────────────────────────────────────────────────────────# if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi #────────────────────────────────────────────────────────────────────# if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi #────────────────────────────────────────────────────────────────────# export PNPM_HOME="/root/.local/share/pnpm" case ":$PATH:" in *":$PNPM_HOME:"*) ;; *) export PATH="$PNPM_HOME:$PATH" ;; esac #────────────────────────────────────────────────────────────────────# export BUN_INSTALL="$HOME/.bun" export PATH="$BUN_INSTALL/bin:$PATH" alias rm='trash-put' alias php81='php81 -c /www/server/php/81/etc/php-cli.ini' #────────────────────────────────────────────────────────────────────# EOF source ~/.bashrc echo "root:Cici080306" | chpasswd mkdir -p ~/.ssh echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE8JPWLWvE+kYH6vPHi3hsF4+vxTKLKmwnq8lFEmjOzE Vesper-SSH" >> ~/.ssh/authorized_keys echo 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMhyl2z6m5nPMze0pkZNDNLlXssvcyIk7o3WUjJXLYwv yomo@iPhone' >> ~/.ssh/authorized_keys chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys timedatectl set-timezone Asia/Shanghai >/dev/null 2>&1 locale >/dev/null 2>&1 locale-gen zh_CN.UTF-8 >/dev/null 2>&1 update-locale LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8 >/dev/null 2>&1 cat /etc/default/locale >/dev/null 2>&1 export LANG=zh_CN.UTF-8 >/dev/null 2>&1 export LC_ALL=zh_CN.UTF-8 >/dev/null 2>&1 apt_run "安装zh语言包" install -y language-pack-zh-hans touch /root/.cf_env cat > ~/.cf_env <<'EOF' # Origin CA Key export Origin_CA_KEY="v1.0-c8c47d058ef2d196a463d605-26b39c0f1330e6490ab0ffd0efffbe21bb9a93a595af7394ed742d74e00e72709747715c282ca3a6fce0da696cba6ca0c6367e5ef58b5878759ee682f7298c86dc9888a15070fdca44" # Global API Key export Global_KEY="d7e678f785abf1cb5bfe173742f7fa9098638" # 账户邮箱 export Account_EMAIL mal="shuhany86@gmail.com" # 账户ID export Account_ID="80251731ccbed19c45720db13181842a" # 区域ID--vesper36.top export ZONE_ID_36top="da90856d76f0d5016a89532f9e5ea1cc" # 区域ID--vesper36.com export ZONE_ID_36com="737bfad120bda700746bf0f91078c5bf" # 区域ID--vesper36.cc export ZONE_ID_36cc="d3d7e85c28c8998613036bdfe3e69ef2" # 区域ID--vesper36.filegear-sg.me export ZONE_ID_36sg_me="20c5acc7bd6049f654ca1fd15794a426" # DNS编辑(所有区域) export DNS_EDIT="7ZdYgMnD4t3cS1gVgS4rkUXHOE4t_DxIlXZytcne" # 读取账户所有资源 export READ_resources="Da2bIyh5poul2K-3HY17_Hkr9gelRfvTqOmV19Od" # 编辑负载平衡配置 export EDIT_balance="yZ_1c1DBtjfdkJW_QV8FZbfXRwvF8L07ovGTobqi" # 创建其他令牌 export CREATE_TOKENS="-Z4hJcMjXnykJYW9Olrz5yGxs2xshwkJBvvhQMJu" EOF chmod -R 777 ~/.cf_env source ~/.bashrc touch /root/DNS.sh cat > DNS.sh <<'EOF' #!/usr/bin/env bash #=================|基础环境|======================= export DEBIAN_FRONTEND=noninteractive clear echo " 【DNS 管理面板】 ---------------------------- 1. 查询域名所有 DNS 记录 2. 查询子域名 DNS 记录 3. 增加域名指向IP 4. 修改DNS指向IP 5. 删除DNS解析记录 ---------------------------- 0. 退出 ---------------------------- " read -p "请输入想要执行的动作 >>>" choice case $choice in 1) clear echo " 【查询域名所有 DNS 记录】 ----------------------------- 1. vesper36.top 2. vesper36.com 3. vesper36.cc 4. vesper36.filegear-sg.me ----------------------------- 0. 回到上一层 ----------------------------- " read -p "请输入想要执行的动作 >>>" DNSchoice case $DNSchoice in 1) echo "vesper36.top" && curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36top/dns_records" || echo "DNS记录不存在" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 2) echo "vesper36.com" && curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36com/dns_records" || echo "DNS记录不存在" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 3) echo "vesper36.cc" && curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36cc/dns_records" || echo "DNS记录不存在" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 4) echo "vesper36.filegear-sg.me"&& curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36sg_me/dns_records" || echo "DNS记录不存在" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 0) bash DNS.sh ;; esac ;; 2) clear echo " 【查询子域名 DNS 记录】 ----------------------------- 1. vesper36.top 2. vesper36.com 3. vesper36.cc 4. vesper36.filegear-sg.me ----------------------------- 0. 回到上一层 ----------------------------- " read -p "请选择主域名 >>>" dnschoice case $dnschoice in 0) bash DNS.sh ;; esac read -p "请输入子域名(不含主域名部分)>>>" choice2 case $choice2 in 0) bash DNS.sh ;; esac case $dnschoice in 1) echo "vesper36.top" && curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36top/dns_records?name=$choice2.vesper36.top" || echo "DNS记录不存在" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 2) echo "vesper36.com" && curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36com/dns_records?name=$choice2.vesper36.com" || echo "DNS记录不存在" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 3) echo "vesper36.cc" && curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36cc/dns_records?name=$choice2.vesper36.cc" || echo "DNS记录不存在" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 4) echo "vesper36.filegear-sg.me"&& curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36sg_me/dns_records?name=$choice2.vesper36.filegear-sg.me" || echo "DNS记录不存在" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 0) bash DNS.sh ;; esac ;; 3) clear echo " 【增加域名指向IP】 ----------------------------- 1. vesper36.top 2. vesper36.com 3. vesper36.cc 4. vesper36.filegear-sg.me ----------------------------- 0. 回到上一层 ----------------------------- " read -p "请选择主域名 >>>" dnschoice case $dnschoice in 0) bash DNS.sh ;; esac read -p "请输入子域名(不含主域名部分)>>>" choice2 case $choice2 in 0) bash DNS.sh ;; esac read -p "CF代理?[y]开启 [n]关闭>>>" CFDAILI case $CFDAILI in 0) bash DNS.sh ;; esac IPv4=$(ip route get 1.1.1.1 | awk '{for(i=1;i<=NF;i++) if($i=="src") print $(i+1)}') case $CFDAILI in y|yes|Yes|Y|YES) export CFDAILI=true export TTLCF=1 ;; n|NO|no|No|N) export CFDAILI=false export TTLCF=1120 ;; esac case $dnschoice in 1) curl -4 --http1.1 -X POST \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36top/dns_records"\ -H "Authorization: Bearer $DNS_EDIT" \ -H "Content-Type: application/json" \ --data "{ \"type\": \"A\", \"name\": \"$choice2.vesper36.top\", \"content\": \"$IPv4\", \"ttl\": $TTLCF, \"proxied\": $CFDAILI }" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 2) curl -4 --http1.1 -X POST \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36com/dns_records"\ -H "Authorization: Bearer $DNS_EDIT" \ -H "Content-Type: application/json" \ --data "{ \"type\": \"A\", \"name\": \"$choice2.vesper36.com\", \"content\": \"$IPv4\", \"ttl\": $TTLCF, \"proxied\": $CFDAILI }" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 3) curl -4 --http1.1 -X POST \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36cc/dns_records"\ -H "Authorization: Bearer $DNS_EDIT" \ -H "Content-Type: application/json" \ --data "{ \"type\": \"A\", \"name\": \"$choice2.vesper36.cc\", \"content\": \"$IPv4\", \"ttl\": $TTLCF, \"proxied\": $CFDAILI }" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 4) curl -4 --http1.1 -X POST \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36sg_me/dns_records"\ -H "Authorization: Bearer $DNS_EDIT" \ -H "Content-Type: application/json" \ --data "{ \"type\": \"A\", \"name\": \"$choice2.vesper36.filegear-sg.me\", \"content\": \"$IPv4\", \"ttl\": $TTLCF, \"proxied\": $CFDAILI }" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 0) bash DNS.sh ;; esac ;; 4) clear echo " 【修改DNS指向IP】 ----------------------------- 1. vesper36.top 2. vesper36.com 3. vesper36.cc 4. vesper36.filegear-sg.me ----------------------------- 0. 回到上一层 ----------------------------- " read -p "请选择主域名 >>>" dnschoice case $dnschoice in 0) bash DNS.sh ;; esac read -p "请输入子域名(不含主域名部分)>>>" choice2 case $choice2 in 0) bash DNS.sh ;; esac read -p "CF代理?[y]开启 [n]关闭>>>" CFDAILI case $CFDAILI in 0) bash DNS.sh ;; esac IPv4=$(ip route get 1.1.1.1 | awk '{for(i=1;i<=NF;i++) if($i=="src") print $(i+1)}') case $CFDAILI in y|yes|Yes|Y|YES) export CFDAILI=true export TTLCF=1 ;; n|NO|no|No|N) export CFDAILI=false export TTLCF=120 ;; esac apt install -y jq case $dnschoice in 1) RECORD_ID=$( curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36top/dns_records?name=$choice2.vesper36.top&type=A" \ | jq -r '.result[0].id' ) curl -4 --http1.1 -X PUT \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36top/dns_records/$RECORD_ID" \ -H "Authorization: Bearer $DNS_EDIT" \ -H "Content-Type: application/json" \ --data "{ \"type\": \"A\", \"name\": \"$choice2.vesper36.top\", \"content\": \"$IPv4\", \"ttl\": $TTLCF, \"proxied\": $CFDAILI }" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 2) RECORD_ID=$( curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36com/dns_records?name=$choice2.vesper36.com&type=A" \ | jq -r '.result[0].id' ) curl -4 --http1.1 -X PUT \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36com/dns_records/$RECORD_ID" \ -H "Authorization: Bearer $DNS_EDIT" \ -H "Content-Type: application/json" \ --data "{ \"type\": \"A\", \"name\": \"$choice2.vesper36.com\", \"content\": \"$IPv4\", \"ttl\": $TTLCF, \"proxied\": $CFDAILI }" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 3) RECORD_ID=$( curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36cc/dns_records?name=$choice2.vesper36.cc&type=A" \ | jq -r '.result[0].id' ) curl -4 --http1.1 -X PUT \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36cc/dns_records/$RECORD_ID" \ -H "Authorization: Bearer $DNS_EDIT" \ -H "Content-Type: application/json" \ --data "{ \"type\": \"A\", \"name\": \"$choice2.vesper36.cc\", \"content\": \"$IPv4\", \"ttl\": $TTLCF, \"proxied\": $CFDAILI }" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 4) RECORD_ID=$( curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36sg_me/dns_records?name=$choice2.vesper36.filegear-sg.me&type=A" \ | jq -r '.result[0].id' ) curl -4 --http1.1 -X PUT \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36sg_me/dns_records/$RECORD_ID" \ -H "Authorization: Bearer $DNS_EDIT" \ -H "Content-Type: application/json" \ --data "{ \"type\": \"A\", \"name\": \"$choice2.vesper36.filegear-sg.me\", \"content\": \"$IPv4\", \"ttl\": $TTLCF, \"proxied\": $CFDAILI }" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 0) bash DNS.sh ;; esac ;; 5) clear echo " 【删除DNS解析记录】 ----------------------------- 1. vesper36.top 2. vesper36.com 3. vesper36.cc 4. vesper36.filegear-sg.me ----------------------------- 0. 回到上一层 ----------------------------- " read -p "请选择主域名 >>>" dnschoice case $dnschoice in 0) bash DNS.sh ;; esac read -p "请输入子域名(不含主域名部分)>>>" choice2 case $choice2 in 0) bash DNS.sh ;; esac apt install -y jq >/dev/null 2>&1 case $dnschoice in 1) RECORD_ID=$( curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36top/dns_records?name=$choice2.vesper36.top&type=A" \ | jq -r '.result[0].id' ) curl -4 --http1.1 -X DELETE \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36top/dns_records/$RECORD_ID" \ -H "Authorization: Bearer $DNS_EDIT" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 2) RECORD_ID=$( curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36com/dns_records?name=$choice2.vesper36.com&type=A" \ | jq -r '.result[0].id' ) curl -4 --http1.1 -X DELETE \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36com/dns_records/$RECORD_ID" \ -H "Authorization: Bearer $DNS_EDIT" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 3) RECORD_ID=$( curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36cc/dns_records?name=$choice2.vesper36.cc&type=A" \ | jq -r '.result[0].id' ) curl -4 --http1.1 -X DELETE \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36cc/dns_records/$RECORD_ID" \ -H "Authorization: Bearer $DNS_EDIT" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 4) RECORD_ID=$( curl -4 --http1.1 -s \ -H "Authorization: Bearer $DNS_EDIT" \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36sg_me/dns_records?name=$choice2.vesper36.filegear-sg.me&type=A" \ | jq -r '.result[0].id' ) curl -4 --http1.1 -X DELETE \ "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_36sg_me/dns_records/$RECORD_ID" \ -H "Authorization: Bearer $DNS_EDIT" echo read -p "回车返回菜单 >>>" BACK bash DNS.sh ;; 0) bash DNS.sh ;; esac ;; 0) echo "bye---" ;; esac EOF chmod -R 777 DNS.sh cecho blue bold "Nginx" apt update -y >/dev/null 2>&1 && apt upgrade -y >/dev/null 2>&1 && apt install -y nginx >/dev/null 2>&1 && systemctl start nginx >/dev/null 2>&1 && systemctl enable nginx >/dev/null 2>&1 || \ cecho red " Nginx设置失败" curl -fsSL https://get.docker.com | sh systemctl start docker systemctl enable docker sudo apt install -y python3 \ python3-dev \ python3-venv \ libaugeas-dev \ gcc sudo python3 -m venv /opt/certbot/ sudo /opt/certbot/bin/pip install --upgrade pip sudo /opt/certbot/bin/pip install certbot certbot-nginx sudo ln -s /opt/certbot/bin/certbot /usr/local/bin/certbot clear cecho blue bold "╭────────────────── 初始开荒脚本 ──────────────────╮" cecho blue bold "│ │" cecho blue bold "├── 系统更新 │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 安装常用工具 │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 环境设置 │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 创建Swap │" cecho blue bold "│ │" cecho blue bold "╰──────────────────────────────────────────────────╯" ENABLE_SWAP=1 SWAP_SIZE=2G if [[ "$ENABLE_SWAP" == "1" ]]; then if swapon --show | grep -q swap; then cecho cyan "" else fallocate -l "$SWAP_SIZE" /swapfile && \ chmod 600 /swapfile && \ mkswap /swapfile >/dev/null 2>&1 && \ swapon /swapfile && \ echo '/swapfile none swap sw 0 0' >> /etc/fstab || \ cecho red " Swap 创建失败" fi else cecho red "" fi clear cecho blue bold "╭────────────────── 初始开荒脚本 ──────────────────╮" cecho blue bold "│ │" cecho blue bold "├── 系统更新 │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 安装常用工具 │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 环境设置 │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 创建Swap │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 清理系统垃圾 │" cecho blue bold "│ │" cecho blue bold "╰──────────────────────────────────────────────────╯" apt_run "apt autoremove" autoremove -y apt autoclean -y >/dev/null 2>&1 clear cecho blue bold "╭────────────────── 初始开荒脚本 ──────────────────╮" cecho blue bold "│ │" cecho blue bold "├── 系统更新 │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 安装常用工具 │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 环境设置 │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 创建Swap │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "├── 清理系统垃圾 │" cecho blue bold "│ └─ [完成] │" cecho blue bold "│ │" cecho blue bold "╰──────────────────感谢使用本脚本──────────────────╯"