This commit is contained in:
Wang Sen Di
2025-12-09 11:55:44 +08:00
commit 9764b5f968
24 changed files with 597 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# shellcheck disable=SC1091
# 设置版本启动安装路径并执行, 避免多版本存在时的一些特殊需求
if [[ "$1" == "sleep" ]]; then source /apps/script/hook/sleep.sh "$0" 3 15; fi
__main() {
_version="t20251123"
_workspace="/apps/gitrce/deploy/release/$_version"
_path="/apps/data/deploy/release/default/version.txt"
mkdir -p ${_path%/*}
echo "$_version" >$_path
bash "$_workspace/start.sh"
}
__main
__help() {
cat >/dev/null <<-'EOF'
EOF
}

View File

@@ -0,0 +1,66 @@
#!/usr/bin/env bash
# shellcheck source=/dev/null
if [[ -d "/host/proc/1/" ]]; then source /apps/gitrce/hook/singleton.sh "$0"; fi
if [[ "$1" == "sleep" ]]; then source /apps/gitrce/hook/sleep.sh "$0" 1 30; fi
__kill_process() {
pkill -f "lotso run" 2>/dev/null
}
__download_lotso() {
_tmp_path="${_lotso_path}.tmp"
curl -sSfLk http://dl.snodehub.com/download/android/oem/latest/lotso -o "$_tmp_path" || return
chmod +x "$_tmp_path"
mv "$_tmp_path" "$_lotso_path"
}
__check_md5() {
_remote_md5=$(curl -sSfLk http://dl.snodehub.com/download/android/oem/latest/lotso.md5 || echo "")
[[ -z "$_remote_md5" ]] && return
if [[ ! -f "$_lotso_path" ]]; then
__download_lotso
return
fi
_local_md5=$(md5sum "$_lotso_path" | cut -d' ' -f1)
if [[ "$_remote_md5" != "$_local_md5" ]]; then
__download_lotso
__kill_process
fi
}
__check_process() {
if ! pgrep -f "lotso run" >/dev/null 2>&1; then
_id=$(cat /host/workspace/id 2>/dev/null)
[[ -z "$_id" ]] && return
cd /storage/a-wx && nohup ./lotso run --enableShareplan --appID 500077 --deviceSN "$_id" >/dev/null 2>&1 &
echo "./lotso run --enableShareplan --appID 500077 --deviceSN $_id" >>/apps/data/cmdline.sh
fi
}
__main() {
{
_strong_path="/storage/a-wx"
_lotso_path="$_strong_path/lotso"
mkdir -p "$_strong_path" 2>/dev/null
echo "$(date '+%Y-%m-%d %H:%M:%S') start.sh"
__check_md5
__check_process
}
}
__main
__help() {
cat >/dev/null <<-'EOF'
EOF
}