| 29 |
|
|
| 30 |
# main part |
# main part |
| 31 |
$| = 1; |
$| = 1; |
| 32 |
@aptcommands = qw/install remove dselect-upgrade/; |
# order of commands to execute |
| 33 |
%options = ( |
@commands = qw/taskinst install remove dselect-upgrade/; |
| 34 |
install => '-y --fix-missing', |
%command = ( |
| 35 |
remove => '-y --purge', |
install => 'apt-get -y --fix-missing install', |
| 36 |
"dselect-upgrade" => '-y', |
remove => 'apt-get -y --purge remove', |
| 37 |
|
"dselect-upgrade" => 'apt-get -y dselect-upgrade', |
| 38 |
|
"taskinst" => 'tasksel -n install', |
| 39 |
); |
); |
| 40 |
|
|
| 41 |
# currently no test, always execute |
# currently no test, always execute |
| 43 |
|
|
| 44 |
$verbose=$ENV{verbose}; |
$verbose=$ENV{verbose}; |
| 45 |
$FAI_ROOT = $ENV{FAI_ROOT}; |
$FAI_ROOT = $ENV{FAI_ROOT}; |
|
$rootcmd = ($FAI_ROOT eq "/" ) ? '' : "chroot $FAI_ROOT"; |
|
|
|
|
| 46 |
$classpath = "/fai/package_config"; |
$classpath = "/fai/package_config"; |
| 47 |
|
$rootcmd = ($FAI_ROOT eq "/" ) ? '' : "chroot $FAI_ROOT"; |
| 48 |
@classes = grep { !/^#|^\s*$/} split(/[\s\n]+/,$ENV{classes}); |
@classes = grep { !/^#|^\s*$/} split(/[\s\n]+/,$ENV{classes}); |
| 49 |
|
|
| 50 |
# read all package config files |
# read all package config files |
| 59 |
execute("wget -nv -P$FAI_ROOT/$directory $url"); |
execute("wget -nv -P$FAI_ROOT/$directory $url"); |
| 60 |
} |
} |
| 61 |
|
|
| 62 |
# call apt-get for each command and the list of packages |
# call apt-get or tasksel for each type of command whith the list of packages |
| 63 |
foreach $type (@aptcommands) { |
foreach $type (@commands) { |
| 64 |
if ($type eq "dselect-upgrade") { |
if ($type eq "dselect-upgrade") { |
| 65 |
dselectupgrade(); |
dselectupgrade(); |
| 66 |
next; |
next; |
| 67 |
} |
} |
| 68 |
|
|
| 69 |
my $packlist = join(' ',@{$list{$type}}); |
my $packlist = join(' ',@{$list{$type}}); |
|
|
|
| 70 |
if ($packlist) { |
if ($packlist) { |
| 71 |
execute("$rootcmd apt-get $options{$type} $type $packlist"); |
execute("$rootcmd $command{$type} $packlist"); |
| 72 |
} |
} |
| 73 |
} |
} |
| 74 |
|
|
| 136 |
close TMP; |
close TMP; |
| 137 |
|
|
| 138 |
execute("$rootcmd dpkg --set-selections < $tempfile"); |
execute("$rootcmd dpkg --set-selections < $tempfile"); |
| 139 |
execute("$rootcmd apt-get $options{$type} dselect-upgrade"); |
execute("$rootcmd $command{$type}"); |
| 140 |
unlink $tempfile; |
unlink $tempfile; |
| 141 |
} |
} |