Net-FullAuto
view release on metacpan or search on metacpan
lib/Net/FullAuto/ISets/Local/Ampache_is.pm view on Meta::CPAN
print "\n\n EXPECT *** LONG **** DELAY - up to 10 minutes ...\n\n";
($stdout,$stderr)=$handle->cmd(
'opam switch create ocaml-base-compiler',600,'__display__');
$handle->{_cmd_handle}->print('opam install google-drive-ocamlfuse');
$prompt=substr($handle->{_cmd_handle}->prompt(),1,-1);
$prompt=~s/\$$//;
my $n=1;
while ($n==1) {
my $output.=Net::FullAuto::FA_Core::fetch($handle);
last if $output=~/$prompt/;
print $output;
if (-1<index $output,'want to continue') {
$handle->{_cmd_handle}->print('Y');
$output='';
next;
}
}
($stdout,$stderr)=$handle->cmd($sudo.
'mkdir -vp /google-drive','__display__');
($stdout,$stderr)=$handle->cmd($sudo.
'chown -v ec2-user:ec2-user /google-drive','__display__');
my $substitute_email_module='%NL%'.
'#####################################################%NL%'.
'# Inserted by FullAuto to handle Amazon SES passwords%NL%'.
'#####################################################%NL%%NL%'.
'require_once %SQ%Mail.php%SQ%;%NL%'.
'%NL%'.
'$headers = array (%NL%'.
' %SQ%From%SQ% => $from,%NL%'.
' %SQ%To%SQ% => $to,%NL%'.
' %SQ%Subject%SQ% => $subject,%NL%'.
' %SQ%MIME-Version%SQ% => "1.0",%NL%'.
' %SQ%Content-Type%SQ% => "text/html; charset=iso-8859-1"%NL%'.
');%NL%'.
'%NL%'.
'$smtpParams = array (%NL%'.
' %SQ%host%SQ% => $mail->Host,%NL%'.
' %SQ%port%SQ% => $mail->Port,%NL%'.
' %SQ%auth%SQ% => true,%NL%'.
' %SQ%username%SQ% => $mail->Username,%NL%'.
' %SQ%password%SQ% => $mail->Password%NL%'.
');%NL%'.
'%NL%'.
' // Create an SMTP client.%NL%'.
'$mail = Mail::factory(%SQ%smtp%SQ%, $smtpParams);%NL%'.
'%NL%'.
'// Send the email.%NL%'.
'$result = $mail->send($to, $headers, $message);%NL%'.
'%NL%'.
'#if (PEAR::isError($result)) {%NL%'.
'# echo("Email not sent. " .$result->getMessage() ."\\n");%NL%'.
'#} else {%NL%'.
'# echo("Email sent!"."\\n");%NL%'.
'#}%NL%%NL%'.
'####################################################%NL%'.
'# Commented Out by FullAuto so above sends all email%NL%'.
'####################################################%NL%';
($stdout,$stderr)=$handle->cwd('/opt/source');
use LWP::UserAgent;
use HTTP::Request::Common;
use IO::Socket::SSL qw();
my $Browser = LWP::UserAgent->new(
ssl_opts => {
SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
verify_hostname => 0,
}
);
my $starting_ampache=<<'END';
.oPYo. ooooo .oo .oPYo. ooooo o o o .oPYo. o o .oPYo.
8 8 .P 8 8 `8 8 8 8b 8 8 8 8 8 8 8
`Yooo. 8 .P 8 8YooP' 8 8 8`b 8 8 8 8 8YooP'
`8 8 oPooo8 8 `b 8 8 8 `b 8 8 oo 8 8 8
8 8 .P 8 8 8 8 8 8 `b8 8 8 8 8 8
`YooP' 8 .P 8 8 8 8 8 8 `8 `YooP8 `YooP' 8
....................................................................
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
https://ampache.org/
__ __ _____ _____ _ _ ______
/\ | \/ | __ \ /\ / ____| | | | ____|
/ \ | \ / | |__) / \ | | | |__| | |__
/ /\ \ | |\/| | ___/ /\ \| | | __ | __|
/ ____ \| | | | | / ____ \ |____| | | | |____
/_/ \_\_| |_|_| /_/ \_\_____|_| |_|______|
(AMPACHE is **NOT** a sponsor of the FullAuto© Project.)
END
print $starting_ampache;sleep 10;
($stdout,$stderr)=$handle->cmd($sudo.
'chown -Rv www-data:www-data /var/www','__display__');
$region=~s/^.*['](.*)[']$/$1/;
($stdout,$stderr)=$handle->cmd($sudo.'wget -qO- '.
'http://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-connect.html'
);
my @smtp_servers=();my $smtp_server='us-east-1';
foreach my $line (split /\n/,$stdout) {
if (-1<index $line,'email-smtp.') {
$line=~s/^.*(email-smtp\.[^Hh].*?com).*$/$1/;
next unless $line=~/^email-smtp/;
push @smtp_servers,$line;
if (-1<index $line,$region) {
$smtp_server=$line;
last;
}
}
}
($stdout,$stderr)=$handle->cmd($sudo.
'touch /etc/mail/authinfo');
($stdout,$stderr)=$handle->cmd($sudo.
'chmod 666 /etc/mail/authinfo');
my $authinfo=<<END;
AuthInfo:$smtp_server \\x22U:root\\x22 \\x22I:$access_id\\x22 \\x22P:$smtppass\\x22 \\x22M:PLAIN\\x22
END
chop $authinfo;
($stdout,$stderr)=$handle->cmd($sudo.
"echo -e \"$authinfo\" > /etc/mail/authinfo");
($stdout,$stderr)=$handle->cmd($sudo.
'makemap -v hash /etc/mail/authinfo.db < /etc/mail/authinfo',
( run in 1.613 second using v1.01-cache-2.11-cpan-39bf76dae61 )