代码拉取完成,页面将自动刷新
同步操作将从 qq385723790/AutoScriptBase 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
###
# @Author: TonyJiangWJ
# @Date: 2020-04-27 10:23:36
# @Last Modified by: TonyJiangWJ
# @Last Modified time: 2020-04-29 15:24:41
# @Description: 同步脚本到设备
###
#!/bin/bash
prefix="storage/emulated/0/脚本/"
error() {
echo "\033[31m $1 \033[0m"
}
deviceId=$(adb devices | grep -v List | awk '{print $1}')
if [ -z "$deviceId" ]; then
error "no device attached"
return -1
fi
echo $deviceId
sync_file_to_device() {
targetJs=$1
targetDir=$2
if [ -n "$targetJs" ] && (test -e $targetJs) ; then
if [ -n "$targetDir" ] ; then
adb shell test -e ${prefix}$target_dir
exec_result=$?
if [ $exec_result == 0 ]; then
echo "sync '$targetJs' to '${prefix}$targetDir'"
exec_cmd="adb push $targetJs ${prefix}$targetDir/$targetJs"
echo "$exec_cmd"
$exec_cmd
echo 'done'
else
error "targetDir is not exist on device"
fi
else
error "$targetDir is not exists"
fi
else
error "$targetJs is not exists"
fi
}
# 目标项目文件夹
target_dirs=(
"energy_store"
"蚂蚁庄园"
"Alipay-Credits"
"京东签到"
"AutoScriptBase"
)
# 可同步文件
target_files=(
"lib/prototype/RunningQueueDispatcher.js"
"lib/prototype/FloatyUtil.js"
"unit/获取当前页面的布局信息.js"
)
sync_target_js_to_all() {
target_js_idx=$1
target_js=${target_files[$target_js_idx]}
for target_dir in ${target_dirs[@]}; do
sync_file_to_device $target_js $target_dir
done
}
sync_all_js_to_all() {
for target_js in ${target_files[@]}; do
for target_dir in ${target_dirs[@]}; do
sync_file_to_device $target_js $target_dir
done
done
}
sync_all_to_target_dir() {
target_dir_idx=$1
for target_js in ${target_files[@]}; do
target_dir=${target_dirs[$target_dir_idx]}
sync_file_to_device $target_js $target_dir
done
}
# 复制指定文件到所有目标路径
# sync_target_js_to_all 0
# 复制所有文件到所有目标路径
sync_all_to_target_dir 4
# 复制指定文件到指定目录
#sync_file_to_device ${target_files[0]} ${target_dirs[0]}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。