home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2003 August
/
Chip_2003-08_cd1.bin
/
zkuste
/
macos
/
Files
/
iChatAV.dmg
/
iChatAVBeta.pkg
/
Contents
/
Resources
/
postflight
< prev
next >
Wrap
Text File
|
2003-06-09
|
8KB
|
293 lines
#!/usr/bin/perl
use IO::File;
use File::Spec;
my $target = $ARGV[2];
my $TEMP_DIR = $ARGV[2] . "/private/tmp/fpuzhpxf2/";
my $REVERTER_DIR = $TEMP_DIR . "/iChatBetaReverter.pkg/";
my $REVERTER_ROOT = $TEMP_DIR . "/Root/";
my $RECYCLING = $TEMP_DIR . "/Recycling/";
########################################################################################
my $REVERTER_SKELETON = $ARGV[0] . "/Contents/iChatBetaReverter.pkg";
system("/bin/cp -r \"$REVERTER_SKELETON\" \"$TEMP_DIR\"");
########################################################################################
# iChat Application
my $HIDER = $REVERTER_DIR . "Contents/" . "iChatVersion";
my $BUNDLE = "/Applications/iChat.app/";
my $VERS = $BUNDLE . "Contents/version.plist";
GoReportRevertableInstallOver();
########################################################################################
# iChat Menu Extra DooDad
$HIDER = $REVERTER_DIR . "Contents/" . "iChatMenuVersion";
$BUNDLE = "/System/Library/CoreServices/Menu Extras/iChat.menu/";
$VERS = $BUNDLE . "Contents/version.plist";
GoReportRevertableInstallOver();
########################################################################################
# Instant Message Framework
$HIDER = $REVERTER_DIR . "Contents/" . "InstantMessageFrameworkVersion";
$BUNDLE = "/System/Library/PrivateFrameworks/InstantMessage.framework/";
$VERS = $BUNDLE . "Versions/A/Resources/version.plist";
GoReportRevertableInstallOver();
########################################################################################
# Video Conference Framework
$HIDER = $REVERTER_DIR . "Contents/" . "VideoConferenceFrameworkVersion";
$BUNDLE = "/System/Library/PrivateFrameworks/VideoConference.framework/";
$VERS = $BUNDLE . "Versions/A/Resources/version.plist";
GoReportRevertableInstallOver();
########################################################################################
# VCH263Codec
$HIDER = $REVERTER_DIR . "Contents/" . "VCH263CodecVersion";
$BUNDLE = "/System/Library/Components/VCH263Codec.component/";
$VERS = $BUNDLE . "Contents/version.plist";
GoReportRevertableInstallOver();
########################################################################################
# SystemUIServer
$HIDER = $REVERTER_DIR . "Contents/SystemUIServerVersion";
$BUNDLE = "/System/Library/CoreServices/SystemUIServer.app/";
$VERS = $BUNDLE . "Contents/version.plist";
if (CheckVersion("$VERS", GetVersion("$REVERTER_ROOT . $VERS", "SourceVersion"), "SourceVersion", ">") )
{
my $HIDER = $REVERTER_DIR . "Contents/VCH263CodecVersion";
my $VERS = "/System/Library/Components/VCH263Codec.component/Contents/version.plist";
sysopen( HIDER, $HIDER, O_WRONLY|O_TRUNC|O_CREAT );
print HIDER GetVersion($VERS,"SourceVersion") . "\n";
close HIDER;
}
else
{
system("/bin/mv \"" . $REVERTER_ROOT . $BUNDLE ."\" \"" . $BUNDLE. "\"");
}
######## NON-REVERTABLE BUNDLES ###########
########################################################################################
# iSightAudio Plugin
$BUNDLE = "/Library/Audio/Plug-Ins/HAL/iSightAudio.plugin";
$VERS = $BUNDLE . "/Contents/version.plist";
(my $VOL, my $PATH, my $PACK) = File::Spec->splitpath( $BUNDLE );
if (-d $RECYCLING . $PACK) {
if (CheckVersion($VERS, GetVersion($RECYCLING . $PACK, "SourceVersion"), "SourceVersion", "<=") )
{
system("/bin/mv \"" . $RECYCLING . $PACK ."\" \"" . $BUNDLE. "\"");
}
}
########################################################################################
# Apple_iSight kext
$BUNDLE = "/System/Library/Extensions/Apple_iSight.kext";
$VERS = $BUNDLE . "/Contents/version.plist";
($VOL, $PATH, $PACK) = File::Spec->splitpath( $BUNDLE );
if (-d $RECYCLING . $PACK) {
if (CheckVersion($VERS, GetVersion($RECYCLING . $PACK, "SourceVersion"), "SourceVersion", "<=") )
{
system("/bin/mv \"" . $RECYCLING . $PACK ."\" \"" . $BUNDLE. "\"");
}
}
########################################################################################
# QuickTimeIIDCDigitizer
$BUNDLE = "/System/Library/QuickTime/QuickTimeIIDCDigitizer.component";
$VERS = $BUNDLE . "/Contents/version.plist";
($VOL, $PATH, $PACK) = File::Spec->splitpath( $BUNDLE );
if (-d $RECYCLING . $PACK) {
if (CheckVersion($VERS, GetVersion($RECYCLING . $PACK, "SourceVersion"), "SourceVersion", "<=") )
{
system("/bin/mv \"" . $RECYCLING . $PACK ."\" \"" . $BUNDLE. "\"");
}
}
########################################################################################
use Cwd;
my $olddir = getcwd();
chdir($REVERTER_ROOT);
system("/bin/pax -w -z -x cpio -f \"" . $REVERTER_DIR . "/Contents/Archive.pax.gz\" ./");
system("/usr/bin/mkbom ./ \"" . $REVERTER_DIR . "/Contents/Archive.bom\"");
chdir($olddir);
system("/bin/mv \"" . $REVERTER_DIR . "\" \"/Library/Application Support/\"");
########################################################################################
system "/usr/sbin/kextcache -l -a `arch` -m \"$target/System/Library/Extensions.mkext\" " . "\"$target/System/Library/Extensions\"";
system "/usr/bin/touch -c \"$target/System/Library/Extensions/\"";
system "/usr/bin/touch -c \"$target/Applications/\"";
exit(0);
########################################################
########################################################
########################################################
########################################################
########################################################
########################################################
sub GoReportRevertableInstallOver
{
sysopen( HIDER, $HIDER, O_WRONLY|O_TRUNC|O_CREAT );
print HIDER GetVersion($VERS,"SourceVersion") . "\n";
close HIDER;
}
########################################################
########################################################
sub CheckVersion
{
my $path = $_[0];
my $version = $_[1];
my $keyName = $_[2];
my $operator = $_[3];
my $oldSeperator;
my $plistData;
my @items;
my $item;
my $versiondata;
my $i;
my @theVersionArray;
my %versiondata;
my @versionArray;
# if there's no THERE there, we return FALSE
if (! -e $path) {
return 0;
}
if (!$operator) {
$operator = "==";
}
$oldSeperator = $/;
$/ = \0;
open( PLIST, "$path") || do {
return 0;
};
$plistData = <PLIST>;
$plistData =~ /<dict>(.*?)<\/dict>/gis;
@items = split(/<key>/, $plistData);
shift @items;
foreach $item (@items) {
$item =~ /(.*?)<\/key>.*?<string>(.*?)<\/string>/gis;
$versiondata{ $1 } = $2;
}
close(PLIST);
$/ = $oldSeperator;
@theVersionArray = split(/\./, $versiondata{$keyName});
for ($i = 0; $i < 3; $i++) {
if(!$theVersionArray[$i]) {
$theVersionArray[$i] = '0';
}
}
@versionArray = split(/\./, $version);
my $actualVersion;
for ($i = 0; $i < 3; $i++) {
if (($theVersionArray[$i] != $versionArray[$i]) or ($i == 2)) {
$actualVersion = $theVersionArray[$i];
$version = $versionArray[$i];
last;
}
}
my $expression = '$actualVersion ' . $operator . ' $version';
if( eval ($expression) )
{
return 1;
}
else
{
return 0;
}
}
########################################################
sub GetVersion
{
my $path = $_[0];
my $keyName = $_[1];
my $oldSeperator;
my $plistData;
my @items;
my $item;
my $versiondata;
my $i;
my @theVersionArray;
my %versiondata;
my @versionArray;
# if there's no THERE there, we return FALSE
if (! -e $path) {
return 0;
}
$oldSeperator = $/;
$/ = \0;
open( PLIST, "$path");
$plistData = <PLIST>;
$plistData =~ /<dict>(.*?)<\/dict>/gis;
@items = split(/<key>/, $plistData);
shift @items;
foreach $item (@items) {
$item =~ /(.*?)<\/key>.*?<string>(.*?)<\/string>/gis;
$versiondata{ $1 } = $2;
}
close(PLIST);
$/ = $oldSeperator;
return($versiondata{$keyName});
}