Re: RFC: postinstall scripts

Stefan Fiedler <[email protected]>
Newsgroups gmane.linux.distributions.rock.devel
Message-ID <[email protected]>
Am Donnerstag 14 April 2005 21:15 schrieb Clifford Wolf:
> Hi,
>
> I can't find the proposal on the list - so here it is (again, or the first
> time - I'm not sure...  ;-)
>
> Whenever 'mine' runs, it writes a logfile in
>
>  /var/adm/postinstall/<id>
>
> where <id> is a automatically generated unique id. The logfile has the same
> format as the flist files and so contains the package name and filename of
> every file touched (removed, added or modified) by mine.
>
> The shell-script 'postinstall' (installed in /usr/sbin) sets some shell
> functions and then sources all files in the /etc/postinstall.d directory.
>
> The shell functions defined by 'postinstall' can be used to check if files
> matching a pattern are contained in the liggering postinstall logfiles.
> That way e.g. glibc can install a postinstall which runs ldconfig whenever
> files matching '.*\.so' are removed, added or modified. After all
> postinstall scripts are executed, the files in /var/adm/postinstall are
> removed.
>
> When the option -a is passed to 'postinstall', the check function always
> returns true and so forces all the postinstall scripts to do everything
> they can do. This is e.g. usefull when packages are installed manually.
> The files in /var/adm/postinstall aren't touched in this mode.
>
> The 'rocket' script would run 'postinstall' automatically after installing
> or removing packages. The 'mine' command itself wouldn't run 'postinstall'.
>
> "You can now flame me, I am full of love"  ;-)
>
> yours,
>  - clifford

I think it's a good idea.
As you mentioned packages can't simply have postremove scripts, because they 
would be removed together with each package.
'postinstall' could check for postremove scripts in the /var/adm/postinstall/* 
logfiles, and copy installed or modified postremove scripts to a separate 
directory. If a package and its postremove script are removed 'postinstall' 
would run the copy of this script and (without the -a option) remove the 
copy. With the -a option given 'postinstall' would have to check if a 
postremove script was really removed before it runs the copy.

Hope that helps,
 Stefan Fiedler
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.