home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 February / Chip_2004-02_cd1.bin / opsys / macos / batt / batt.dmg / BatteryUpdate.pkg / Contents / Resources / postflight < prev    next >
Text File  |  2003-11-20  |  821b  |  39 lines

  1. #!/usr/bin/perl
  2. use strict;
  3.  
  4. my $target = $ARGV[2];
  5. my $pkg = $ARGV[0];
  6.  
  7. #####################################################################################################
  8.  
  9. my $permissions_info_file = "/tmp/com.apple.installation.savedperm";
  10. my @stat_info;
  11. my $MODE = 2;
  12. my $UID = 4;
  13. my $GID = 5;
  14.  
  15. if(-e $permissions_info_file) {
  16.     if(open(PERMS_FILE_HDL, "$permissions_info_file")) {
  17.         while(<PERMS_FILE_HDL>) {
  18.             my $item = $_;
  19.             chomp($item);
  20.             push(@stat_info, $item);
  21.         }
  22.         close(PERMS_FILE_HDL);
  23.         unlink($permissions_info_file);
  24.  
  25.         chown($stat_info[$UID], $stat_info[$GID], $target);
  26.         chmod($stat_info[$MODE] & 07777, $target);
  27.     }
  28. } else {
  29.     
  30.     print "Couldn\'t find saved permissions file.";
  31.  
  32. }
  33.  
  34. exit 0;
  35.  
  36. #####################################################################################################
  37.  
  38.  
  39.