I came across the same behaviour with /export/home and I found it a bit 
disturbing. I work in an environment where some packages will create an 
/export/home/<application_user>.  Meanwhile, regular users are created with 
useradd or Ops Center as part of day to day operations. Of course pkg(5)'s 
ref-counters don't know what has happened at the command line, so it tries to 
remove /export/home when the application team uninstall a package.

There is similar behaviour for /, thankfully pkg(5) fails to remove the root 
directory, but it leaves a nasty stack trace, an incomplete BE and it looks 
embarrassing.  This comes about when a package has a user action that doesn't 
specify a home directory.  

It is not immediately apparent from the man page that an undeclared home-dir is 
a potentially bad thing. The man pages says:

  home-dir  The user's home directory. Default value is /.


For the short term, I made a little package like you suggested for Steve's 
problem.  I can imagine the looks I am going to get when I explain to the Ops 
Team "see that package there, you must never ever remove it, bad things will 
happen".  Probably the same looks that SFW/Unix Packages users will give ;-)

For the medium term, the solution seems straight-forward to me.

Amongst other things pkg://solaris/system/core-os delivers 'root', 'home', 
'export' and 'usr'   
core-os is not likely to be casually uninstalled, so it seems the right place 
to also deliver '/', 'export/home' and 'usr/local'

Some might argue that core-os shouldn't deliver an empty optional directory 
like /usr/local.
I would then point out that core-os currently delivers the empty optional 
directory /usr/games

Cheers,
Rick


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Shawn Walker
Sent: Friday, 19 October 2012 4:23 AM
To: Steve Christensen
Cc: [email protected]
Subject: Re: [pkg-discuss] directory removal on uninstall

On 10/18/12 00:24, Steve Christensen wrote:
> I have had some questions on my IPS packages. The installation of
> several packages - in /usr/local directories - goes fine. But when a
> user does an uninstall on just one of the packages, the entire
> /usr/local directory gets removed, not just the files in the packages.
> How do I prevent this?
> Apparently, the /usr/local directory existed before the install of any
> of my packages.

To ensure the correct state of the system, all files a package delivers 
are removed when a package is removed, and all directories and links are 
removed when the last package to declare them is removed.

The pkg(5) team has discussed possible enhancements to this where 
package creators could declare the desired behaviour for removal. 
However, no implementation exists at this time.

The best alternative I can suggest at the moment is for the user to 
install a stub package that is never removed that delivers /usr/local. 
As long as that package remains installed, the directory will not be 
removed.

Cheers,
-Shawn
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to