Mantis - cswclassutils
Viewing Issue Advanced Details
3685 packaging tweak always 2009-05-23 11:39 2009-07-06 15:22
ja  
bonivart  
normal  
closed  
fixed  
none    
none  
0003685: cswpreserveconf
Config files handled with the class cswpreserveconf have always the ownerships root:other and not the desired ownership, which is specified for the .CSW file.

Example:

In CSWnagios.prototype

f cswpreserveconf /opt/csw/nagios/etc/cgi.cfg.CSW 0664 nagios nagios

results in

-rw-r--r-- 1 root other 10695 May 22 22:19 cgi.cfg
-rw-rw-r-- 1 nagios nagios 10695 Mar 20 22:26 cgi.cfg.CSW

and not as expected in

-rw-r--r-- 1 nagios nagios 10695 May 22 22:19 cgi.cfg
related to 0003959closed bonivart sampleconf fails sometimes 
Issue History
2009-05-23 11:39 ja New Issue
2009-05-23 12:24 bonivart Status new => assigned
2009-05-23 12:24 bonivart Assigned To => bonivart
2009-05-23 12:25 bonivart Note Added: 0006184
2009-05-23 12:26 bonivart Note Added: 0006185
2009-05-28 15:25 bonivart Note Added: 0006216
2009-07-01 16:47 bonivart Note Added: 0006376
2009-07-02 14:36 bonivart Note Added: 0006380
2009-07-05 21:13 bonivart Note Added: 0006398
2009-07-06 12:09 ja Note Added: 0006401
2009-07-06 14:46 bonivart Note Added: 0006402
2009-07-06 15:22 bonivart Note Added: 0006403
2009-07-06 15:22 bonivart Status assigned => closed
2009-07-06 15:22 bonivart Resolution open => fixed
2009-10-19 20:53 bonivart Relationship added related to 0003959

Notes
(0006184)
bonivart   
2009-05-23 12:25   
Also the permissions are from umask, not from .CSW file.
(0006185)
bonivart   
2009-05-23 12:26   
Phil is looking into this, I'm pretty sure it concerns cswcpsampleconf as well.
(0006216)
bonivart   
2009-05-28 15:25   
The problem is that the copy operation occurs before proper ownership/permissions are set (verification stage for each class), thus even a preserve copy only yields a file with default ownership/permissions.

One possible solution (not verified) is to locate the pkgmap during install and grep it for the correct ownership/permissions and apply them to the copy.
(0006376)
bonivart   
2009-07-01 16:47   
Patch for cswcpsampleconf:

--- i.cswcpsampleconf.090701 Wed Jul 1 13:59:09 2009
+++ i.cswcpsampleconf Wed Jul 1 16:47:10 2009
@@ -31,7 +31,13 @@
                echo $confdest already exists. Not overwriting
        else
                echo Copying sample config to $confdest
- cp -p $dest $confdest
+ contents=`grep "^$dest" /var/sadm/install/contents`
+ mode=`echo $contents | awk '{print $4}'`
+ user=`echo $contents | awk '{print $5}'`
+ group=`echo $contents | awk '{print $6}'`
+ cp $dest $confdest
+ chmod $mode $confdest
+ chown $user:$group $confdest
        fi
 done
(0006380)
bonivart   
2009-07-02 14:36   
1.17 in testing with the above patch.

http://mirror.opencsw.org/testing/cswclassutils-1.17,REV=2009.07.02-SunOS5.8-all-CSW.pkg.gz [^]
(0006398)
bonivart   
2009-07-05 21:13   
No response...I will install nagios myself and it sets ownership/permissions correctly I will release 1.17.
(0006401)
ja   
2009-07-06 12:09   
Sorry for the late feedback. Works great! I tested it with Nagios and another package, which is still under development and not published.
(0006402)
bonivart   
2009-07-06 14:46   
Ok, great, I have tested it as well and it seems to work so I will release it.

By the way, couldn't you have used the usergroup class to add users and groups?

http://wiki.opencsw.org/cswclassutils-package#toc5 [^]
(0006403)
bonivart   
2009-07-06 15:22   
cswclassutils 1.17 released which fixes the issue in both cpsampleconf and preserveconf.