Implemented .cab format patches.

This commit is contained in:
László Valkó 2018-01-05 18:49:57 +01:00
parent ff05673dcf
commit 83b984a4ea

View file

@ -935,6 +935,8 @@ sub check_cfg_patchdef ($$)
}
elsif ($style eq 'msp') {
}
elsif ($style eq 'cab') {
}
else {
print_log('pkg', ERROR, 'Unknown patch style at %s', $label.': '.$style);
return 0;
@ -2391,7 +2393,7 @@ sub install_patch ($$$$$$$)
$$vars{patchsuffix} = defined $$patchdef{suffix} ? $$patchdef{suffix} : '';
my $style = $$patchdef{style};
$$vars{patchext} = $style eq 'exe' ? '.exe' : $style eq 'msu' ? '.msu' : $style eq 'msp' ? '.msp' : '';
$$vars{patchext} = $style eq 'exe' ? '.exe' : $style eq 'msu' ? '.msu' : $style eq 'msp' ? '.msp' : $style eq 'cab' ? '.cab' : '';
my $sourcespec = $$patchdef{'source-file'};
$sourcespec = '%patchprefix%%patchkbname%%patchnum%%patchextra%%patchedition%%patcharch%%patchsuffix%%patchext%' unless defined $sourcespec;
@ -2435,6 +2437,18 @@ sub install_patch ($$$$$$$)
$exitcode = -1;
}
}
elsif ($style eq 'cab') {
my $exename = substitute_variables($vars, '%systemroot%/System32/dism.exe', 1, undef, 'pkg');
my $paramlist = ['/online', '/add-package', '/packagepath:'.$sourcefile];
push @$paramlist, @{$$patchdef{parameters}} if defined $$patchdef{parameters};
if (-f $sourcefile) {
($error, $exitcode) = run_exe('pkg', $db, $vars, undef, $exename, $paramlist, 0);
}
else {
$error = sprintf('Cannot find CAB file %s: %s', $sourcefile, $!);
$exitcode = -1;
}
}
if (defined $error) {
if (defined $exitcode && $exitcode == 194) {
print_log('pkg', INFO, 'Ignoring patch %s installation exit code: %s', $kb, $exitcode);