root检测

This commit is contained in:
gfdgd xi 2023-03-04 16:03:03 +08:00
parent b14caecc18
commit 622bff338c

View File

@ -1,4 +1,10 @@
#!/bin/bash #!/bin/bash
if [[ `whoami` != `root` ]]; then
echo 请以 root 权限运行
echo 按任意键退出
read
exit 1
fi
PCArch=`dpkg --print-architecture` PCArch=`dpkg --print-architecture`
if [[ $PCArch != "aarch64" ]] && [[ $PCArch != "arm64" ]]; then if [[ $PCArch != "aarch64" ]] && [[ $PCArch != "arm64" ]]; then
echo 非 ARM 架构,无法继续 echo 非 ARM 架构,无法继续
@ -8,7 +14,7 @@ if [[ $PCArch != "aarch64" ]] && [[ $PCArch != "arm64" ]]; then
fi fi
if [[ -f /etc/apt/sources.list.d/box86.list ]]; then if [[ -f /etc/apt/sources.list.d/box86.list ]]; then
echo 已安装,结束 echo 已安装,结束
echo任意键退出 echo回车键退出
read read
exit 1 exit 1
fi fi
@ -24,5 +30,5 @@ fi
echo " + sudo apt update" echo " + sudo apt update"
sudo apt update sudo apt update
sudo apt install -y $installBox sudo apt install -y $installBox
echo 安装完成! echo 安装完成!按回车键退出
read read