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

195
build.sh
View File

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

View File

@ -16,6 +16,11 @@ elif [ "$1" == "hw" ];then
echo "---------------dpkg hw---------------"
./build.sh hw $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
echo "---------------dpkg all---------------"
./build.sh hg $2