Files
diskmanager2/run_tkinter.sh
2026-02-09 03:14:35 +08:00

42 lines
1.2 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Linux 存储管理工具 - Tkinter 版本启动脚本
# 适配低版本系统(如 CentOS 8
# 检查 Python 版本
python3 --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "错误: 未找到 Python3请安装 Python 3.6 或更高版本。"
exit 1
fi
# 检查 tkinter
python3 -c "import tkinter" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "错误: Python 未安装 tkinter 模块。"
echo "请安装 tkinter:"
echo " CentOS/RHEL: sudo yum install python3-tkinter"
echo " Ubuntu/Debian: sudo apt-get install python3-tk"
exit 1
fi
# 检查必要的系统工具
for tool in lsblk parted mdadm lvm; do
which $tool > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "警告: 未找到工具 '$tool',某些功能可能无法使用。"
fi
done
# 获取脚本所在目录
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# 以 root 权限运行(存储管理需要)
if [ "$EUID" -ne 0 ]; then
echo "注意: 存储管理工具需要 root 权限才能正常工作。"
echo "正在尝试使用 sudo 启动..."
sudo python3 "${SCRIPT_DIR}/main_tkinter.py" "$@"
else
python3 "${SCRIPT_DIR}/main_tkinter.py" "$@"
fi