diff --git a/pkgtool.pm b/pkgtool.pm index 8ae1842..7509514 100644 --- a/pkgtool.pm +++ b/pkgtool.pm @@ -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);