28 Commits

Author SHA1 Message Date
星光-k
28895e7188 Update clean.sh 2025-01-12 14:55:53 +08:00
星光-k
8a4ba07f5b Update e-Paper_clean.service 2025-01-12 14:55:35 +08:00
星光-k
ecaa4006ce Update e-Paper_clean.service 2025-01-12 14:55:24 +08:00
星光-k
c5a3ef0dcf Update main.py 2025-01-12 14:52:18 +08:00
星光-k
99c2bb3152 Update main.py 2025-01-12 14:45:24 +08:00
星光-k
533e76d536 Update main.py 2025-01-12 14:08:23 +08:00
星光-k
26ee5bf6e7 Update main.py 2025-01-12 14:07:17 +08:00
星光-k
a710b293b6 Update main.py 2025-01-12 13:53:03 +08:00
星光-k
3a90a36ffa 更新 main.py 2025-01-12 05:34:51 +00:00
星光-k
fdd3e6008a 更新 main.py 2025-01-12 05:31:35 +00:00
星光-k
e3fd070e3c 更新 install.sh 2025-01-12 04:51:02 +00:00
星光-k
5e353f68f6 更新 install.sh 2025-01-12 04:48:42 +00:00
星光-k
6e0646612b 更新 install.sh 2025-01-12 04:46:09 +00:00
星光-k
d2b4073c98 更新 install.sh 2025-01-12 04:42:44 +00:00
星光-k
9fb1ef0c6b 更新 install.sh 2025-01-12 04:42:03 +00:00
星光-k
7c39658cdf 更新 install.sh 2025-01-12 04:35:34 +00:00
星光-k
6628fc01e2 更新 install.sh 2025-01-12 04:31:59 +00:00
星光-k
b505f9a61d 更新 install.sh 2025-01-12 04:26:12 +00:00
星光-k
7db25e5136 更新 install.sh 2025-01-12 04:22:31 +00:00
星光-k
9e28156c65 更新 install.sh 2025-01-12 04:13:48 +00:00
星光-k
1be7856992 更新 install.sh 2025-01-12 04:06:31 +00:00
星光-k
368ed919dd 更新 install.sh 2025-01-12 03:59:40 +00:00
星光-k
7a9108134a 更新 install.sh 2025-01-12 03:50:32 +00:00
星光-k
1aa62fb894 更新 install.sh 2025-01-12 03:46:47 +00:00
星光-k
d5ff700884 更新 install.sh 2025-01-12 03:21:28 +00:00
星光-k
c56bd3784e 更新 install.sh 2025-01-12 03:19:48 +00:00
星光-k
597790d4ad 更新 install.sh 2025-01-12 03:17:07 +00:00
星光-k
e8011c7282 更新 install.sh 2025-01-12 03:14:12 +00:00
4 changed files with 340 additions and 311 deletions

View File

@@ -5,7 +5,7 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
logdir=${dir%/*} logdir=${dir%/*}
screen_name="clean_screen" screen_name="clean_screen"
service_name="raspi_e-Paper.service" service_name="raspi_e-Paper.service"
hold_time_seconds=5 # 设置维持时间例如300秒5分钟 hold_time_seconds=3 # 设置维持时间例如300秒5分钟
# 创建一个新的screen会话并运行Python脚本 # 创建一个新的screen会话并运行Python脚本
screen -dmS $screen_name /usr/bin/python3 -u $dir/$f_name > $logdir/log/clean-info.log 2>&1 screen -dmS $screen_name /usr/bin/python3 -u $dir/$f_name > $logdir/log/clean-info.log 2>&1

View File

@@ -8,7 +8,6 @@ Before=reboot.target
Type=oneshot Type=oneshot
ExecStart=/bin/bash /root/2.13-Ink-screen-clock/bin/clean.sh ExecStart=/bin/bash /root/2.13-Ink-screen-clock/bin/clean.sh
RemainAfterExit=yes RemainAfterExit=yes
TimeoutSec=5
[Install] [Install]
WantedBy=shutdown.target WantedBy=shutdown.target

View File

@@ -33,25 +33,57 @@ while [ "$#" -gt 0 ]; do
shift shift
done done
# 获取当前语言环境变量
CURRENT_LANG=$(locale | grep LANG | sed 's/.*=//')
# 打印当前语言环境变量
echo "当前语言环境: $CURRENT_LANG"
# 设置语言环境 # 设置语言环境
export LANG=$DEFAULT_LANG if [ "$CURRENT_LANG" != "$DEFAULT_LANG" ]; then
export LC_ALL=$DEFAULT_LANG echo "当前语言环境不是 $DEFAULT_LANG,将进行设置"
# 如果 locale.gen 中不存在,则添加到 locale.gen # 设置新的语言环境变量
if ! grep -q "^$DEFAULT_LANG UTF-8" /etc/locale.gen; then export LANG=$DEFAULT_LANG
echo "$DEFAULT_LANG UTF-8" | sudo tee -a /etc/locale.gen export LC_ALL=$DEFAULT_LANG
fi
# 生成 locale # 检查 locale.gen 中是否已存在 DEFAULT_LANG
if ! sudo locale-gen; then found=0
echo "生成 locale 失败" >&2 while read -r line; do
exit 1 if [[ "$line" == "$DEFAULT_LANG UTF-8" ]]; then
fi found=1
break
fi
done < /etc/locale.gen
# 重新配置 locales if [ $found -eq 0 ]; then
if ! sudo dpkg-reconfigure --frontend=noninteractive locales; then # 如果不存在,则添加到 locale.gen
echo "重新配置 locales 失败" >&2 echo "$DEFAULT_LANG UTF-8" | sudo tee -a /etc/locale.gen
exit 1 # 确保 locale.gen 被正确更新
if [ $? -ne 0 ]; then
echo "无法更新 locale.gen 文件" >&2
exit 1
fi
else
echo "语言环境 $DEFAULT_LANG 已在 locale.gen 中设置,跳过添加"
fi
# 生成 locale
if ! sudo locale-gen; then
# 如果生成失败,打印错误消息并退出
echo "生成 locale 失败" >&2
exit 1
fi
# 更新 locale 配置
if ! sudo update-locale LANG=$DEFAULT_LANG; then
echo "更新 locale 配置失败" >&2
exit 1
fi
echo "语言环境设置完成"
else
echo "当前语言环境已经是 $DEFAULT_LANG,跳过设置"
fi fi
# Debian版本相关命令 # Debian版本相关命令
@@ -210,7 +242,7 @@ setup_service() {
# 主逻辑 # 主逻辑
# 检测是否是Debian系统 # 检测是否是Debian系统
if [ -f /etc/debian_version ]; then if [ -f /etc/debian_version ]; then
echo "检测到Debian系统" echo "检测到Debian$DEBIAN_VERSION系统"
# 提取版本号的小数点前的部分 # 提取版本号的小数点前的部分
if ! MAJOR_VERSION=$(echo $DEBIAN_VERSION | cut -d '.' -f 1); then if ! MAJOR_VERSION=$(echo $DEBIAN_VERSION | cut -d '.' -f 1); then

View File

@@ -143,8 +143,6 @@ def Basic_refresh(): #全刷函数
logging.info("Refresh and prepare the basic content before starting the canvas")#开始画布前刷新准备基础内容 logging.info("Refresh and prepare the basic content before starting the canvas")#开始画布前刷新准备基础内容
epd.init() epd.init()
epd.Clear(0xFF) epd.Clear(0xFF)
epd.init()
epd.Clear(0xFF)
global get_date_var global get_date_var
get_date_var=get_date() #记录开始数据 get_date_var=get_date() #记录开始数据
draw.text((2,2),get_date_var,font = font02,fill =0)#将日期及星期几显示到屏幕 draw.text((2,2),get_date_var,font = font02,fill =0)#将日期及星期几显示到屏幕