Move related files into subdirs

This commit is contained in:
Tracey Clark 2022-03-27 21:12:36 -05:00
commit f543afed65
8 changed files with 99 additions and 0 deletions

View file

@ -0,0 +1,21 @@
# Script for upgrading Nextcloud or insalling missing modules
perl
```perl
# pseudocode
# example mod name php8.0-zip
my $php_ver = shift; # format php8.0
for my $module (@modules)
my $full_mod_name = $php_ver . "-" . $module
push @install_list ($full_mod_name)
my $install_cmd = "apt install " . @install_list # will this put commas in?
system $install_cmd
system 'apachectl restart'
```
```bash
apt install php8.0-mbstring php8.0-curl
```

View file

@ -0,0 +1,54 @@
#!/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