install lib with deb (lock)

I use the CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA to install some library with deb.

preinstall script

apt-get install -y lshw

But get the error

Fetched 1194 kB in 2s (698 kB/s)
Reading package lists...
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 459749 (dpkg)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
dpkg: error processing archive 123.deb (--install):
 new aims package pre-installation script subprocess returned error exit status 100

how can I install some lib with deb?

sudo dpkg -i 123.deb

And then the deb will install other lib (apt install xxx)

I don’t think you can call apt-get from a pre-install script. What you’re looking for is the job of a Requires line in the package metadata.

Cc: @kyle.edwards

Do you have any suggestion ?
apt install libpq5
apt install libgoogle-perftools4
apt install vlc

Suggestions for what? You cannot use apt-get install during the pre-install for a package. It looks like CPACK_DEBIAN_PACKAGE_DEPENDS is what you want.

just to check whether the lib install or not.
if not install, it will show hint to install,right

dpkg has “Recommends” and “Suggests” as well. If CPack doesn’t support them, feature requests would be suitable.