change tk

This commit is contained in:
zj
2026-02-09 03:14:35 +08:00
parent 8c53b9c0a0
commit 1a3a4746a3
13 changed files with 3595 additions and 221 deletions

41
run_tkinter.sh Normal file
View File

@@ -0,0 +1,41 @@
#!/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