updata shell

This commit is contained in:
modehua 2023-01-14 15:46:27 +08:00
parent 6db032b9f2
commit 74c1363c6d
2 changed files with 109 additions and 103 deletions

207
build.sh
View File

@ -12,8 +12,7 @@ ismount=-1 #是否挂载服务器成功 0成功 非0失败
FIND_FILE="/home/samba/dpkg" #服务器存放打包路径 不可修改 FIND_FILE="/home/samba/dpkg" #服务器存放打包路径 不可修改
dpkgtype="app" dpkgtype="app"
ver3=10 ver3=10
sanelibname=""
if [ $2 ]; if [ $2 ];
then then
@ -41,6 +40,64 @@ if [ "$oem" != "hg" ] \
exit 1 exit 1
fi fi
if [ ${oem:0-2:2} == "so" ] || [ ${oem:0-2:2} == "sm" ];
then
sanelibname="${oem%${oem:0-2:2}*}"
echo $sanelibname
else
sanelibname=$oem
echo $sanelibname
fi
function appbuild()
{
pwd
echo "-----------------------------start-----------------------------"
#GIT CODE
rm ../release/$syspath/$cpu/* -R
git -C ../release clean -df
git -C ../release checkout .
git -C ../release pull
git -C ../sdk clean -df
git -C ../sdk checkout .
git -C ../sdk pull
#git -C ../code_device clean -df
git -C ../code_device checkout .
git -C ../code_device pull
#git -C ../code_app clean -df
git -C ../code_app checkout .
git -C ../code_app pull
echo "-----------------------------start code_device build-----------------------------"
./../code_device/build.sh $sanelibname
echo "-----------------------------over code_device build-----------------------------"
if [ $? -ne 0 ];then
echo "code_device-------->编译失败"
exit 1
fi
echo "-----------------------------start code_app build-----------------------------"
if [ ${oem:0-2:2} == "sm" ];
then
./../code_app/build.sh ${oem%${oem:0-2:2}*}
else
./../code_app/build.sh $oem
fi
echo "-----------------------------over code_app build-----------------------------"
if [ $? -ne 0 ];then
echo "code_app-------->编译失败"
exit 1
fi
}
function getismount() function getismount()
{ {
if [ ! -d "/home/samba" ];then if [ ! -d "/home/samba" ];then
@ -63,6 +120,7 @@ function getismount()
fi fi
} }
if [ "$cpu" == "x86_64" ]; if [ "$cpu" == "x86_64" ];
then then
dpkgarch="amd64" dpkgarch="amd64"
@ -216,23 +274,7 @@ else
ver3=$[$ver3 + 10] ver3=$[$ver3 + 10]
fi fi
appbuild ########开始进行编译目前只能git 后期可以选择保存本地进行替换
#GIT CODE
cd ../release/$syspath/$cpu/
rm * -R
git checkout .
git pull
cd ../../../sdk
git checkout .
git pull
cd ../code_device
git checkout .
git pull
#从 brand.h当中获取版本号 #从 brand.h当中获取版本号
mainverstr=$(cat ../sdk/include/huagao/brand.h |grep VERSION_MAIN) mainverstr=$(cat ../sdk/include/huagao/brand.h |grep VERSION_MAIN)
@ -241,49 +283,10 @@ mainverstr=$(echo $mainverstr)
minver=$(cat ../sdk/include/huagao/brand.h |grep VERSION_SUB) minver=$(cat ../sdk/include/huagao/brand.h |grep VERSION_SUB)
minver=${minver: -2} minver=${minver: -2}
minver=$(echo $minver) minver=$(echo $minver)
ver="$mainverstr.$minver.$ver3.$time2"
if [ "$oem" == "hgso" ];
then
./build.sh hg
elif [ "$oem" == "hwso" ];
then
./build.sh hw
elif [ "$oem" == "lscso" ] || [ "$oem" == "lscsm" ];
then
./build.sh lsc
elif [ "$oem" == "ctsso" ];
then
./build.sh cts
else
./build.sh $oem
fi
if [ $? -ne 0 ];then
echo "code_device-------->编译失败"
exit 1
fi
cd ../code_app
git checkout .
git pull
if [ "$oem" == "lscsm" ];then
./build.sh lsc
else
./build.sh $oem
fi
if [ $? -ne 0 ];then
echo "code_app-------->编译失败"
exit 1
fi
echo "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
echo $minver echo $minver
echo "3rd version replacing pattern: "${ver3} echo "3rd version replacing pattern: "${ver3}
echo $dpkgpath echo $dpkgpath
ver="$mainverstr.$minver.$ver3.$time2"
echo $ver echo $ver
Version="Version: $ver" Version="Version: $ver"
@ -292,7 +295,7 @@ packagename="package: $dpkgpath"
echo $Architecture $Version echo $Architecture $Version
############## ############## 路径以sane根目录为基准
cd .. cd ..
############## ##############
#echo "dpkg/$syspath/$oem/usr/lib/$libpath" #echo "dpkg/$syspath/$oem/usr/lib/$libpath"
@ -316,13 +319,14 @@ if [ ! -d dpkg/$syspath/$oem/usr/lib/$libpath ];
then then
mkdir -p dpkg/$syspath/$oem/usr/lib/$libpath/sane mkdir -p dpkg/$syspath/$oem/usr/lib/$libpath/sane
if [ $? -ne 0 ];then if [ $? -ne 0 ];then
echo "mkdir sane file fail !!!" echo "mkdir sane file fail !!! --->mkdir path dpkg/$syspath/$oem/usr/lib/$libpath/sane"
exit 1 exit 1
fi fi
cp release/$syspath/$cpu/libsane-"$oem"sane.so dpkg/$syspath/$oem/usr/lib/$libpath/sane/libsane-"$oem"sane.so.1 cp release/$syspath/$cpu/libsane-"$sanelibname"sane.so dpkg/$syspath/$oem/usr/lib/$libpath/sane/libsane-"$sanelibname"sane.so.1
if [ $? -ne 0 ];then if [ $? -ne 0 ];then
echo "copy libsane file fail !!!" echo "copy libsane file fail sane name is :libsane-"$sanelibname"sane.so!!!"
exit 1 exit 1
fi fi
@ -334,10 +338,10 @@ then
echo "mips64el mkdir sane file fail !!!" echo "mips64el mkdir sane file fail !!!"
exit 1 exit 1
fi fi
cp release/$syspath/$cpu/libsane-"$sanelibname"sane.so dpkg/$syspath/$oem/usr/lib/"mips64el-linux-gunabi64"/sane/libsane-"$sanelibname"sane.so.1
cp release/$syspath/$cpu/libsane-lscsane.so dpkg/$syspath/$oem/usr/lib/"mips64el-linux-gunabi64"/sane/libsane-lscsane.so.1
if [ $? -ne 0 ];then if [ $? -ne 0 ];then
echo "copy mips64el libsane file fail !!!" echo "copy libsane file fail sane name is :libsane-"$sanelibname"sane.so!!!"
exit 1 exit 1
fi fi
fi fi
@ -346,28 +350,21 @@ else
exit 1 exit 1
fi fi
#立思辰涉密系统打包,暂时先这样
if [ "$oem" == "lscsm" ]; if [ "$oem" == "lscweb" ] || [ "$oem" == "hwweb" ] || [ "$oem" == "hgweb" ] || [ "$oem" == "ctsweb" ];
then then
cp release/$syspath/$cpu/libsane-lscsane.so dpkg/$syspath/$oem/usr/lib/$libpath/sane/libsane-lscsane.so.1 cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/$dpkgpath/bin
if [ "$cpu" == "mips64" ]; elif [ "$oem" == "hgso" ] || [ "$oem" == "hwso" ] || [ "$oem" == "lscso" ] || [ "$oem" == "ctso" ];
then then
cp release/$syspath/$cpu/libsane-lscsane.so dpkg/$syspath/$oem/usr/lib/"mips64el-linux-gunabi64"/sane/libsane-lscsane.so.1 cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/$dpkgpath/lib
fi
fi
if [ "$oem" == "lscweb" ] || [ "$oem" == "hwweb" ] || [ "$oem" == "hgweb" ] || [ "$oem" == "ctsweb" ]; then
cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/$dpkgpath/bin
elif [ "$oem" == "hgso" ] || [ "$oem" == "hwso" ] || [ "$oem" == "lscso" ] || [ "$oem" == "ctso" ];then
cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/$dpkgpath/lib
cp sdk/include/scannerlib/* dpkg/$syspath/$oem/opt/$dpkgpath/include cp sdk/include/scannerlib/* dpkg/$syspath/$oem/opt/$dpkgpath/include
rm dpkg/$syspath/$oem/opt/$dpkgpath/lib/*Scan elif [ "$oem" == "lscsm" ];
rm dpkg/$syspath/$oem/opt/$dpkgpath/lib/*App then
elif [ "$oem" == "lscsm" ];then cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/$dpkgpath
cp release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/$dpkgpath
else else
if [ "$sys" == "UnionTech" ]; savedpkgpath="dpkg/$syspath/$oem/opt/apps/$dpkgpath"
echo $dpkgpath
if [ "$sys" == "UnionTech" ];
then then
#替换uos里面的info 虽然不晓得有啥用 #替换uos里面的info 虽然不晓得有啥用
appid='"appid":''"'$dpkgpath'"'',' appid='"appid":''"'$dpkgpath'"'','
@ -375,45 +372,49 @@ else
version='"version":''"'$ver'"'',' version='"version":''"'$ver'"'','
name='"name":''"'$oem'"'',' name='"name":''"'$oem'"'','
sed -i "5s/.*/ $InfoArch/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info sed -i "5s/.*/ $InfoArch/g" "$savedpkgpath/info"
sed -i "2s/.*/ $appid/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info sed -i "2s/.*/ $appid/g" "dpkg/$syspath/$oem/opt/apps/$dpkgpath/info"
sed -i "4s/.*/ $version/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info sed -i "4s/.*/ $version/g" "dpkg/$syspath/$oem/opt/apps/$dpkgpath/info"
sed -i "3s/.*/ $name/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info sed -i "3s/.*/ $name/g" "dpkg/$syspath/$oem/opt/apps/$dpkgpath/info"
cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/lib cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/lib
mv dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/lib/*Scan dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/bin mv dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/lib/*Scan dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/bin
mv dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/lib/*App dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/bin mv dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/lib/*App dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/bin
if [ $? != 0 ];
then
echo "-----------------cp fail-----------------"
exit 1
fi
else else
cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/apps/$dpkgpath/lib cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/apps/$dpkgpath/lib
mv dpkg/$syspath/$oem/opt/apps/$dpkgpath/lib/*Scan dpkg/$syspath/$oem/opt/apps/$dpkgpath/bin mv dpkg/$syspath/$oem/opt/apps/$dpkgpath/lib/*Scan dpkg/$syspath/$oem/opt/apps/$dpkgpath/bin
mv dpkg/$syspath/$oem/opt/apps/$dpkgpath/lib/*App dpkg/$syspath/$oem/opt/apps/$dpkgpath/bin mv dpkg/$syspath/$oem/opt/apps/$dpkgpath/lib/*App dpkg/$syspath/$oem/opt/apps/$dpkgpath/bin
if [ $? != 0 ];
then
echo "-----------------cp fail-----------------"
exit 1
fi
fi fi
fi fi
if [ $? != 0 ];
then
echo "-----------------cp fail-----------------"
exit 1
fi
pwd
chmod 755 dpkg -R chmod 755 dpkg -R
chmod 755 backup -R chmod 755 backup -R
if [ -d "backup/$syspath/$oem/$ver" ]; if [ -d "backup/$syspath/$oem/$ver" ];
then then
rm -rf backup/$syspath/$oem/$ver rm -rf "backup/$syspath/$oem/$ver"
fi fi
if [ ! -d "backup/$syspath/$oem/$ver" ]; if [ ! -d "backup/$syspath/$oem/$ver" ];
then then
mkdir -p backup/$syspath/$oem/$ver mkdir -p "backup/$syspath/$oem/$ver"
fi fi
cp -rf dpkg/$syspath/$oem/* backup/$syspath/$oem/$ver cp -rf dpkg/$syspath/$oem/* backup/$syspath/$oem/$ver
path=""
if [ "$oem" == "hg" ] || [ "$oem" == "hgweb" ] || [ "$oem" == "hgso" ]; if [ "$oem" == "hg" ] || [ "$oem" == "hgweb" ] || [ "$oem" == "hgso" ];
then then
dpkgtype="hg" dpkgtype="hg"
@ -439,8 +440,8 @@ if [ $ismount == 0 ];
then then
if [ -d "$FIND_FILE/$syspath" ]; if [ -d "$FIND_FILE/$syspath" ];
then then
echo "$(date):mount is succeed and cp dpkg" echo "$(date):mount is succeed and cp dpkg"
echo $password|sudo -S cp -rf backup/dpkg/$mainverstr.$minver $FIND_FILE/$syspath echo "$password|sudo -S cp -rf backup/dpkg/$mainverstr.$minver $FIND_FILE/$syspath"
fi fi
fi fi

View File

@ -16,6 +16,11 @@ elif [ "$1" == "hw" ];then
echo "---------------dpkg hw---------------" echo "---------------dpkg hw---------------"
./build.sh hw $2 ./build.sh hw $2
./build.sh hwso $2 ./build.sh hwso $2
elif [ "$1" == "cts" ];then
echo "---------------dpkg cts---------------"
./build.sh cts $2
./build.sh ctsso $2
./build.sh ctsweb $2
else else
echo "---------------dpkg all---------------" echo "---------------dpkg all---------------"
./build.sh hg $2 ./build.sh hg $2