debpkg icon indicating copy to clipboard operation
debpkg copied to clipboard

Document missing debpkg.yaml options

Open xor-gate opened this issue 7 years ago • 5 comments

I got a private email with the following question:

I try to use debpkg project to automactly build .deb packages but i did't find the way to add postinst script.

this is an extract of my debpkg.yml:

name: service
version: 1.1.0
{...}
files:
{...}
- file: service
dest: {{.BINDIR}}/service

It's could be great if you can give me some directives.

You need to add a control_extra section in the yaml file:

Script from file: https://github.com/xor-gate/debpkg/blob/master/config_test.go#L54-L58 Inline script: https://github.com/xor-gate/debpkg/blob/master/config_test.go#L96-L108

Let me know if it works. You could open a github issue this feature should be documented in the README.md

thats work like a charm :

root@115f40df64c1:/pkg# dpkg-deb -R service-1.1.7-x86_64.deb tmp root@115f40df64c1:/pkg# cd tmp/ root@115f40df64c1:/pkg/tmp# ls DEBIAN etc usr root@115f40df64c1:/pkg/tmp# cd DEBIAN/ root@115f40df64c1:/pkg/tmp/DEBIAN# ls conffiles control md5sums postinst root@115f40df64c1:/pkg/tmp/DEBIAN# cat postinst chown root:root /etc/service.conf chown root:root /usr/bin/service chmod 600 /etc/service.conf chmod 700 /usr/bin/service chmod u+s /usr/bin/service root@115f40df64c1:/pkg/tmp/DEBIAN#

debpkg.yml : name: service version: 1.1.7 architecture: amd64 maintainer: John Doe maintainer_email: [email protected] section: doe priority: standard built_using: doe/builder homepage: ***** description: short: Doe service platform utility long: > This paackage install a simple utility to restart or reload some services without privileges.

files:

  • file: service.conf dest: /etc/service.conf conffile: true
  • file: service dest: {{.BINDIR}}/service control_extra: postinst: postinst

Thank you very much^^

xor-gate avatar Apr 22 '18 07:04 xor-gate

Also not clear to me: Why did you replicate the control file as yml? Why not just pass a folder with control and postist etc in it?

tcurdt avatar Jul 16 '18 09:07 tcurdt

Raw injection of control,postinst is currently not supported. But it could be made to just pass a raw file for the control tarball. We just wrapped the whole control file in structures to create it programmaticly and have always valid(ated) debian packages. It is possible when accepting raw invalid files we write debian packages with control tarball files which will fail only on installation. We had no usecase like yours. When accepting arbitary control files I suggest we should also implement a reader/parser and validator because we want to make sure debpkg writes correct packages.

xor-gate avatar Jul 16 '18 13:07 xor-gate

I guess it should be possible to just create a parser, add detection for postinst+friends and then create the exact same underlying model that is use atm. So the existing validation should just work. No? That would make it a better 1:1 replacement for dpkg-deb.

And as the icing on the cake - suddenly documentation already exists ;)

tcurdt avatar Jul 16 '18 14:07 tcurdt

Yes, you are right. Creating a parser is possible and then validate the files. Some files in the control tarball need to be generated (e.g conffiles). Currently I have no plans to support raw control tarball files.

xor-gate avatar Jul 17 '18 07:07 xor-gate

@xor-gate why do the conffiles need to be generated by depkg? (wondering)

tcurdt avatar Jul 17 '18 08:07 tcurdt