This commit is contained in:
modehua 2023-01-13 17:55:21 +08:00
parent 156b639310
commit fafb54d1d2
1 changed files with 132 additions and 120 deletions

250
build.sh
View File

@ -40,7 +40,7 @@ if [ "$oem" != "hg" ] \
echo "参数:华高:hg || hgweb 立思层:lsc || lscweb 汉王:hw || hwweb"
exit 1
fi
exit 1
function getismount()
{
if [ ! -d "/home/samba" ];then
@ -128,46 +128,46 @@ syspath="uos"
else
syspath="kylin"
if [ "$oem" == "hw" ] ;
then
dpkgpath="scanner-driver-hanvon"
elif [ "$oem" == "lsc" ];
then
dpkgpath="scanner-driver-lanxum"
elif [ "$oem" == "hg" ];
then
dpkgpath="scanner-driver-huagao"
elif [ "$oem" == "cts" ];
then
dpkgpath="scanner-driver-cumtenn"
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" == "hgso" ];
then
dpkgpath="huagaoscansdk"
elif [ "$oem" == "lscso" ];
then
dpkgpath="lanxumscansdk"
elif [ "$oem" == "hwso" ];
then
dpkgpath="hanvonscansdk"
elif [ "$oem" == "ctsso" ];
then
dpkgpath="cumtennscansdk"
elif [ "$oem" == "lscsm" ];
then
dpkgpath="lanxumscan"
fi
if [ "$oem" == "hw" ] ;
then
dpkgpath="scanner-driver-hanvon"
elif [ "$oem" == "lsc" ];
then
dpkgpath="scanner-driver-lanxum"
elif [ "$oem" == "hg" ];
then
dpkgpath="scanner-driver-huagao"
elif [ "$oem" == "cts" ];
then
dpkgpath="scanner-driver-cumtenn"
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" == "hgso" ];
then
dpkgpath="huagaoscansdk"
elif [ "$oem" == "lscso" ];
then
dpkgpath="lanxumscansdk"
elif [ "$oem" == "hwso" ];
then
dpkgpath="hanvonscansdk"
elif [ "$oem" == "ctsso" ];
then
dpkgpath="cumtennscansdk"
elif [ "$oem" == "lscsm" ];
then
dpkgpath="lanxumscan"
fi
fi
@ -288,12 +288,13 @@ echo $ver
Version="Version: $ver"
Architecture="Architecture: $dpkgarch"
packagename="package: $dpkgpath"
echo $Architecture $Version
cd ..
##############
cd ..
##############
#echo "dpkg/$syspath/$oem/usr/lib/$libpath"
#echo "dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/lib"
@ -304,51 +305,56 @@ rm dpkg/$syspath/$oem/etc/udev/rules.d/*
cp dpkg/60-sane.rules dpkg/$syspath/$oem/etc/udev/rules.d/60-"$oem"sane.rules
if [ -d "dpkg/$syspath/$oem/usr/lib" ];then
if [ "$cpu" == "mips64" ]; then
#创建sane的文件目录 //必须保证这一步成功
rm -rf dpkg/$syspath/$oem/usr/lib/*
if [ $? -ne 0 ];then
echo "del sane file fail"
exit 1
fi
rm -rf dpkg/$syspath/$oem/usr/lib/*
if [ ! -d dpkg/$syspath/$oem/usr/lib/$libpath ]; then
mkdir -p dpkg/$syspath/$oem/usr/lib/$libpath/sane
mkdir -p dpkg/$syspath/$oem/usr/lib/"mips64el-linux-gunabi64"/sane
if [ "$oem" == "lscsm" ];then
cp release/$syspath/$cpu/libsane-lscsane.so dpkg/$syspath/$oem/usr/lib/$libpath/sane/libsane-lscsane.so.1
cp release/$syspath/$cpu/libsane-lscsane.so dpkg/$syspath/$oem/usr/lib/"mips64el-linux-gunabi64"/sane/libsane-lscsane.so.1
else
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-"$oem"sane.so dpkg/$syspath/$oem/usr/lib/"mips64el-linux-gunabi64"/sane/libsane-"$oem"sane.so
fi
fi
if [ $? != 0 ];then
echo "-----------------cp mips64el libsane fail ,not find libsane-----------------"
exit 1
fi
else
rm -rf dpkg/$syspath/$oem/usr/lib/*
if [ ! -d dpkg/$syspath/$oem/usr/lib/$libpath ]; then
mkdir -p dpkg/$syspath/$oem/usr/lib/$libpath/sane
fi
if [ "$oem" == "lscsm" ];then
cp release/$syspath/$cpu/libsane-lscsane.so dpkg/$syspath/$oem/usr/lib/$libpath/sane/libsane-lscsane.so.1
else
cp release/$syspath/$cpu/libsane-"$oem"sane.so dpkg/$syspath/$oem/usr/lib/$libpath/sane/libsane-"$oem"sane.so.1
fi
fi
if [ $? != 0 ];then
echo "-----------------cp libsane fail ,not find libsane-----------------"
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 !!!"
exit 1
fi
echo "11111111111111111111111111111111111111111111111111111"
sleep 3
cp release/$syspath/$cpu/libsane-"$oem"sane.so dpkg/$syspath/$oem/usr/lib/$libpath/sane/libsane-"$oem"sane.so.1
if [ $? -ne 0 ];then
echo "copy libsane file fail !!!"
exit 1
fi
#kylin sp1有其他路径无法区分sp1 还是sp版本 ,所以全部进行拷贝即可 kylin mips 特殊处理
if [ "$cpu" == "mips64" ];
then
mkdir -p dpkg/$syspath/$oem/usr/lib/"mips64el-linux-gunabi64"/sane
if [ $? -ne 0 ];then
echo "mips64el mkdir sane file fail !!!"
exit 1
fi
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 !!!"
exit 1
fi
fi
else
echo "del sane file fail"
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
@ -361,35 +367,32 @@ elif [ "$oem" == "hgso" ] || [ "$oem" == "hwso" ] || [ "$oem" == "lscso" ] || [
elif [ "$oem" == "lscsm" ];then
cp release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/$dpkgpath
else
if [ "$sys" == "UnionTech" ];then
if [ "$cpu" == "x86_64" ]; then
sed -i "s/arm64/amd64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
sed -i "s/mips64el/amd64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
sed -i "s/loongarch64/amd64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
elif [ "$cpu" == "aarch64" ]; then
sed -i "s/amd64/arm64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
sed -i "s/mips64el/arm64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
sed -i "s/loongarch64/arm64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
elif [ "$cpu" == "mips64" ]; then
sed -i "s/amd64/mips64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
sed -i "s/arm64/mips64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
sed -i "s/loongarch64/mips64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
elif [ "$cpu" == "loongarch64" ]; then
sed -i "s/amd64/loongarch64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
sed -i "s/arm64/loongarch64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
sed -i "s/mips64/loongarch64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
fi
if [ "$sys" == "UnionTech" ];
then
#替换uos里面的info 虽然不晓得有啥用
appid='"appid":''"'$dpkgpath'"'','
InfoArch='"arch":[''"'$dpkgarch'"']','
version='"name":''"'$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
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/$syspath/$oem/opt/apps/$dpkgpath/files/lib
cp release/$syspath/$cpu/*Scan dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/bin
cp release/$syspath/$cpu/*App dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/bin
else
cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/apps/$dpkgpath/lib
cp release/$syspath/$cpu/*Scan dpkg/$syspath/$oem/opt/apps/$dpkgpath/bin
cp release/$syspath/$cpu/*App dpkg/$syspath/$oem/opt/apps/$dpkgpath/bin
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
if [ $? != 0 ];
then
echo "-----------------cp fail-----------------"
exit 1
fi
@ -398,35 +401,44 @@ pwd
chmod 755 dpkg -R
chmod 755 backup -R
if [ -d "backup/$syspath/$oem/$ver" ];then
if [ -d "backup/$syspath/$oem/$ver" ];
then
rm -rf backup/$syspath/$oem/$ver
fi
if [ ! -d "backup/$syspath/$oem/$ver" ]; then
if [ ! -d "backup/$syspath/$oem/$ver" ];
then
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
if [ "$oem" == "hg" ] || [ "$oem" == "hgweb" ] || [ "$oem" == "hgso" ];
then
dpkgtype="hg"
elif [ "$oem" == "lsc" ] || [ "$oem" == "lscweb" ] || [ "$oem" == "lscso" ] || [ "$oem" == "lscsm" ];then
elif [ "$oem" == "lsc" ] || [ "$oem" == "lscweb" ] || [ "$oem" == "lscso" ] || [ "$oem" == "lscsm" ];
then
dpkgtype="lsc"
elif [ "$oem" == "cts" ] || [ "$oem" == "ctsweb" ] || [ "$oem" == "ctsso" ];then
elif [ "$oem" == "cts" ] || [ "$oem" == "ctsweb" ] || [ "$oem" == "ctsso" ];
then
dpkgtype="cts"
else
dpkgtype="hw"
fi
if [ ! -d "backup/dpkg/$mainverstr.$minver/$time2/$dpkgtype" ];then
if [ ! -d "backup/dpkg/$mainverstr.$minver/$time2/$dpkgtype" ];
then
mkdir -p "backup/dpkg/$mainverstr.$minver/$time2/$dpkgtype/"
fi
dpkg -b backup/$syspath/$oem/$ver backup/dpkg/$mainverstr.$minver/$time2/$dpkgtype/$dpkgpath"_"$ver"_"$dpkgarch.deb
dpkg -b backup/$syspath/$oem/$ver backup/dpkg/$mainverstr.$minver/$time2/$dpkgtype/$dpkgpath"_"$ver"_"$dpkgarch.deb
getismount
if [ $ismount == 0 ];then
if [ -d "$FIND_FILE/$syspath" ];then
if [ $ismount == 0 ];
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
fi