Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document missing debpkg.yaml options #28

Open
xor-gate opened this issue Apr 22, 2018 · 5 comments
Open

Document missing debpkg.yaml options #28

xor-gate opened this issue Apr 22, 2018 · 5 comments

Comments

@xor-gate
Copy link
Owner

xor-gate commented Apr 22, 2018

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^^

@tcurdt
Copy link

tcurdt commented Jul 16, 2018

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?

@xor-gate
Copy link
Owner Author

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.

@tcurdt
Copy link

tcurdt commented Jul 16, 2018

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 ;)

@xor-gate
Copy link
Owner Author

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.

@tcurdt
Copy link

tcurdt commented Jul 17, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants