File: Layers.pm

package info (click to toggle)
libconfig-model-systemd-perl 0.257.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,084 kB
  • sloc: perl: 13,439; makefile: 12
file content (64 lines) | stat: -rw-r--r-- 1,534 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package Config::Model::Backend::Systemd::Layers;

use Mouse::Role;


sub default_directories {
    my $self = shift ;
    my $app = $self->node->instance->application;

    my @layers ;
    if ($app eq 'systemd-user') {
        @layers = (
            # paths documented by systemd-system.conf man page
            '/etc/systemd/user.conf.d/',
            '/run/systemd/user.conf.d/',
            '/usr/lib/systemd/user.conf.d/',
            # path found on Debian
            '/usr/lib/systemd/user/'
        );
    }
    elsif ($app !~ /file$/) {
        @layers = (
            # paths documented by systemd-system.conf man page
            '/etc/systemd/system.conf.d/',
            '/run/systemd/system.conf.d/',
            '/lib/systemd/system.conf.d/',
            # not documented but used to symlink to real files
            '/etc/systemd/system/',
            # path found on Debian
            '/lib/systemd/system/',
        );
    }

    return @layers;
}

1;

# ABSTRACT: Role that provides Systemd default directories

__END__

=pod

=head1 SYNOPSIS

 package Config::Model::Backend::Systemd ;
 extends 'Config::Model::Backend::Any';
 with 'Config::Model::Backend::Systemd::Layers';

=head1 DESCRIPTION

Small role to provide Systemd default directories (user or system) to
L<Config::Model::Backend::Systemd> and L<Config::Model::Backend::Systemd::Unit>.

=head1 Methods

=head2 default_directories

Returns a list of default directory, depending on the application used (either
C<systemd> or C<systemd-user>.

=cut