]>
git.proxmox.com Git - pve-installer.git/blob - Proxmox/Install/Env.pm
9ec0c3aed4e1218f12bbd4a5a01f324064f97b8a
1 package Proxmox
::Install
::Env
;
9 our @EXPORT = qw(is_test_mode);
13 fullname
=> 'Proxmox VE',
19 fullname
=> 'Proxmox Mail Gateway',
25 fullname
=> 'Proxmox Backup Server',
33 my $info_fn = '/.cd-info'; # default place in the ISO environment
34 if (!-f
$info_fn && -f
"cd-info.test") {
35 $info_fn = "cd-info.test"; # use from CWD for test mode
38 open(my $fh, '<', $info_fn) or die "Could not open CD info file '$info_fn' $!";
41 while (my $line = <$fh>) {
43 if ($line =~ /^(\S+)=['"]?(.+?)['"]?$/) { # we control cd-info content, so good enough.
44 $cd_info->{lc($1)} = $2;
49 die "CD-info is missing required key 'product'!\n" if !defined $cd_info->{product
};
54 my sub get_locations
{
55 my $is_test = is_test_mode
();
57 my $base_lib_dir = '/var/lib/proxmox-installer';
58 my $iso_dir = $is_test ?
$ENV{'CD_BUILDER_DIR'} || "../pve-cd-builder/tmp/data-gz/" : "/cdrom";
62 lib
=> $is_test ? Cwd
::cwd
() . "/testdir/${base_lib_dir}" : $base_lib_dir,
63 pkg
=> "${iso_dir}/proxmox/packages/",
68 my $cd_info = get_cd_info
();
69 my $product = $cd_info->{product
};
71 my $cfg = $product_cfg->{$product} or die "unknown product '$product'\n";
72 $cfg->{product
} = $product;
74 my $locations = get_locations
();
80 locations
=> $locations,
87 # sets a test image to use as disk and enables the testmode
89 my ($new_test_image) = @_;
90 croak
"cannot disable test mode again after enabled" if defined($test_images) && !defined($new_test_image);
91 $test_images = $new_test_image;
94 return !!$test_images;
97 return [ split(/,/, $test_images) ];