From b5fc76cb4e5f56b57f89f838821921aef7026c33 Mon Sep 17 00:00:00 2001 From: modehua Date: Tue, 7 Mar 2023 15:10:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=9C=A8kylin=E6=89=93?= =?UTF-8?q?=E5=8C=85=E5=85=B6=E4=BB=96=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.sh | 187 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 102 insertions(+), 85 deletions(-) diff --git a/build.sh b/build.sh index 5e90bb9..34ac0a2 100755 --- a/build.sh +++ b/build.sh @@ -13,10 +13,27 @@ FIND_FILE="/home/samba/dpkg" #服务器存放打包路径 不可修改 dpkgtype="app" ver3=10 sanelibname="" +syspath="" #系统库路径 +dpkgtype="" #哪种打包方式 uos 还是kylin + +#web so 只走kylin的打包方式 if [ $2 ]; then - password=$2 + dpkgtype=$2 #可以手动设置操作系统来进行打包 + echo "$dpkgtype" +else + if [ "$sys" == "UnionTech" ]; + then + dpkgtype=uos + else + dpkgtype=kylin + fi +fi + +if [ $3 ]; +then + password=$3 fi echo "$password" @@ -31,6 +48,7 @@ if [ "$oem" != "hg" ] \ && [ "$oem" != "hwso" ] \ && [ "$oem" != "lscsm" ]\ && [ "$oem" != "zj" ]\ +&& [ "$oem" != "ctsso" ]\ && [ "$oem" != "cts" ]; then echo "参数错误:$oem !!!" @@ -40,10 +58,12 @@ fi if [ "${oem:0-2:2}" == "so" ] || [ "${oem:0-2:2}" == "sm" ]; then + dpkgtype=kylin sanelibname="${oem%${oem:0-2:2}*}" echo $sanelibname elif [ "${oem:0-3:3}" == "web" ]; then + dpkgtype=kylin sanelibname="${oem%${oem:0-3:3}*}" echo $sanelibname else @@ -68,21 +88,21 @@ function appbuild() git -C ../sdk pull #git -C ../code_device clean -df - git -C ../code_device checkout . - git -C ../code_device pull + #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 + #git -C ../code_app checkout . + #git -C ../code_app pull - git -C ../code_lang checkout . - git -C ../code_lang pull + #git -C ../code_lang checkout . + #git -C ../code_lang pull echo "-----------------------------start code_lang build-----------------------------" ./../code_lang/build.sh echo "-----------------------------start code_device build-----------------------------" - ./../code_device/build.sh $sanelibname + ./../code_device/build.sh $sanelibname $dpkgtype echo "-----------------------------over code_device build-----------------------------" @@ -96,7 +116,7 @@ function appbuild() then ./../code_app/build.sh ${oem%${oem:0-2:2}*} else - ./../code_app/build.sh $oem + ./../code_app/build.sh $oem echo "" fi echo "-----------------------------over code_app build-----------------------------" @@ -152,10 +172,40 @@ else exit 1 fi -if [ "$sys" == "UnionTech" ]; +if [ "$syspath" == "uos" ] || [ "$sys" == "UnionTech" ]; then -syspath="uos" + syspath="uos" +elif [ "$syspath" == "kylin" ] && [ "$sys" == "UnionTech" ]; +then + syspath="uos" + +elif [ "$syspath" == "" ] && [ "$sys" == "UnionTech" ]; +then + syspath="uos" + + +elif [ "$syspath" == "kylin" ] || [ "$sys" == "Kylin" ]; +then + syspath="kylin" + +elif [ "$syspath" == "uos" ] && [ "$sys" == "Kylin" ]; +then + syspath="kylin" + +elif [ "$syspath" == "" ] && [ "$sys" == "Kylin" ]; +then + syspath="kylin" + +else + syspath="kylin" +fi + + +echo $syspath + +if [ $dpkgtype == "uos" ]; +then if [ "$oem" == "hw" ]; then dpkgpath="com.hanvonchina.hanvonscan" @@ -171,40 +221,8 @@ syspath="uos" elif [ "$oem" == "zj" ]; then dpkgpath="com.microtekchina.microtekscan" - elif [ "$oem" == "hgweb" ]; - then - dpkgpath="huagaowebscan" - elif [ "$oem" == "lscweb" ]; - then - dpkgpath="lanxumwebscan" - elif [ "$oem" == "hwweb" ]; - then - dpkgpath="hanvonwebscan" - elif [ "$oem" == "ctsweb" ]; - then - dpkgpath="cumtennwebscan" - elif [ "$oem" == "zjweb" ]; - then - dpkgpath="microtekwebscan" - elif [ "$oem" == "hgso" ]; - then - dpkgpath="huagaoscansdk" - elif [ "$oem" == "lscso" ]; - then - dpkgpath="lanxumscansdk" - elif [ "$oem" == "hwso" ]; - then - dpkgpath="hanvonscansdk" - elif [ "$oem" == "ctsso" ]; - then - dpkgpath="cumtennscansdk" - elif [ "$oem" == "zjso" ]; - then - dpkgpath="microtekscansdk" fi - else -syspath="kylin" if [ "$oem" == "hw" ] ; then dpkgpath="scanner-driver-hanvon" @@ -248,8 +266,7 @@ syspath="kylin" then dpkgpath="lanxumscan" fi -fi - +fi if [ "$oem" == "lsc" ] \ || [ "$oem" == "lscweb" ] \ @@ -288,10 +305,10 @@ then fi ver3=$[$ver3 * 100] -if [ "$sys" == "UnionTech" ]; +if [ "$syspath" == "uos" ]; then ver3=$[$ver3 + 20] -elif [ "$sys" == "Kylin" ]; +elif [ "$syspath" == "kylin" ]; then ver3=$[$ver3 + 21] else @@ -332,30 +349,30 @@ if [ "$oem" != "lscsm" ]; then ##############进行copy语言包 cp -rf release/lang release/$syspath/$cpu - sed -i "1s/.*/$packagename/g" dpkg/$syspath/$oem/DEBIAN/control - sed -i "2s/.*/$Version/g" dpkg/$syspath/$oem/DEBIAN/control + sed -i "1s/.*/$packagename/g" dpkg/$dpkgtype/$oem/DEBIAN/control + sed -i "2s/.*/$Version/g" dpkg/$dpkgtype/$oem/DEBIAN/control fi -sed -i "3s/.*/$Architecture/g" dpkg/$syspath/$oem/DEBIAN/control -rm dpkg/$syspath/$oem/etc/udev/rules.d/* +sed -i "3s/.*/$Architecture/g" dpkg/$dpkgtype/$oem/DEBIAN/control +rm dpkg/$dpkgtype/$oem/etc/udev/rules.d/* -cp dpkg/60-sane.rules dpkg/$syspath/$oem/etc/udev/rules.d/60-"$oem"sane.rules +cp dpkg/60-sane.rules dpkg/$dpkgtype/$oem/etc/udev/rules.d/60-"$oem"sane.rules #创建sane的文件目录 //必须保证这一步成功 -rm -rf dpkg/$syspath/$oem/usr/lib/* +rm -rf dpkg/$dpkgtype/$oem/usr/lib/* if [ $? -ne 0 ];then echo "del sane file fail" exit 1 fi -if [ ! -d dpkg/$syspath/$oem/usr/lib/$libpath ]; +if [ ! -d dpkg/$dpkgtype/$oem/usr/lib/$libpath ]; then - mkdir -p dpkg/$syspath/$oem/usr/lib/$libpath/sane + mkdir -p dpkg/$dpkgtype/$oem/usr/lib/$libpath/sane if [ $? -ne 0 ];then - echo "mkdir sane file fail !!! --->mkdir path dpkg/$syspath/$oem/usr/lib/$libpath/sane" + echo "mkdir sane file fail !!! --->mkdir path dpkg/$dpkgtype/$oem/usr/lib/$libpath/sane" exit 1 fi - cp release/$syspath/$cpu/libsane-"$sanelibname"sane.so dpkg/$syspath/$oem/usr/lib/$libpath/sane/libsane-"$sanelibname"sane.so.1 + cp release/$syspath/$cpu/libsane-"$sanelibname"sane.so dpkg/$dpkgtype/$oem/usr/lib/$libpath/sane/libsane-"$sanelibname"sane.so.1 if [ $? -ne 0 ];then echo "copy libsane file fail sane name is :libsane-"$sanelibname"sane.so!!!" @@ -365,12 +382,12 @@ then #kylin sp1有其他路径,无法区分sp1 还是sp版本 ,所以全部进行拷贝即可 kylin mips 特殊处理 if [ "$cpu" == "mips64" ]; then - mkdir -p dpkg/$syspath/$oem/usr/lib/"mips64el-linux-gnuabi64"/sane + mkdir -p dpkg/$dpkgtype/$oem/usr/lib/"mips64el-linux-gnuabi64"/sane if [ $? -ne 0 ];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-gnuabi64"/sane/libsane-"$sanelibname"sane.so.1 + cp release/$syspath/$cpu/libsane-"$sanelibname"sane.so dpkg/$dpkgtype/$oem/usr/lib/"mips64el-linux-gnuabi64"/sane/libsane-"$sanelibname"sane.so.1 if [ $? -ne 0 ];then echo "copy libsane file fail sane name is :libsane-"$sanelibname"sane.so!!!" @@ -385,14 +402,14 @@ fi if [ "$oem" == "lscweb" ] || [ "$oem" == "hwweb" ] || [ "$oem" == "hgweb" ] || [ "$oem" == "ctsweb" ]; then - cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/$dpkgpath/bin + cp -rf release/$syspath/$cpu/* dpkg/$dpkgtype/$oem/opt/$dpkgpath/bin elif [ "$oem" == "hgso" ] || [ "$oem" == "hwso" ] || [ "$oem" == "lscso" ] || [ "$oem" == "ctsso" ]; then - cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/$dpkgpath/lib - cp sdk/include/scannerlib/* dpkg/$syspath/$oem/opt/$dpkgpath/include + cp -rf release/$syspath/$cpu/* dpkg/$dpkgtype/$oem/opt/$dpkgpath/lib + cp sdk/include/scannerlib/* dpkg/$dpkgtype/$oem/opt/$dpkgpath/include elif [ "$oem" == "lscsm" ]; then - cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/$dpkgpath + cp -rf release/$syspath/$cpu/* dpkg/$dpkgtype/$oem/opt/$dpkgpath else #暂时只拷贝立思辰 if [ "$oem" == "lsc" ]; @@ -401,11 +418,11 @@ else then mkdir -p "dpkg/$syspath/$oem/usr/local/lib/sane/" fi - cp release/$syspath/$cpu/libsane-"$sanelibname"sane.so dpkg/$syspath/$oem/usr/local/lib/sane/libsane-"$sanelibname"sane.so.1 + cp release/$syspath/$cpu/libsane-"$sanelibname"sane.so dpkg/$dpkgtype/$oem/usr/local/lib/sane/libsane-"$sanelibname"sane.so.1 fi - savedpkgpath="dpkg/$syspath/$oem/opt/apps/$dpkgpath" + savedpkgpath="dpkg/$dpkgtype/$oem/opt/apps/$dpkgpath" echo $dpkgpath - if [ "$sys" == "UnionTech" ]; + if [ "$dpkgtype" == "uos" ]; then #替换uos里面的info 虽然不晓得有啥用 appid='"appid":''"'$dpkgpath'"'',' @@ -414,14 +431,14 @@ else name='"name":''"'$oem'"'',' 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" + sed -i "2s/.*/ $appid/g" "dpkg/$dpkgtype/$oem/opt/apps/$dpkgpath/info" + sed -i "4s/.*/ $version/g" "dpkg/$dpkgtype/$oem/opt/apps/$dpkgpath/info" + sed -i "3s/.*/ $name/g" "dpkg/$dpkgtype/$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 + cp -rf release/$syspath/$cpu/* dpkg/$dpkgtype/$oem/opt/apps/$dpkgpath/files/lib + mv dpkg/$dpkgtype/$oem/opt/apps/$dpkgpath/files/lib/*Scan dpkg/$dpkgtype/$oem/opt/apps/$dpkgpath/files/bin + mv dpkg/$dpkgtype/$oem/opt/apps/$dpkgpath/files/lib/*App dpkg/$dpkgtype/$oem/opt/apps/$dpkgpath/files/bin if [ $? != 0 ]; then echo "-----------------cp fail-----------------" @@ -429,9 +446,9 @@ else fi 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 + cp -rf release/$syspath/$cpu/* dpkg/$dpkgtype/$oem/opt/apps/$dpkgpath/lib + mv dpkg/$dpkgtype/$oem/opt/apps/$dpkgpath/lib/*Scan dpkg/$dpkgtype/$oem/opt/apps/$dpkgpath/bin + mv dpkg/$dpkgtype/$oem/opt/apps/$dpkgpath/lib/*App dpkg/$dpkgtype/$oem/opt/apps/$dpkgpath/bin if [ $? != 0 ]; then echo "-----------------cp fail-----------------" @@ -443,34 +460,34 @@ fi chmod 755 dpkg -R chmod 755 backup -R -if [ -d "backup/$syspath/$oem/$ver" ]; +if [ -d "backup/$dpkgtype/$oem/$ver" ]; then - rm -rf "backup/$syspath/$oem/$ver" + rm -rf "backup/$dpkgtype/$oem/$ver" fi -if [ ! -d "backup/$syspath/$oem/$ver" ]; +if [ ! -d "backup/$dpkgtype/$oem/$ver" ]; then - mkdir -p "backup/$syspath/$oem/$ver" + mkdir -p "backup/$dpkgtype/$oem/$ver" fi -cp -rf dpkg/$syspath/$oem/* backup/$syspath/$oem/$ver +cp -rf dpkg/$dpkgtype/$oem/* backup/$dpkgtype/$oem/$ver -if [ ! -d "backup/dpkg/$mainverstr.$minver/$time2/$sanelibname" ]; +if [ ! -d "backup/dpkg/$dpkgtype/$mainverstr.$minver/$time2/$sanelibname" ]; then - mkdir -p "backup/dpkg/$mainverstr.$minver/$time2/$sanelibname/" + mkdir -p "backup/dpkg/$dpkgtype/$mainverstr.$minver/$time2/$sanelibname/" fi -dpkg -b backup/$syspath/$oem/$ver backup/dpkg/$mainverstr.$minver/$time2/$sanelibname/$dpkgpath"_"$ver"_"$dpkgarch.deb +dpkg -b backup/$dpkgtype/$oem/$ver backup/dpkg/$dpkgtype/$mainverstr.$minver/$time2/$sanelibname/$dpkgpath"_"$ver"_"$dpkgarch.deb getismount if [ $ismount == 0 ]; then - if [ -d "$FIND_FILE/$syspath" ]; + if [ -d "$FIND_FILE/$dpkgtype" ]; 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/$dpkgtype/$mainverstr.$minver $FIND_FILE/$dpkgtype fi fi