Windows用bat从linux拉文件+adb推文件
@echo off
::开启延迟环境变量扩展 保证后面的errorlevel能正确赋值
setlocal EnableDelayedExpansion
adb root
adb remount
::bat所在路径
set local_path=%~dp0
::创建目录
md %local_path%\lib64
md %local_path%\bin
md %local_path%\publish
set remote_path=one@10.0.0.27:/home/one/buildsystem/lib64
::echo %remote_path%/lib64
set push_path=/system
if "%1" == "bin" (
call:pull_bin
call:push_bin
)^
else if "%1" == "lib" (
call:pull_lib
call:push_lib
)^
else if "%1" == "config" (
call:push_config
)^
else if "%1" == "caevsconfig" (
call:push_caevs_config
)^
else if "%1" == "publish" (
call:pull_publish
call:push_publish
)^
else if "%1" == "libdvr_8155.so" (
scp -r %remote_path%/lib64/%1 %local_path%\lib64
adb push %local_path%\lib64\%1 %push_path%/lib64
adb shell cp system/lib64/libdvr_8155.so system/lib64/libdvr.so
::推配置到平台路径
adb push %local_path%\automotive\caevs\lib\dvr\watermark\normal %push_path%/etc/automotive/evs/dvrlib/resource
adb push %local_path%\automotive\caevs\lib\dvr\watermark\watermarkPosition.xml %push_path%/etc/automotive/evs/dvrlib/resource
)^
else if "%1" == "" (
call:pull_bin
call:push_bin
call:pull_lib
call:push_lib
)^
else (
echo %1 | findstr /C:".so" >nul 2>&1
if %errorlevel% equ 0 (
echo push lib %1
scp -r %remote_path%/lib64/%1 %local_path%\lib64
adb push %local_path%\lib64\%1 %push_path%/lib64
)^
else (
echo push bin %1
scp -r %remote_path%/bin/%1 %local_path%\bin
adb push %local_path%\bin\%1 %push_path%/bin
)
)
::adb shell chmod +x /data/app/TEST_libcadvr
adb shell sync
adb shell stop caevsserver
::adb shell start caevsserver
pause
goto:eof
:pull_lib
scp -r %remote_path%/lib64/lib*.so %local_path%\lib64
goto:eof
:pull_bin
scp -r %remote_path%/bin/* %local_path%\bin
goto:eof
:push_lib
adb push %local_path%\lib64 %push_path%
::adb shell ln -s libEGL.so libEGL.so.1
::adb shell ln -s libGLESv2.so libGLESv2.so.2
goto:eof
:push_bin
set folder="%local_path%\bin"
for /r "%folder%" %%f in (*) do (
adb push %%f %push_path%/bin
)
goto:eof
:push_config
adb shell mkdir -p /data/app/testres/evslib
adb push %local_path%\libcadvr /data/app/testres/evslib
goto:eof
:push_caevs_config
::adb shell mkdir -p /etc/automotive
adb push automotive /etc
goto:eof
:pull_publish
scp -r %remote_path%/lib64/libdvr_8155.so %local_path%\publish
scp -r %remote_path%/lib64/libca*.so %local_path%\publish
scp -r %remote_path%/lib64/libassimp_caevs.so %local_path%\publish
scp -r %remote_path%/lib64/libzmq.so %local_path%\publish
scp -r %remote_path%/lib64/libdvr.so %local_path%\publish
scp -r %remote_path%/lib64/libtbus.so %local_path%\publish
scp -r %remote_path%/lib64/libcabuiltindvrapp.so %local_path%\publish
::bin
scp -r %remote_path%/bin/caevsserver %local_path%\publish
goto:eof
:push_publish
adb push %local_path%\publish /data/app
adb shell cp /data/app/publish/*.so %push_path%/lib64/
adb shell rm -r /data/app/publish
adb push %local_path%\publish\caevsserver /system/bin
adb shell chmod +x /system/bin/caevsserver
goto:eof
::export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/resources/capture_caevs/lib64