Files
WechatOnCloud/docker/autostart
Gloridust 5c5e9c8540 update
2026-05-29 22:00:23 +08:00

35 lines
1.1 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
# 由 KasmVNC base 的 openbox 会话在桌面就绪后执行(以 app 用户身份)。
# 微信本体由面板经 docker exec 触发下载/解压到数据卷 /config/wechat见 wechat-ctl.sh
# 本脚本只负责:等待微信就绪 + 常驻拉起(关窗自动重开;更新后从新版本路径重启)。
set -u
WECHAT_BIN=/config/wechat/opt/wechat/wechat
# 容器内无 GPU强制软件渲染
export LIBGL_ALWAYS_SOFTWARE=1
# 1) 等待微信安装就绪(首次需在面板点「下载并安装」)
notified=0
while [ ! -x "${WECHAT_BIN}" ]; do
if [ "${notified}" -eq 0 ]; then
echo "[autostart] 微信尚未安装,等待面板触发下载…(首次使用请在面板点「下载并安装微信」)"
notified=1
fi
sleep 2
done
# 3) 常驻拉起微信
while true; do
if [ ! -x "${WECHAT_BIN}" ]; then
# 更新过程中本体被临时挪走,等就位再继续
sleep 2
continue
fi
echo "[autostart] 启动微信: ${WECHAT_BIN}"
"${WECHAT_BIN}"
echo "[autostart] 微信已退出2 秒后重启"
sleep 2
done