Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
29880382
Commit
29880382
authored
Jan 18, 2012
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new pvemailforward helper
And automatically install a .forward file.
parent
96338cef
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
2 deletions
+52
-2
Makefile
bin/Makefile
+2
-1
pvemailforward
bin/pvemailforward
+40
-0
postinst
debian/postinst
+10
-1
No files found.
bin/Makefile
View file @
29880382
...
...
@@ -42,10 +42,11 @@ vzrestore.1.pod: vzrestore
perl
-I
.. ./vzrestore printmanpod
>
$@
.PHONY
:
install
install
:
${SCRIPTS} ${MANS}
install
:
${SCRIPTS} ${MANS}
pvemailforward
perl
-I
.. ./pvesh verifyapi
install
-d
${
BINDIR
}
install
-m
0755
${
SCRIPTS
}
${
BINDIR
}
install
-m
2755
-g
www-data pvemailforward
${
BINDIR
}
install
-d
${
MAN1DIR
}
install
-m
0644
${
MANS
}
${
MAN1DIR
}
install
-d
${
PODDIR
}
...
...
bin/pvemailforward
0 → 100755
View file @
29880382
#!/usr/bin/perl -w -T
use
strict
;
use
warnings
;
use
PVE::
Tools
;
use
PVE::
SafeSyslog
;
use
PVE::
AccessControl
;
# NOTE: we need to run this with setgid www-data
# else we cant read /etc/pve/user.cfg
$ENV
{'
PATH
'}
=
'
/sbin:/bin:/usr/sbin:/usr/bin
';
initlog
('
pvemailforward
');
eval
{
# note: that fails because we run with wrong uid (nobody)
#my $usercfg = cfs_read_file("user.cfg");
my
$filename
=
"
/etc/pve/user.cfg
";
my
$raw
=
PVE::Tools::
file_get_contents
(
$filename
);
my
$usercfg
=
PVE::AccessControl::
parse_user_config
(
$filename
,
$raw
);
my
$rootcfg
=
$usercfg
->
{
users
}
->
{'
root@pam
'}
||
{};
my
$mailto
=
$rootcfg
->
{
email
};
die
"
user 'root
\
@pam
' does not have a email address
\n
"
if
!
$mailto
;
syslog
("
info
",
"
forward mail to <
$mailto
>
");
# we never send DSN (avoid mail loops)
open
(
CMD
,
"
|sendmail -bm -N never
$mailto
")
||
die
"
can't exec sendmail - $!
\n
";
while
(
<>
)
{
print
CMD
$_
;
}
close
(
CMD
);
};
if
(
my
$err
=
$@
)
{
syslog
('
err
',
"
mail forward failed:
$err
");
}
exit
(
0
);
debian/postinst
View file @
29880382
...
...
@@ -39,6 +39,15 @@ case "$1" in
test
-e
/var/lib/pve-manager/apl-available
||
cp
/usr/share/doc/pve-manager/aplinfo.dat /var/lib/pve-manager/apl-available
if
test
-f
/root/.forward
;
then
if
!
grep
-q
'|/usr/bin/pvemailforward'
/root/.forward
;
then
echo
"|/usr/bin/pvemailforward
\n
$(
cat
/root/.forward
)
"
>
/root/.forward.tmp
mv
/root/.forward.tmp /root/.forward
fi
else
echo
'|/usr/bin/pvemailforward'
>
/root/.forward
fi
update-rc.d pvedaemon defaults 21 79
>
/dev/null
update-rc.d pvestatd defaults 21 79
>
/dev/null
update-rc.d pvebanner start 99 2 3 4 5
>
/dev/null
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment