Neil Bothwick <n...@digimed.co.uk> writes: > On Tue, 27 Dec 2016 20:21:19 +0100, lee wrote: > >> > Even more reasonable: >> > >> > eselect news read new >> > >> > will only come up with the latest as yet unread news, rather than a >> > long list which could have accumulated over the years. >> >> It seems to be clearing out the list automatically. >> >> [1] says the mailer module of eselect was removed. Is there a better >> way to read them than with eselect? > > Put this script in /etc/portage/postsync.d and make it executable > > #!/bin/sh > > if [ $( eselect news count new ) != "0" ]; then > eselect news list | mail y...@wherever.you.are > fi
Thanks! To actually read the news as email, I wrote this:
#!/usr/bin/perl # # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # # You may need to emerge dev-perl/Email-MIME and dev-perl/Email-Sender # for this to work. # use strict; use warnings; use Email::MIME; use Email::Sender::Simple qw(sendmail); #################### configure this ######################## my @rcpt = ('l...@yagibdah.de'); my $from = 'r...@yagibdah.de'; my $subj = 'eselect news'; # # you can set this to 0 to get an email for every news item # my $msglen = 65536; # # set to 1 to get only items listed as new # my $only_new = 1; #################### / configure this ####################### my @list = qx/eselect news list/; my @numbers = $only_new ? map(m/\A\s*\[(\d+)\]\s*N\s*\d/, @list) : map(m/\A\s*\[(\d+)\]/, @list); my $content = join('', @list) . "\n" . ('#' x 70) . "\n\n"; undef @list; foreach (@numbers) { my $do = "eselect news read $_"; $content .= qx/$do/; $content .= "\n" . ('#' x 70) . "\n\n"; if (length($content) > $msglen) { my $message = Email::MIME->create( header_str => [ From => $from, To => @rcpt, Subject => $subj ], attributes => { encoding => 'quoted-printable', charset => 'UTF-8' }, body_str => $content ); sendmail($message); $content = ''; } } if (length($content)) { my $message = Email::MIME->create( header_str => [ From => $from, To => @rcpt, Subject => $subj ], attributes => { encoding => 'quoted-printable', charset => 'UTF-8' }, body_str => $content ); sendmail($message); } exit 0;