specific only the first level when creating deb

When creating a deb, directories is required to be in archive, so let
find don't omit directories is required.

https://stackoverflow.com/questions/4564434/why-does-my-hand-created-deb-package-fails-at-install-with-unable-to-create-on

Since find will output all directories and files, the ar command will
include a file twice (one when adding directory ar will include the
file inside it, one specific by filename), and the second one will be
a hardlink to the previous. This will case apt install failed as "error
creating hard link"

So now just let find output directories and files only as the first
level. And deeper files will be included automatically by ar.
This commit is contained in:
leafee98 2023-05-22 11:38:30 +08:00
parent b57dab0489
commit adc58ff421

View file

@ -93,10 +93,10 @@ function generate_deb {
local control_tgz="${tmpdir}/control.tar.gz"
local debian_binary="${tmpdir}/debian-binary"
find "${pkgdir}" -mindepth 1 -not -type d -not -path "${pkgdir}/DEBIAN*" -printf "%P\n" |
find "${pkgdir}" -mindepth 1 -maxdepth 1 -not -path "${pkgdir}/DEBIAN*" -printf "%P\n" |
tar -czf "${data_tgz}" -C "${pkgdir}" -T -
find "${pkgdir}/DEBIAN" -mindepth 1 -not -type d -printf "%P\n" |
find "${pkgdir}/DEBIAN" -mindepth 1 -maxdepth 1 -printf "%P\n" |
tar -czf "${control_tgz}" -C "${pkgdir}/DEBIAN" -T -
echo 2.0 > "${debian_binary}"