| 1 | package LedgerSMB::Installer::OS::linux v0.999.15; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use v5.20; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use experimental qw(signatures); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use parent qw(LedgerSMB::Installer::OS::unix); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | use Log::Any qw($log); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 0 | ▶ | sub new($class, %args) { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 12 | 0 | return bless {}, $class; | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub name($self) { | ||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 16 | 0 | return 'linux-generic'; | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | sub dependency_packages_identifier($self) { | ||||||||
|
Subroutine
dependency_packages_identifier: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 20 | 0 | return 'linux-generic'; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | sub pkgs_from_modules($self, $mods) { | ||||||||
|
Subroutine
pkgs_from_modules: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 24 | 0 | warn $log->warning('generic linux support does not include mapping modules to packages'); | |||||||||
| 25 | 0 | return ([], $mods); | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 0 | ▶ | sub pkg_can_install($self) { | ||||||||
|
Subroutine
pkg_can_install: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 29 | 0 | return 0; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 0 | ▶ | sub pkg_install($self, $pkgs) { | ||||||||
|
Subroutine
pkg_install: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 33 | 0 | die $log->fatal('generic linux support does not include package manager support'); | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | sub pkg_uninstall($self, $pkgs) { | ||||||||
|
Subroutine
pkg_uninstall: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 37 | 0 | die $log->fatal('generic linux support does not include package manager support'); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | sub cleanup_env($self, $config, %args) { | ||||||||
|
Subroutine
cleanup_env: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 41 | 0 | warn $log->fatal('generic linux support does not include package manager support'); | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | sub prepare_pkg_resolver_env($self, $config) { | ||||||||
|
Subroutine
prepare_pkg_resolver_env: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 45 | 0 | warn $log->warning('generic linux support does not allow creating module-to-package mapping environment'); | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | sub pkg_deps_latex($self) { | ||||||||
|
Subroutine
pkg_deps_latex: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 49 | 0 | return ([], []); | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 0 | ▶ | sub pkg_deps_xml($self) { | ||||||||
|
Subroutine
pkg_deps_xml: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 53 | 0 | return ([], []); | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub pkg_deps_expat($self) { | ||||||||
|
Subroutine
pkg_deps_expat: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 57 | 0 | return ([], []); | |||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | 0 | ▶ | sub pkg_deps_dbd_pg($self) { | ||||||||
|
Subroutine
pkg_deps_dbd_pg: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 61 | 0 | return ([], []); | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | 0 | ▶ | sub detect_dss($self) { | ||||||||
|
Subroutine
detect_dss: not called CC=13 SCAR=52.0
Pod
undocumented
| |||||||||||
| 65 | 0 | my $dss_class; | |||||||||
| 66 | |||||||||||
| 67 | 0 | ▶ | if (-r '/etc/os-release') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 68 | 0 | ▶ | if (open my $fh, '<', '/etc/os-release') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 69 | 0 | my %params; | |||||||||
| 70 | 0 | ▶ | while (my $line = <$fh>) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 71 | 0 | ▶ | next if $line =~ m/^.*#/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 72 | 0 | ▶ | next if $line =~ m/^\s*$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 73 | |||||||||||
| 74 | 0 | my ($var, $val) = split( /="?/, $line, 2); | |||||||||
| 75 | 0 | $val =~ s/"$//; | |||||||||
| 76 | 0 | chomp $val; | |||||||||
| 77 | 0 | $params{$var} = $val; | |||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | 0 | $self->{distro} = { %params{ qw(ID ID_LIKE VERSION_ID VERSION_CODENAME)} }; | |||||||||
| 81 | 0 | ▶ | close($fh) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 82 | or warn $log->warn( "Unable to close /etc/os-release" ); | ||||||||||
| 83 | |||||||||||
| 84 | 0 | my $dist_id = $self->{distro}->{ID}; | |||||||||
| 85 | 0 | my $dist_like_id; | |||||||||
| 86 | 0 | $dss_class = __PACKAGE__ . '::' . $dist_id; | |||||||||
| 87 | 0 | $log->trace( "Loading distribution support $dss_class" ); | |||||||||
| 88 | 0 | ▶ | if (not eval "require $dss_class") { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 89 | 0 | my $alt_dss_class; | |||||||||
| 90 | 0 | ▶ | if ($self->{distro}->{ID_LIKE}) { # ID_LIKE is optional | ||||||||
|
Branch: 1 branch
| |||||||||||
| 91 | 0 | my @like_dists = split( / +/, $self->{distro}->{ID_LIKE} ); | |||||||||
| 92 | 0 | my @attempts; | |||||||||
| 93 | 0 | for my $like_dist (@like_dists) { | |||||||||
| 94 | 0 | $dist_like_id = $like_dist; | |||||||||
| 95 | 0 | my $alt = __PACKAGE__ . "::$like_dist"; | |||||||||
| 96 | 0 | $log->trace( " Loading alternative distribution support $alt" ); | |||||||||
| 97 | 0 | ▶ | if (eval "require $alt") { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 98 | 0 | $alt_dss_class = $alt; | |||||||||
| 99 | 0 | last; | |||||||||
| 100 | } | ||||||||||
| 101 | 0 | push @attempts, $alt; | |||||||||
| 102 | } | ||||||||||
| 103 | 0 | ▶ | if (not $alt_dss_class) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 104 | 0 | my $distros = join(', ', $self->{distro}->{ID}, @like_dists); | |||||||||
| 105 | 0 | warn $log->warning( 'Unable to load support for any of these linux ' | |||||||||
| 106 | . "distributions: $distros" ); | ||||||||||
| 107 | 0 | warn $log->info( 'Continuing with generic linux support' ); | |||||||||
| 108 | 0 | return $self; | |||||||||
| 109 | } | ||||||||||
| 110 | } | ||||||||||
| 111 | else { | ||||||||||
| 112 | 0 | die 'Unable to load support for linux distribution: ' | |||||||||
| 113 | . "$self->{distro}->{ID}\n"; | ||||||||||
| 114 | } | ||||||||||
| 115 | 0 | $dss_class = $alt_dss_class; | |||||||||
| 116 | } | ||||||||||
| 117 | 0 | ▶ | if ($dist_like_id) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 118 | 0 | $log->info( "Dectected distribution: $dist_like_id (from: $dist_id)" ); | |||||||||
| 119 | } | ||||||||||
| 120 | else { | ||||||||||
| 121 | 0 | $log->info( "Detected distribution: $dist_id" ); | |||||||||
| 122 | } | ||||||||||
| 123 | } | ||||||||||
| 124 | else { | ||||||||||
| 125 | 0 | $log->warn( "Failed to open /etc/os-release: $!" ); | |||||||||
| 126 | 0 | die $log->error( "Failed to identify distribution using /etc/os-release" ); | |||||||||
| 127 | } | ||||||||||
| 128 | } | ||||||||||
| 129 | |||||||||||
| 130 | |||||||||||
| 131 | return $dss_class->new( | ||||||||||
| 132 | distro => $self->{distro}, | ||||||||||
| 133 | 0 | ); | |||||||||
| 134 | } | ||||||||||
| 135 | |||||||||||
| 136 | 0 | ▶ | sub generate_startup($self, $config) { | ||||||||
|
Subroutine
generate_startup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 137 | 0 | $log->warning( "Generation of startup scripts not implemented" ); | |||||||||
| 138 | } | ||||||||||
| 139 | |||||||||||
| 140 | 1 | 1; | |||||||||