bash script to deploy application on linux platfrom

bash script to deploy application on linux platfrom

Guide

copy libs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
# usage: ./copylib.sh ./example_opencv

bin=$1
dest="./lib"

if [ ! -d $dest ];then
echo "makedir $dest"
mkdir $dest
fi

libs=$(ldd $bin | awk '{if (match($3,"/")){ printf("%s "),$3 } }')
#echo $libs
cp $libs $dest
echo "Done"

run scripts to copy libs to lib folder.

./copylib.sh ./example_opencv

tree lib
lib
├── libc.so.6
├── libdl.so.2
├── libgcc_s.so.1
├── libjasper.so.1
├── libjbig.so.0
├── libjpeg.so.8
├── liblzma.so.5
├── libm.so.6
├── libopencv_core.so.3.1
├── libopencv_imgcodecs.so.3.1
├── libopencv_imgproc.so.3.1
├── libpng12.so.0
├── libpthread.so.0
├── librt.so.1
├── libstdc++.so.6
├── libtiff.so.5
└── libz.so.1

0 directories, 17 files

linuxdeployqt

Makes Linux applications self-contained by copying in the libraries and plugins that the application uses, and optionally generates an AppImage. Can be used for Qt and other applications.

Reference

History

  • 20190314: created.
坚持技术分享,您的支持将鼓励我继续创作!