| 1 | #!/usr/bin/env perl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use 5.010001; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | our $VERSION = 'v2.3.4'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use FindBin; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use lib "$FindBin::Bin/../lib/perl5"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use Narada; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Narada::Config qw( get_config set_config ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use File::Temp qw( tempfile ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use Cwd qw( cwd ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use Path::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | main(@ARGV) if !caller; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 6 | ▶ | sub err { die "narada-setup-qmail: @_\n" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
err: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | sub main { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 17 | ▶ | die "Usage: narada-setup-qmail [--clean|--lock]\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
main: called CC=12 SCAR=24.9
Branch: 1 branch
Condition100%9/9
@_ > 1 or @_ == 1 and $_[0] ne "--clean" and $_[0] ne "--lock"
@_ == 1 and $_[0] ne "--clean" and $_[0] ne "--lock"
@_ == 1 and $_[0] ne "--clean"
MC/DC75%3/4
@_ > 1 or @_ == 1 and $_[0] ne "--clean" and $_[0] ne "--lock"
@_ > 1
@_ == 1
$_[0] ne "--clean"
$_[0] ne "--lock"
Truth table80%4/5
A or B and C and D
A= @_ > 1B= @_ == 1C= $_[0] ne "--clean"D= $_[0] ne "--lock"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | if (@_ > 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | || (@_ == 1 && $_[0] ne '--clean' && $_[0] ne '--lock'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 13 | ▶ | my $clean = @_ && $_[0] eq '--clean'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
@_ && $_[0] eq '--clean'
MC/DC100%2/2
@_ && $_[0] eq '--clean'
@_
$_[0] eq '--clean'
Truth table100%3/3
A && B
A= @_B= $_[0] eq '--clean'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 13 | ▶ | my $lock = @_ && $_[0] eq '--lock'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
@_ && $_[0] eq '--lock'
MC/DC100%2/2
@_ && $_[0] eq '--lock'
@_
$_[0] eq '--lock'
Truth table100%3/3
A && B
A= @_B= $_[0] eq '--lock'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 13 | ▶ | if ($clean) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 5 | path('var/use/qmail')->remove; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 5 | for my $file (ls_qmail()) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 7 | ▶ | unlink $file or err "unlink($file): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 5 | unlink '.lock.qmail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 8 | ▶ | if (Narada::detect() eq 'narada') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 7 | path('var/use/qmail')->touch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 8 | ▶ | if ($lock) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 4 | lock_qmail(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 4 | setup_qmail(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 13 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | sub lock_qmail { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 4 | ▶ | my $cwd = cwd(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lock_qmail: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 4 | my $lock = "$cwd/.lock.qmail"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 4 | replacefile($lock, '|false'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 4 | my $temp = 'tmp/.qmail.symlink'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 4 | unlink $temp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 4 | for my $qmail (ls_qmail()) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 5 | ▶ | symlink $lock, $temp or err "symlink($lock,$temp): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 5 | ▶ | rename $temp, $qmail or err "rename($temp,$qmail): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | sub setup_qmail { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 4 | ▶ | my $cwd = cwd(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setup_qmail: called CC=14 SCAR=29.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 4 | my $lock = "$cwd/.lock.qmail"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 4 | my $temp = 'tmp/.qmail.symlink'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 4 | unlink $temp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 4 | for my $file (ls('config/qmail')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | # read from config/qmail/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 5 | my $data = get_config("qmail/$file"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 5 | $data =~ s/^[|]/|cd \Q$cwd\E || exit(100); /gmxs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # write to var/qmail/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 5 | my $path = "$cwd/var/qmail/$file"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 5 | replacefile($path, $data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # symlink at ~/.qmail- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 5 | my $qmail = "$ENV{HOME}/.qmail-$file"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 5 | ▶ | if (! -e $qmail) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 4 | ▶ | symlink $path, $qmail or err "symlink($path,$qmail): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ▶ | elsif (-l $qmail && _readlink($qmail) eq $lock) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
-l $qmail and _readlink($qmail) eq $lock
MC/DC0%0/2
-l $qmail and _readlink($qmail) eq $lock
-l $qmail
_readlink($qmail) eq $lock
Truth table33%1/3
A and B
A= -l $qmailB= _readlink($qmail) eq $lock
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | ▶ | symlink $path, $temp or err "symlink($path,$temp): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | ▶ | rename $temp, $qmail or err "rename($temp,$qmail): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | ▶ | elsif (! (-l $qmail && _readlink($qmail) eq $path)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
-l $qmail && _readlink($qmail) eq $path
MC/DC0%0/2
-l $qmail && _readlink($qmail) eq $path
-l $qmail
_readlink($qmail) eq $path
Truth table0%0/3
A && B
A= -l $qmailB= _readlink($qmail) eq $path
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | err "Conflict detected on $qmail"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # cleanup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 4 | for my $file (grep {! -f "config/qmail/$_"} ls('var/qmail')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 5 | ▶ | unlink "var/qmail/$file" or err "unlink(var/qmail/$file): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 4 | unlink $lock; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 4 | for my $file (grep {! -f} ls_qmail()) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 5 | ▶ | unlink $file or err "unlink($file): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | sub ls_qmail { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 26 | ▶ | my $cwd = cwd(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ls_qmail: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | my @files = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 104 | ▶ | grep {-l && _readlink($_) =~ m{\A\Q$cwd\E/}xms} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 104 | map {"$ENV{HOME}/$_"} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 106 | grep { m/\A[.]qmail-/xms } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 26 | ls($ENV{HOME}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 26 | return @files; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | sub replacefile { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 25 | ▶ | my ($file, $data) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replacefile: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 25 | (my $dir = $file) =~ s{/[^/]+\z}{}xms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 25 | my ($fh, $temp) = tempfile(DIR => $dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 23 | print {$fh} $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 23 | ▶ | close $fh or err "close($temp): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 23 | ▶ | rename $temp, $file or err "rename($temp,$file): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 23 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | sub ls { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 46 | ▶ | my ($dir) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ls: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 46 | ▶ | opendir my $d, $dir or err "opendir($dir): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 42 | ▶ | my @files = grep { $_ ne q{.} && $_ ne q{..} } readdir $d; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 42 | ▶ | closedir $d or err "closedir($dir): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 42 | return @files; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | sub _readlink { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 89 | ▶ | my ($link) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_readlink: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 89 | ▶ | my $path = readlink $link or err "readlink($link): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 87 | return $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | 1; # Magic true value required at end of module | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | narada-setup-qmail - install/remove project qmail configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | This document describes narada-setup-qmail version v2.3.4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | =head1 USAGE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | narada-setup-qmail [--clean|--lock] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | Should be executed in project deploy directory (or Narada 1.x project root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | directory). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | Sync Narada project's qmail configuration with user's C<~/.qmail-*> files. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | When executed with C<--clean> option will remove all C<~/.qmail-*> files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | related to this project. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | When executed with C<--lock> option will setup all C<~/.qmail-*> files related | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | to this project to exit with code which means that the delivery failed but | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | should be tried again in a little while (soft error). To undo this effect run | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | again without options or with C<--clean>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | =head1 SYNTAX OF "config/qmail/files" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | Syntax of "config/qmail/files" is same as described in "man dot-qmail", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | but commands in project's qmail configuration will be executed in project's | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | root directory instead of user's home directory. If config file have piped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | command (started with "|") it will be modified to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | "|cd /path/to/project || exit(100); " command will be added on-the-fly before | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | user command, i.e. every command line in "config/qmail/file_with_command" like: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |some_script some_opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | will turn into line in user's dir like: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |cd /path/to/project || exit(100); some_script some_opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | =head1 DIAGNOSTICS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | =item C<< conflict detected on ~/.qmail-NAME >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | This project have config/qmail/NAME, but ~/.qmail-NAME already exists and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | it isn't symlink to this project's var/qmail/NAME file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | You should manually resolve this conflict by either renaming | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | config/qmail/NAME file in this project or removing ~/.qmail-NAME. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | After that you should run narada-setup-qmail again. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | =head1 CONFIGURATION AND ENVIRONMENT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | config/qmail/* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | var/qmail/* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | ~/.qmail-* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | var/use/qmail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | .lock.qmail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | =head2 Bugs / Feature Requests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | Please report any bugs or feature requests through the issue tracker | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | at L<https://github.com/powerman/Narada/issues>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | You will be notified automatically of any progress on your issue. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | =head2 Source Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | This is open source software. The code repository is available for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | public review and contribution under the terms of the license. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | Feel free to fork the repository and submit pull requests. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | L<https://github.com/powerman/Narada> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | git clone https://github.com/powerman/Narada.git | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | =head2 Resources | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | =item * MetaCPAN Search | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | L<https://metacpan.org/search?q=Narada> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | =item * CPAN Ratings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | L<http://cpanratings.perl.org/dist/Narada> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | L<http://annocpan.org/dist/Narada> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | =item * CPAN Testers Matrix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | L<http://matrix.cpantesters.org/?dist=Narada> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | =item * CPANTS: A CPAN Testing Service (Kwalitee) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | L<http://cpants.cpanauthors.org/dist/Narada> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | Alex Efros E<lt>powerman@cpan.orgE<gt> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | Nick Levchenko C<< <nick-lev@ya.ru> >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | This software is Copyright (c) 2008-2016 by Alex Efros E<lt>powerman@cpan.orgE<gt>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | This is free software, licensed under: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | The MIT (X11) License | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||