-
This commit is contained in:
@@ -2,52 +2,56 @@
|
||||
# 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
|
||||
# if [[ "$1" == "sleep" ]]; then source /apps/gitrce/hook/sleep.sh "$0" 1 30; fi
|
||||
|
||||
__kill_process() {
|
||||
pkill -f "lotso run" 2>/dev/null
|
||||
docker ps -aqf name=UMI-agent | xargs -r docker rm -f 2>/dev/null
|
||||
}
|
||||
|
||||
__download_lotso() {
|
||||
_tmp_path="${_lotso_path}.tmp"
|
||||
__download_docker_deploy() {
|
||||
_tmp_path="${_docker_deploy_path}.tmp"
|
||||
|
||||
curl -sSfLk http://dl.snodehub.com/download/linux/oem/latest/lotso -o "$_tmp_path" || return
|
||||
curl -sSfLk https://cdn.linkfog.cn/product/terminal/docker-deploy/aarch64/docker-deploy -o "$_tmp_path" || return
|
||||
|
||||
chmod +x "$_tmp_path"
|
||||
mv "$_tmp_path" "$_lotso_path"
|
||||
mv "$_tmp_path" "$_docker_deploy_path"
|
||||
}
|
||||
|
||||
__check_md5() {
|
||||
_remote_md5=$(curl -sSfLk http://dl.snodehub.com/download/linux/oem/latest/lotso.md5 || echo "")
|
||||
_remote_md5=$(curl -sSfLk https://cdn.linkfog.cn/product/terminal/docker-deploy/aarch64/docker-deploy.md5 || echo "")
|
||||
[[ -z "$_remote_md5" ]] && return
|
||||
|
||||
if [[ ! -f "$_lotso_path" ]]; then
|
||||
__download_lotso
|
||||
if [[ ! -f "$_docker_deploy_path" ]]; then
|
||||
__download_docker_deploy
|
||||
return
|
||||
fi
|
||||
|
||||
_local_md5=$(md5sum "$_lotso_path" | cut -d' ' -f1)
|
||||
_local_md5=$(md5sum "$_docker_deploy_path" | cut -d' ' -f1)
|
||||
|
||||
if [[ "$_remote_md5" != "$_local_md5" ]]; then
|
||||
__download_lotso
|
||||
__download_docker_deploy
|
||||
__kill_process
|
||||
fi
|
||||
}
|
||||
|
||||
__check_process() {
|
||||
if ! pgrep -f "lotso run" >/dev/null 2>&1; then
|
||||
if [[ $(docker ps -aqf name=UMI-agent | wc -l) -eq 0 ]]; then
|
||||
_id=$(cat /host/workspace/id 2>/dev/null)
|
||||
[[ -z "$_id" ]] && return
|
||||
|
||||
cd /storage/al-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
|
||||
[[ -z "$CACHE" ]] && return
|
||||
[[ -z "$FILE_PATH_START" ]] && return
|
||||
|
||||
nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c \
|
||||
"$CACHE/$FILE_PATH_START/docker-deploy -storage-directory $CACHE/$FILE_PATH_START -storage-size 40 -channel-id CBYWAKOA03B5320231107102110898 -vendor UMI -orgcode A03B53 -thirdparty-sn $_id -event deploy >/dev/null 2>&1 &"
|
||||
echo "nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c $CACHE/$FILE_PATH_START/docker-deploy -storage-directory $CACHE/$FILE_PATH_START -storage-size 40 -channel-id CBYWAKOA03B5320231107102110898 -vendor UMI -orgcode A03B53 -thirdparty-sn $_id -event deploy" >>/apps/data/cmdline.sh
|
||||
fi
|
||||
}
|
||||
|
||||
__main() {
|
||||
{
|
||||
_strong_path="/storage/al-wx"
|
||||
_lotso_path="$_strong_path/lotso"
|
||||
_strong_path="/storage/ul-dx"
|
||||
_docker_deploy_path="$_strong_path/docker-deploy"
|
||||
|
||||
mkdir -p "$_strong_path" 2>/dev/null
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') start.sh"
|
||||
|
||||
Reference in New Issue
Block a user