Files
Linux/1.sh

32 lines
768 B
Bash

#!/usr/bin/env bash
#
# ...
#
# 使用方法:
# URL="https://git.1-h.cc/Scripts/Linux/raw/branch/main/1.sh"; curl -fsSL "$URL" | bash || wget -q -O - "$URL" | bash
set -e # 遇到错误即退出
trap 'echo "Error on line $LINENO"' ERR
# 先检查是 Debian 还是 Alpine
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$NAME
VERSION=$VERSION_ID
else
echo "无法检测系统类型,请确保系统支持 /etc/os-release"
exit 1
fi
# 检查系统类型
if [[ $OS == *"Debian"* ]]; then
echo "检测到 Debian 系统,版本: $VERSION"
SYSTEM_TYPE="debian"
elif [[ $OS == *"Alpine"* ]]; then
echo "检测到 Alpine 系统,版本: $VERSION"
SYSTEM_TYPE="alpine"
else
echo "不支持的系统类型: $OS"
exit 1
fi