mirror of
https://github.com/kxgx/2.13-Ink-screen-clock.git
synced 2026-03-28 09:19:46 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2213433dd8 | ||
|
|
a5fd08ed3d |
@@ -225,8 +225,45 @@ install_Ink-screen-clock() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 检查pip包是否已安装
|
||||||
|
check_pip_packages_installed() {
|
||||||
|
local requirements_file="$HOME/2.13-Ink-screen-clock/bin/requirements.txt"
|
||||||
|
if [ ! -f "$requirements_file" ]; then
|
||||||
|
echo "requirements.txt 文件不存在" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 读取requirements.txt中的包名(忽略版本号)
|
||||||
|
local packages=()
|
||||||
|
while IFS= read -r line; do
|
||||||
|
# 去除注释和空行
|
||||||
|
if [[ -n "$line" && ! "$line" =~ ^\s*# ]]; then
|
||||||
|
# 提取包名(忽略版本号)
|
||||||
|
local package_name=$(echo "$line" | cut -d'=' -f1 | cut -d'>' -f1 | cut -d'<' -f1)
|
||||||
|
packages+=("$package_name")
|
||||||
|
fi
|
||||||
|
done < "$requirements_file"
|
||||||
|
|
||||||
|
# 检查每个包是否已安装
|
||||||
|
for package in "${packages[@]}"; do
|
||||||
|
if ! pip3 show "$package" &> /dev/null; then
|
||||||
|
echo "包 $package 未安装"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "所有pip包已安装"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# 安装pip包函数
|
# 安装pip包函数
|
||||||
install_oline_pip_packages() {
|
install_oline_pip_packages() {
|
||||||
|
# 首先检查是否所有pip包都已安装
|
||||||
|
if check_pip_packages_installed; then
|
||||||
|
echo "所有pip包已安装,跳过安装"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
# ... 继续安装 ...
|
||||||
echo "正在安装pip软件包"
|
echo "正在安装pip软件包"
|
||||||
if ! sudo pip3 install -i "$PIPY_MIRROR" -r "$HOME/2.13-Ink-screen-clock/bin/requirements.txt"; then
|
if ! sudo pip3 install -i "$PIPY_MIRROR" -r "$HOME/2.13-Ink-screen-clock/bin/requirements.txt"; then
|
||||||
echo "pip软件包安装失败,如果是最新版系统或是非lite系统" >&2
|
echo "pip软件包安装失败,如果是最新版系统或是非lite系统" >&2
|
||||||
@@ -284,7 +321,7 @@ setup_service() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
PISUGAR_POWER_MANAGER_URL=https://cdn.pisugar.com/release/pisugar-power-manager.sh
|
||||||
# 安装pisugar-power-manager函数
|
# 安装pisugar-power-manager函数
|
||||||
install_pisugar-power-manager() {
|
install_pisugar-power-manager() {
|
||||||
if [ "$USE_PISUGAR_POWER_MANAGER" = true ]; then
|
if [ "$USE_PISUGAR_POWER_MANAGER" = true ]; then
|
||||||
@@ -296,7 +333,7 @@ install_pisugar-power-manager() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
PISUGAR_WIFI_CONF_URL=https://cdn.pisugar.com/PiSugar-wificonfig/script/install.sh
|
||||||
# 安装pisugar-wifi-conf函数
|
# 安装pisugar-wifi-conf函数
|
||||||
install_pisugar-wifi-conf() {
|
install_pisugar-wifi-conf() {
|
||||||
if [ "$USE_PISUGAR_WIFI_CONF" = true ]; then
|
if [ "$USE_PISUGAR_WIFI_CONF" = true ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user