Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have been creating Solaris packages for application deployment for some time, however recently I became aware that deployed files had the same timestamp of when the package was created. Looking through the various manpages (pkgproto, prototype, attributes, etc) I cant seem to find any option to instruct pkgproto/pkgmk to preserve file timestamps.

Anyone know how to ensure file timestamps are preserved within Solaris packages?

share|improve this question
    
What timestamps would you like the files to get instead of the package creation ones ? –  jlliagre Aug 7 '12 at 14:15
    
@jiliagre I do a "svn export" of the files before they get packaged, which preserves the file mtime. I would like this to be the timestamp that gets preserved inside the package. –  aaa90210 Aug 8 '12 at 0:09
    
The timestamp in the package manifest is the timestamp of the file as it was found at package creation. I just tried it again and set the mtime (and atime) of a file with 'touch -t', created a package, and verified that pkgmk picked up the correct timestamp: Jan 1 2009 abc -> 1 f none abc 0644 x x 0 0 1230786310 –  mghocke Aug 8 '12 at 17:23

1 Answer 1

The timestamps of the files are specified in the pkgmap file within the package. Example:

1 f none man/man1m/sudo.1m 0444 root root 36805 40001 1329918580

The very last column is the timestamp that the file will get. When you create the package, pkgmk uses the timestamp of that file during its run. So, it does preserve the timestamp. If you are saying you want the file to have the timestamp of the time when the package was installed, you have to edit the pkgmap file and replace all timestamps with the current time:

cd <pkg directory>
T=`perl -e 'print time()'`; sed -e 's/ [0-9][0-9]*$/'$T'/' pkgmap > pkgmap.new
mv pkgmap pkgmap.old
mv pkgmap.new pkgmap
cd ..
pkgadd -d . <pkg name>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.