54 lines
1.2 KiB
Perl
54 lines
1.2 KiB
Perl
|
|
#!/bin/env perl
|
||
|
|
# ABSTRACT: Make sure all modules required by Nextcloud are installed for a PHP versoin
|
||
|
|
# PODNAME: install_nextcloud_php_mods
|
||
|
|
|
||
|
|
use strict;
|
||
|
|
use utf8;
|
||
|
|
use warnings qw( all );
|
||
|
|
use Modern::Perl;
|
||
|
|
use File::Basename;
|
||
|
|
|
||
|
|
use FindBin;
|
||
|
|
use Cwd qw/realpath/;
|
||
|
|
use lib "$FindBin::Bin/../lib";
|
||
|
|
|
||
|
|
use Getopt::Long;
|
||
|
|
use Pod::Usage;
|
||
|
|
|
||
|
|
# VERSION 0.1
|
||
|
|
|
||
|
|
=head1 SYNOPSIS
|
||
|
|
|
||
|
|
install_nextcloud_php_mods.pl phpversion
|
||
|
|
|
||
|
|
=head1 DESCRIPTION
|
||
|
|
|
||
|
|
Attempts to install a list of modules needed by Nextcloud for the given PHP version. PHP version is in the form of php8.0
|
||
|
|
|
||
|
|
=cut
|
||
|
|
|
||
|
|
GetOptions(
|
||
|
|
q(help) => \my $help,
|
||
|
|
q(verbose) => \my $verbose,
|
||
|
|
) or pod2usage(q(-verbose) => 1);
|
||
|
|
pod2usage(q(-verbose) => 1) if $help;
|
||
|
|
|
||
|
|
die "PHP versoin required\nUsage: $0 filename(s) \n" unless ( @ARGV );
|
||
|
|
# \N is null
|
||
|
|
my $php_version = @ARGV;
|
||
|
|
|
||
|
|
# Standard defense against hung script
|
||
|
|
my ($timeout, $size, $buffer) = (5, 0, undef);
|
||
|
|
my $nread = undef;
|
||
|
|
eval {
|
||
|
|
local $SIG{ALRM} = sub { die "alarm\n" }; #\n required
|
||
|
|
alarm $timeout;
|
||
|
|
$nread = sysread STDIN, $buffer, $size;
|
||
|
|
alarm 0;
|
||
|
|
};
|
||
|
|
if ($@) {
|
||
|
|
print "Script timed out, check the command\n";
|
||
|
|
die "Script timed out" unless $@ eq "alarm\n"; # propagate unexpected errors
|
||
|
|
}
|
||
|
|
|
||
|
|
# Script goes here
|