Commit 35c7873c authored by Thomas Lamprecht's avatar Thomas Lamprecht Committed by Dietmar Maurer

check for ext5 dir to avoid missing directory errors

As we, for now, default to exclude ext5 from our build it's better
to make an check if its directory exists, and only then allow to
load from it. Else we can get errors on proxy startup, and when
someone passes the ext5 parameter.

Also make a indent/whitespace cleanup.
Signed-off-by: 's avatarThomas Lamprecht <t.lamprecht@proxmox.com>
parent 8b59b8d9
......@@ -40,6 +40,8 @@ my %daemon_options = (
my $daemon = __PACKAGE__->new('pveproxy', $cmdline, %daemon_options);
my $ext5_dir_exists;
sub add_dirs {
my ($result_hash, $alias, $subdir) = @_;
......@@ -70,13 +72,19 @@ sub init {
my $family = PVE::Tools::get_host_address_family($self->{nodename});
my $socket = $self->create_reusable_socket(8006, undef, $family);
$ext5_dir_exists = (-d '/usr/share/pve-manager/ext5');
my $dirs = {};
add_dirs($dirs, '/pve2/locale/', '/usr/share/pve-manager/locale/');
add_dirs($dirs, '/pve2/touch/', '/usr/share/pve-manager/touch/');
add_dirs($dirs, '/pve2/ext4/', '/usr/share/pve-manager/ext4/');
if ($ext5_dir_exists) { # only add ext5 dirs if it was build
add_dirs($dirs, '/pve2/ext5/', '/usr/share/pve-manager/ext5/');
add_dirs($dirs, '/pve2/manager5/', '/usr/share/pve-manager/manager5/');
}
add_dirs($dirs, '/pve2/images/' => '/usr/share/pve-manager/images/');
add_dirs($dirs, '/pve2/css/' => '/usr/share/pve-manager/css/');
add_dirs($dirs, '/pve2/js/' => '/usr/share/pve-manager/js/');
......@@ -194,7 +202,7 @@ sub get_index {
$page = PVE::NoVncIndex::get_index($lang, $username, $token, $args->{console});
} elsif ($mobile) {
$page = PVE::TouchIndex::get_index($lang, $username, $token, $args->{console});
} elsif ($ext5) {
} elsif ($ext5 && $ext5_dir_exists) {
$page = PVE::ExtJSIndex5::get_index($lang, $username, $token, $args->{console});
} else {
$page = PVE::ExtJSIndex::get_index($lang, $username, $token, $args->{console});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment