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?

  • 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

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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