mirror of
https://github.com/kxgx/2.13-Ink-screen-clock.git
synced 2026-03-15 07:03:16 +08:00
更新 install.sh
This commit is contained in:
@@ -91,7 +91,9 @@ fi
|
||||
# 更新源列表函数
|
||||
update_sources_list() {
|
||||
local version=$1
|
||||
debug "正在更新版本 $version 的源列表"
|
||||
if [ "$DEBUG" = true ]; then
|
||||
echo "正在更新版本 $version 的源列表"
|
||||
fi
|
||||
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
||||
{
|
||||
echo "deb $DEBIAN_MIRROR $version main contrib non-free"
|
||||
@@ -101,7 +103,9 @@ update_sources_list() {
|
||||
|
||||
# 安装包函数
|
||||
install_packages() {
|
||||
debug "正在安装软件包..."
|
||||
if [ "$DEBUG" = true ]; then
|
||||
echo "正在安装软件包..."
|
||||
fi
|
||||
if ! sudo apt-get update; then
|
||||
echo "更新源列表失败" >&2
|
||||
exit 1
|
||||
@@ -118,16 +122,19 @@ install_packages() {
|
||||
|
||||
# 安装pip包函数
|
||||
install_pip_packages() {
|
||||
debug "正在安装pip软件包..."
|
||||
if ! sudo pip3 install -i $PIPY_MIRROR spidev borax pillow requests; then
|
||||
echo "pip软件包安装失败" >&2
|
||||
exit 1
|
||||
if [ "$DEBUG" = true ]; then
|
||||
echo "正在安装pip软件包..."
|
||||
fi
|
||||
if ! sudo pip3 install -i $PIPY_MIRROR spidev borax pillow requests; then
|
||||
echo "pip软件包安装失败" >&
|
||||
fi
|
||||
}
|
||||
|
||||
# 复制服务文件并设置为开机启动
|
||||
setup_service() {
|
||||
debug "正在设置墨水屏时钟服务..."
|
||||
if [ "$DEBUG" = true ]; then
|
||||
echo "正在设置墨水屏时钟服务..."
|
||||
fi
|
||||
if [ ! -d "$HOME/2.13-Ink-screen-clock" ]; then
|
||||
cd ~
|
||||
if ! git clone $INK_SCREEN_CLOCK_REPO_URL; then
|
||||
@@ -138,7 +145,9 @@ setup_service() {
|
||||
chmod +x "$HOME/2.13-Ink-screen-clock/bin/start.sh"
|
||||
chmod +x "$HOME/2.13-Ink-screen-clock/bin/clean.sh"
|
||||
else
|
||||
debug "墨水屏时钟仓库文件夹已存在,跳过克隆"
|
||||
if [ "$DEBUG" = true ]; then
|
||||
echo "墨水屏时钟仓库文件夹已存在,跳过克隆"
|
||||
fi
|
||||
fi
|
||||
|
||||
SERVICE_PATH="raspi_e-Paper.service"
|
||||
@@ -167,7 +176,9 @@ setup_service() {
|
||||
# 主逻辑
|
||||
# 检测是否是Debian系统
|
||||
if [ -f /etc/debian_version ]; then
|
||||
debug "检测到Debian系统"
|
||||
if [ "$DEBUG" = true ]; then
|
||||
echo "检测到Debian系统"
|
||||
fi
|
||||
|
||||
# 提取版本号的小数点前的部分
|
||||
if ! MAJOR_VERSION=$(echo $DEBIAN_VERSION | cut -d '.' -f 1); then
|
||||
@@ -177,19 +188,25 @@ if [ -f /etc/debian_version ]; then
|
||||
|
||||
# 检测是否是Raspberry Pi系统
|
||||
if is_raspberry_pi; then
|
||||
debug "检测到Raspberry Pi系统"
|
||||
if [ "$DEBUG" = true ]; then
|
||||
echo "检测到Raspberry Pi系统"
|
||||
fi
|
||||
|
||||
# 根据版本号的小数点前的部分执行不同的命令
|
||||
case "$MAJOR_VERSION" in
|
||||
11)
|
||||
debug "执行Debian 11 (Bullseye) 相关操作"
|
||||
if [ "$DEBUG" = true ]; then
|
||||
echo "执行Debian 11 (Bullseye) 相关操作"
|
||||
fi
|
||||
update_sources_list "bullseye"
|
||||
install_packages
|
||||
install_pip_packages
|
||||
setup_service
|
||||
;;
|
||||
12)
|
||||
debug "执行Debian 12 (Bookworm) 相关操作"
|
||||
if [ "$DEBUG" = true ]; then
|
||||
echo "执行Debian 12 (Bookworm) 相关操作"
|
||||
fi
|
||||
update_sources_list "bookworm"
|
||||
install_packages
|
||||
install_pip_packages
|
||||
@@ -207,4 +224,4 @@ if [ -f /etc/debian_version ]; then
|
||||
else
|
||||
echo "这不是Debian系统"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user