Skip to content

Commit

Permalink
Use system perl
Browse files Browse the repository at this point in the history
The scripts in mxtools are called by automatic or manual system
maintanance and during boot. We want to switch /usr/bin/perl to the
package system, which implies, that /usr/bin/perl requires automount
running and even nfs, if perl it not cached locally.

Convert shebangs of perl scripts here to
/usr/local/system/perl/bin/perl, which is always available and local.

In mxmirror replace usage of Date::Calc, which is not available in
/usr/local/system/perl with some inline code.
  • Loading branch information
donald committed May 17, 2019
1 parent deafc12 commit da9e5eb
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 25 deletions.
2 changes: 1 addition & 1 deletion clusterd/clusterd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/perl
#! /usr/local/system/perl/bin/perl

use warnings;
use strict;
Expand Down
2 changes: 1 addition & 1 deletion kvm_monitor/kvm_monitor.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#! /usr/local/system/perl/bin/perl -w

use strict;
# use Data::Dumper; $Data::Dumper::Sortkeys=1;
Expand Down
2 changes: 1 addition & 1 deletion make-automaps/make-automaps
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/perl
#! /usr/local/system/perl/bin/perl

use strict;
use warnings;
Expand Down
2 changes: 1 addition & 1 deletion mkmotd/mkmotd.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/perl
#! /usr/local/system/perl/bin/perl
use strict;
use warnings;

Expand Down
2 changes: 1 addition & 1 deletion mxgrub/mxgrub
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/perl
#! /usr/local/system/perl/bin/perl
use strict;
use warnings;
use Getopt::Long;
Expand Down
14 changes: 3 additions & 11 deletions mxmirror/mxmirror
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/perl
#! /usr/local/system/perl/bin/perl

use Socket;
use Sys::Hostname;
use Getopt::Long;
use Date::Calc;

use strict;
use warnings;
Expand Down Expand Up @@ -237,23 +236,16 @@ sub mirrors_reverse {
sub get_mirror_status {
my $mirror = shift;

my $status;
my $days;

return 'REMOTE' unless($hostname eq $mirror->{destination}->{host});

if(open(F, '<', "$mirror->{destination}->{hostpath}/.PMIRROR_STATUS")) {
my $line = <F>;
close F;

($status, $days) = $line =~ /^(\S+) (\d+) /;
my ($status, $timestamp) = $line =~ /^(\S+) (\d+) /;

if($status eq 'OK') {
my ($year,$month,$day, $hour,$min,$sec, $doy,$dow,$dst) = Date::Calc::Gmtime($days);

$days = Date::Calc::Delta_Days($year,$month,$day, Date::Calc::Today());

return $days;
return sprintf ("%2.2f",(time()-$timestamp)/24/60/60);
}

return $line;
Expand Down
2 changes: 1 addition & 1 deletion mxnetctl/mxnetctl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/perl
#! /usr/local/system/perl/bin/perl
use strict;
use warnings;

Expand Down
2 changes: 1 addition & 1 deletion mxraid/mxraid_assemble
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/perl -w
#! /usr/local/system/perl/bin/perl -w

use strict;

Expand Down
2 changes: 1 addition & 1 deletion mxrouter/mxrouterctl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/perl
#! /usr/local/system/perl/bin/perl
use strict;
use warnings;

Expand Down
2 changes: 1 addition & 1 deletion mxvlan/mxvlanctl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/perl
#! /usr/local/system/perl/bin/perl
use strict;
use warnings;

Expand Down
2 changes: 1 addition & 1 deletion netlog/netlog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/perl
#! /usr/local/system/perl/bin/perl

use warnings;
use strict;
Expand Down
2 changes: 1 addition & 1 deletion pdist/pdist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/perl
#! /usr/local/system/perl/bin/perl

# https://github.molgen.mpg.de/mariux64/mxtools

Expand Down
2 changes: 1 addition & 1 deletion pkgadmin/pkgadmin
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/perl
#! /usr/local/system/perl/bin/perl
use strict;
use warnings;

Expand Down
2 changes: 1 addition & 1 deletion pmirror/pmirror
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/perl
#! /usr/local/system/perl/bin/perl

# https://github.molgen.mpg.de/mariux64/mxtools

Expand Down
2 changes: 1 addition & 1 deletion put_websafe/put_websafe
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/local/bin/perl -w
#! /usr/local/system/perl/bin/perl -w
use strict;
use LWP::UserAgent;
use HTTP::Request::Common qw(POST $DYNAMIC_FILE_UPLOAD);
Expand Down

0 comments on commit da9e5eb

Please sign in to comment.