Unix Technical Forum

Post-install script execution in a package

This is a discussion on Post-install script execution in a package within the comp.unix.bsd.openbsd.misc forums, part of the OpenBSD category; --> Hi all, Sorry to bother you, but I'm stuck. I have been trying to make a customized package with ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > comp.unix.bsd.openbsd.misc

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-16-2008, 08:10 AM
drymizu@gmail.com
 
Posts: n/a
Default Post-install script execution in a package

Hi all,

Sorry to bother you, but I'm stuck.

I have been trying to make a customized package with a post-install
script but I can't find out how to do it. ( Openbsd 3.8 ).
I am using an existing port where I customized the Makefile to change
some configuration options , then execute "make package".

Using the target post-install in the Makefile seems only to be
executed when I do the "make install" in the port directory.

Is there a way to make post-install scripts executed at the
installation of a package ?
I tried to untar existing packages with post-install in their port's
Makefile but can't find any trace of a post-install script.

Regards,
Matt

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-16-2008, 08:10 AM
Joachim Schipper
 
Posts: n/a
Default Re: Post-install script execution in a package

drymizu@gmail.com wrote:
> Hi all,
>
> Sorry to bother you, but I'm stuck.
>
> I have been trying to make a customized package with a post-install
> script but I can't find out how to do it. ( Openbsd 3.8 ).


Upgrade. Really.

> I am using an existing port where I customized the Makefile to change
> some configuration options , then execute "make package".
>
> Using the target post-install in the Makefile seems only to be
> executed when I do the "make install" in the port directory.
>
> Is there a way to make post-install scripts executed at the
> installation of a package ?
> I tried to untar existing packages with post-install in their port's
> Makefile but can't find any trace of a post-install script.


It's usually a better idea to use pkg/MESSAGE, anyway. But if you
*really* want to do, it's probably best to look at a port that already
does it and copy that behaviour. Postfix is an obvious example.

Do note that you'll want to use @exec/@unexec in pkg/PLIST instead of
obsolote stuff that will break as soon as you upgrade your system to a
modern version (i.e. pkg/INSTALL, which will no longer work in 4.2, see
ports/mail/postfix/snapshots/Makefile r1.170). Postfix uses this in
-current; look at
http://www.openbsd.org/cgi-bin/cvswe...tfix/snapshot/ for
details.

Joachim
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-16-2008, 08:10 AM
drymizu@gmail.com
 
Posts: n/a
Default Re: Post-install script execution in a package

Thanks for your tips.

On Aug 8, 6:01 am, "Joachim Schipper" <jdNoOtSPAMschip...@math.uu.nl>
wrote:
> It's usually a better idea to use pkg/MESSAGE, anyway. But if you
> *really* want to do, it's probably best to look at a port that already
> does it and copy that behaviour. Postfix is an obvious example.
>
> Do note that you'll want to use @exec/@unexec in pkg/PLIST instead of
> obsolote stuff that will break as soon as you upgrade your system to a
> modern version (i.e. pkg/INSTALL, which will no longer work in 4.2, see
> ports/mail/postfix/snapshots/Makefile r1.170). Postfix uses this in
> -current; look athttp://www.openbsd.org/cgi-bin/cvsweb/ports/mail/postfix/snapshot/for
> details.


This fixed my problem.
Thank you

Anyway you know if there is a doc for existing commands as @exec,
@unexec ?
I was not able to find the man page talking about that.

Matt

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-16-2008, 08:10 AM
Marc Espie
 
Posts: n/a
Default Re: Post-install script execution in a package

In article <1186453333.403184.312240@i13g2000prf.googlegroups .com>,
<drymizu@gmail.com> wrote:
>Hi all,
>
>Sorry to bother you, but I'm stuck.
>
>I have been trying to make a customized package with a post-install
>script but I can't find out how to do it. ( Openbsd 3.8 ).
>I am using an existing port where I customized the Makefile to change
>some configuration options , then execute "make package".
>
>Using the target post-install in the Makefile seems only to be
>executed when I do the "make install" in the port directory.


You're hopelesly confused. Read the description of ports builds in ports(7)
and bsd.port.mk(5). Focus on THE FAKE FRAMEWORK.

The post-install target has no incidence on the package installation. It's
all done during fake.

>Is there a way to make post-install scripts executed at the
>installation of a package ?
>I tried to untar existing packages with post-install in their port's
>Makefile but can't find any trace of a post-install script.


Put your script in the file system, add an @exec line in the packing-list.
Refer to pkg_create(1) for details.

Caveat: there are lots and lots of not so special cases that are better
dealt with WITHOUT using install scripts. Install scripts are special,
they break when you install stuff, they break when you update stuff, they
break when you remove stuff.

Think twice: do you really need that install script ? If you still think
so, think again. If you still think so, tell us about it.

As Joachim pointed out, as of 4.2, we have removed ALL install scripts from
the ports tree. The infrastructure is still there in pkg_create, but it
will be removed as well.

@exec/@unexec, especially with the new modes it has, is much simpler to
use, and needs ways less documentation. It's still fairly dangerous if
you don't know what you're doing...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-16-2008, 08:10 AM
drymizu@gmail.com
 
Posts: n/a
Default Re: Post-install script execution in a package

On Aug 8, 9:31 am, es...@lain.home (Marc Espie) wrote:
> Caveat: there are lots and lots of not so special cases that are better
> dealt with WITHOUT using install scripts. Install scripts are special,
> they break when you install stuff, they break when you update stuff, they
> break when you remove stuff.
>
> Think twice: do you really need that install script ? If you still think
> so, think again. If you still think so, tell us about it.


But using @exec/@unexec is more or less like an INSTALL since you
can execute commands on installation of the package, am I right ?

> As Joachim pointed out, as of 4.2, we have removed ALL install scripts from
> the ports tree. The infrastructure is still there in pkg_create, but it
> will be removed as well.
>
> @exec/@unexec, especially with the new modes it has, is much simpler to
> use, and needs ways less documentation. It's still fairly dangerous if
> you don't know what you're doing...


Effectively, I think that the @exec/@unexec way to do things is
convenient enough,
so I don't think INSTALL scripts are needed anymore with it.

Regards,
Matt

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-16-2008, 08:10 AM
Marc Espie
 
Posts: n/a
Default Re: Post-install script execution in a package

In article <1186533962.468204.323300@d30g2000prg.googlegroups .com>,
<drymizu@gmail.com> wrote:
>On Aug 8, 9:31 am, es...@lain.home (Marc Espie) wrote:
>> Caveat: there are lots and lots of not so special cases that are better
>> dealt with WITHOUT using install scripts. Install scripts are special,
>> they break when you install stuff, they break when you update stuff, they
>> break when you remove stuff.
>>
>> Think twice: do you really need that install script ? If you still think
>> so, think again. If you still think so, tell us about it.

>
>But using @exec/@unexec is more or less like an INSTALL since you
>can execute commands on installation of the package, am I right ?


yes, @exec and @unexec are *still* dangerous, and you *still* must think
twice before using them.

Long-term, a lot of the stuff that currently uses @exec will use other
mechanisms. Because it's more or less always register/deregister stuff,
which is a nicer way to think about it.

The more the packages understand the semantics of what's going on, the
better. Then you only fix bugs once, instead of reinventing the wheel all
over the place.

INSTALL scripts have always beeen a total nightmare. Most of them do not
interact well with existing frameworks, a large proportion of them are
buggy.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:06 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com