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" echo "参数:华高:hg || hgweb 立思层:lsc || lscweb 汉王:hw || hwweb"
exit 1 exit 1
fi fi
exit 1
function getismount() function getismount()
{ {
if [ ! -d "/home/samba" ];then if [ ! -d "/home/samba" ];then
@ -128,46 +128,46 @@ syspath="uos"
else else
syspath="kylin" syspath="kylin"
if [ "$oem" == "hw" ] ; if [ "$oem" == "hw" ] ;
then then
dpkgpath="scanner-driver-hanvon" dpkgpath="scanner-driver-hanvon"
elif [ "$oem" == "lsc" ]; elif [ "$oem" == "lsc" ];
then then
dpkgpath="scanner-driver-lanxum" dpkgpath="scanner-driver-lanxum"
elif [ "$oem" == "hg" ]; elif [ "$oem" == "hg" ];
then then
dpkgpath="scanner-driver-huagao" dpkgpath="scanner-driver-huagao"
elif [ "$oem" == "cts" ]; elif [ "$oem" == "cts" ];
then then
dpkgpath="scanner-driver-cumtenn" dpkgpath="scanner-driver-cumtenn"
elif [ "$oem" == "hgweb" ]; elif [ "$oem" == "hgweb" ];
then then
dpkgpath="huagaowebscan" dpkgpath="huagaowebscan"
elif [ "$oem" == "lscweb" ]; elif [ "$oem" == "lscweb" ];
then then
dpkgpath="lanxumwebscan" dpkgpath="lanxumwebscan"
elif [ "$oem" == "hwweb" ]; elif [ "$oem" == "hwweb" ];
then then
dpkgpath="hanvonwebscan" dpkgpath="hanvonwebscan"
elif [ "$oem" == "ctsweb" ]; elif [ "$oem" == "ctsweb" ];
then then
dpkgpath="cumtennwebscan" dpkgpath="cumtennwebscan"
elif [ "$oem" == "hgso" ]; elif [ "$oem" == "hgso" ];
then then
dpkgpath="huagaoscansdk" dpkgpath="huagaoscansdk"
elif [ "$oem" == "lscso" ]; elif [ "$oem" == "lscso" ];
then then
dpkgpath="lanxumscansdk" dpkgpath="lanxumscansdk"
elif [ "$oem" == "hwso" ]; elif [ "$oem" == "hwso" ];
then then
dpkgpath="hanvonscansdk" dpkgpath="hanvonscansdk"
elif [ "$oem" == "ctsso" ]; elif [ "$oem" == "ctsso" ];
then then
dpkgpath="cumtennscansdk" dpkgpath="cumtennscansdk"
elif [ "$oem" == "lscsm" ]; elif [ "$oem" == "lscsm" ];
then then
dpkgpath="lanxumscan" dpkgpath="lanxumscan"
fi fi
fi fi
@ -288,12 +288,13 @@ echo $ver
Version="Version: $ver" Version="Version: $ver"
Architecture="Architecture: $dpkgarch" Architecture="Architecture: $dpkgarch"
packagename="package: $dpkgpath" packagename="package: $dpkgpath"
echo $Architecture $Version echo $Architecture $Version
cd ..
##############
cd ..
##############
#echo "dpkg/$syspath/$oem/usr/lib/$libpath" #echo "dpkg/$syspath/$oem/usr/lib/$libpath"
#echo "dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/lib" #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 cp dpkg/60-sane.rules dpkg/$syspath/$oem/etc/udev/rules.d/60-"$oem"sane.rules
if [ -d "dpkg/$syspath/$oem/usr/lib" ];then #创建sane的文件目录 //必须保证这一步成功
if [ "$cpu" == "mips64" ]; then 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
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/$libpath/sane if [ $? -ne 0 ];then
mkdir -p dpkg/$syspath/$oem/usr/lib/"mips64el-linux-gunabi64"/sane echo "mkdir sane file fail !!!"
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-----------------"
exit 1 exit 1
fi 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 fi
if [ "$oem" == "lscweb" ] || [ "$oem" == "hwweb" ] || [ "$oem" == "hgweb" ] || [ "$oem" == "ctsweb" ]; then 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 elif [ "$oem" == "lscsm" ];then
cp release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/$dpkgpath cp release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/$dpkgpath
else else
if [ "$sys" == "UnionTech" ];then if [ "$sys" == "UnionTech" ];
if [ "$cpu" == "x86_64" ]; then then
sed -i "s/arm64/amd64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info #替换uos里面的info 虽然不晓得有啥用
sed -i "s/mips64el/amd64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info appid='"appid":''"'$dpkgpath'"'','
sed -i "s/loongarch64/amd64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info InfoArch='"arch":[''"'$dpkgarch'"']','
elif [ "$cpu" == "aarch64" ]; then version='"name":''"'$ver'"'','
sed -i "s/amd64/arm64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info name='"name":''"'$oem'"'','
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 sed -i "5s/.*/ $InfoArch/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
elif [ "$cpu" == "mips64" ]; then sed -i "2s/.*/ $appid/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
sed -i "s/amd64/mips64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info sed -i "4s/.*/ $version/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info
sed -i "s/arm64/mips64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info sed -i "3s/.*/ $name/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 cp -rf release/$syspath/$cpu/* dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/lib
sed -i "s/arm64/loongarch64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info mv dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/lib/*Scan dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/bin
sed -i "s/mips64/loongarch64/g" dpkg/$syspath/$oem/opt/apps/$dpkgpath/info mv dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/lib/*App dpkg/$syspath/$oem/opt/apps/$dpkgpath/files/bin
fi
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 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
cp release/$syspath/$cpu/*Scan dpkg/$syspath/$oem/opt/apps/$dpkgpath/bin mv dpkg/$syspath/$oem/opt/apps/$dpkgpath/lib/*Scan dpkg/$syspath/$oem/opt/apps/$dpkgpath/bin
cp release/$syspath/$cpu/*App 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
fi fi
if [ $? != 0 ];then if [ $? != 0 ];
then
echo "-----------------cp fail-----------------" echo "-----------------cp fail-----------------"
exit 1 exit 1
fi fi
@ -398,35 +401,44 @@ pwd
chmod 755 dpkg -R chmod 755 dpkg -R
chmod 755 backup -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 rm -rf backup/$syspath/$oem/$ver
fi fi
if [ ! -d "backup/$syspath/$oem/$ver" ]; then if [ ! -d "backup/$syspath/$oem/$ver" ];
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="" path=""
if [ "$oem" == "hg" ] || [ "$oem" == "hgweb" ] || [ "$oem" == "hgso" ];then if [ "$oem" == "hg" ] || [ "$oem" == "hgweb" ] || [ "$oem" == "hgso" ];
then
dpkgtype="hg" dpkgtype="hg"
elif [ "$oem" == "lsc" ] || [ "$oem" == "lscweb" ] || [ "$oem" == "lscso" ] || [ "$oem" == "lscsm" ];then elif [ "$oem" == "lsc" ] || [ "$oem" == "lscweb" ] || [ "$oem" == "lscso" ] || [ "$oem" == "lscsm" ];
then
dpkgtype="lsc" dpkgtype="lsc"
elif [ "$oem" == "cts" ] || [ "$oem" == "ctsweb" ] || [ "$oem" == "ctsso" ];then elif [ "$oem" == "cts" ] || [ "$oem" == "ctsweb" ] || [ "$oem" == "ctsso" ];
then
dpkgtype="cts" dpkgtype="cts"
else else
dpkgtype="hw" dpkgtype="hw"
fi 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/" mkdir -p "backup/dpkg/$mainverstr.$minver/$time2/$dpkgtype/"
fi 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 getismount
if [ $ismount == 0 ];then if [ $ismount == 0 ];
if [ -d "$FIND_FILE/$syspath" ];then then
if [ -d "$FIND_FILE/$syspath" ];
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