Added package removal steps.
This commit is contained in:
parent
367a21eaab
commit
17cbf95a36
115
pkgtool.pm
115
pkgtool.pm
|
@ -195,6 +195,55 @@ my $pkgdef_syntax = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'remove' => {
|
||||||
|
Type => 'list',
|
||||||
|
Elements => {
|
||||||
|
Type => 'struct',
|
||||||
|
Check => \&check_cfg_remove_step,
|
||||||
|
Keywords => {
|
||||||
|
'type' => {
|
||||||
|
Type => 'string',
|
||||||
|
Mandatory => 1
|
||||||
|
},
|
||||||
|
'condition' => {
|
||||||
|
Type => 'string'
|
||||||
|
},
|
||||||
|
'ignore-failure' => {
|
||||||
|
Type => 'integer'
|
||||||
|
},
|
||||||
|
'background' => {
|
||||||
|
Type => 'integer'
|
||||||
|
},
|
||||||
|
'recurse' => {
|
||||||
|
Type => 'integer'
|
||||||
|
},
|
||||||
|
'chdir' => {
|
||||||
|
Type => 'string'
|
||||||
|
},
|
||||||
|
'variable' => {
|
||||||
|
Type => 'string'
|
||||||
|
},
|
||||||
|
'filename' => {
|
||||||
|
Type => 'string'
|
||||||
|
},
|
||||||
|
'expression' => {
|
||||||
|
Type => 'string'
|
||||||
|
},
|
||||||
|
'source-file' => {
|
||||||
|
Type => 'string'
|
||||||
|
},
|
||||||
|
'target-file' => {
|
||||||
|
Type => 'string'
|
||||||
|
},
|
||||||
|
'parameters' => {
|
||||||
|
Type => 'list',
|
||||||
|
Elements => {
|
||||||
|
Type => 'string'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
'remove-parameters' => {
|
'remove-parameters' => {
|
||||||
Type => 'list',
|
Type => 'list',
|
||||||
Elements => {
|
Elements => {
|
||||||
|
@ -1053,6 +1102,72 @@ sub check_cfg_install_step ($$)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub check_cfg_remove_step ($$)
|
||||||
|
{
|
||||||
|
my ($remove, $label) = @_;
|
||||||
|
|
||||||
|
my $type = $$remove{type};
|
||||||
|
|
||||||
|
if ($type eq 'setvar') {
|
||||||
|
if (! defined $$remove{'variable'} || $$remove{'variable'} eq '') {
|
||||||
|
print_log('pkg', ERROR, 'Remove step missing "variable" at %s', $label);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (! defined $$remove{'expression'} && ! defined $$remove{'filename'}) {
|
||||||
|
print_log('pkg', ERROR, 'Remove step missing "expression" or "filename" at %s', $label);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ($type eq 'msi') {
|
||||||
|
if (! defined $$remove{'source-file'} || $$remove{'source-file'} eq '') {
|
||||||
|
print_log('pkg', ERROR, 'Remove step missing "source-file" at %s', $label);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ($type eq 'run') {
|
||||||
|
if (! defined $$remove{'source-file'} || $$remove{'source-file'} eq '') {
|
||||||
|
print_log('pkg', ERROR, 'Remove step missing "source-file" at %s', $label);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ($type eq 'file') {
|
||||||
|
if (! defined $$remove{'source-file'} || $$remove{'source-file'} eq '') {
|
||||||
|
print_log('pkg', ERROR, 'Remove step missing "source-file" at %s', $label);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (! defined $$remove{'target-file'} || $$remove{'target-file'} eq '') {
|
||||||
|
print_log('pkg', ERROR, 'Remove step missing "target-file" at %s', $label);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ($type eq 'delete-file') {
|
||||||
|
if (! defined $$remove{'target-file'} || $$remove{'target-file'} eq '') {
|
||||||
|
print_log('pkg', ERROR, 'Remove step missing "target-file" at %s', $label);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ($type eq 'delete-dir') {
|
||||||
|
if (! defined $$remove{'target-file'} || $$remove{'target-file'} eq '') {
|
||||||
|
print_log('pkg', ERROR, 'Remove step missing "target-file" at %s', $label);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ($type eq 'reg') {
|
||||||
|
if (! defined $$remove{'source-file'} || $$remove{'source-file'} eq '') {
|
||||||
|
print_log('pkg', ERROR, 'Remove step missing "source-file" at %s', $label);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ($type eq 'remove-pkg') {
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print_log('pkg', ERROR, 'Unknown remove step type at %s', $label.': '.$type);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
sub check_cfg_pkg_version_struct ($$)
|
sub check_cfg_pkg_version_struct ($$)
|
||||||
{
|
{
|
||||||
my ($option, $label) = @_;
|
my ($option, $label) = @_;
|
||||||
|
|
Loading…
Reference in a new issue