From da9e5ebc0a3e66d19414ef2355065bb74209d030 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 17 May 2019 16:02:57 +0200 Subject: [PATCH] Use system perl 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. --- clusterd/clusterd | 2 +- kvm_monitor/kvm_monitor.pl | 2 +- make-automaps/make-automaps | 2 +- mkmotd/mkmotd.pl | 2 +- mxgrub/mxgrub | 2 +- mxmirror/mxmirror | 14 +++----------- mxnetctl/mxnetctl | 2 +- mxraid/mxraid_assemble | 2 +- mxrouter/mxrouterctl | 2 +- mxvlan/mxvlanctl | 2 +- netlog/netlog | 2 +- pdist/pdist | 2 +- pkgadmin/pkgadmin | 2 +- pmirror/pmirror | 2 +- put_websafe/put_websafe | 2 +- 15 files changed, 17 insertions(+), 25 deletions(-) diff --git a/clusterd/clusterd b/clusterd/clusterd index 3b81103..96741a8 100755 --- a/clusterd/clusterd +++ b/clusterd/clusterd @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! /usr/local/system/perl/bin/perl use warnings; use strict; diff --git a/kvm_monitor/kvm_monitor.pl b/kvm_monitor/kvm_monitor.pl index 3b96ca3..706279a 100755 --- a/kvm_monitor/kvm_monitor.pl +++ b/kvm_monitor/kvm_monitor.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#! /usr/local/system/perl/bin/perl -w use strict; # use Data::Dumper; $Data::Dumper::Sortkeys=1; diff --git a/make-automaps/make-automaps b/make-automaps/make-automaps index bbdfde9..9c2dacc 100755 --- a/make-automaps/make-automaps +++ b/make-automaps/make-automaps @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! /usr/local/system/perl/bin/perl use strict; use warnings; diff --git a/mkmotd/mkmotd.pl b/mkmotd/mkmotd.pl index fe5f448..36fa351 100755 --- a/mkmotd/mkmotd.pl +++ b/mkmotd/mkmotd.pl @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! /usr/local/system/perl/bin/perl use strict; use warnings; diff --git a/mxgrub/mxgrub b/mxgrub/mxgrub index 0aedd08..b0f81e1 100755 --- a/mxgrub/mxgrub +++ b/mxgrub/mxgrub @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! /usr/local/system/perl/bin/perl use strict; use warnings; use Getopt::Long; diff --git a/mxmirror/mxmirror b/mxmirror/mxmirror index 79a7750..0b4e1f9 100755 --- a/mxmirror/mxmirror +++ b/mxmirror/mxmirror @@ -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; @@ -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 = ; 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; diff --git a/mxnetctl/mxnetctl b/mxnetctl/mxnetctl index c571746..24dbece 100755 --- a/mxnetctl/mxnetctl +++ b/mxnetctl/mxnetctl @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! /usr/local/system/perl/bin/perl use strict; use warnings; diff --git a/mxraid/mxraid_assemble b/mxraid/mxraid_assemble index bd44dc8..798e13e 100755 --- a/mxraid/mxraid_assemble +++ b/mxraid/mxraid_assemble @@ -1,4 +1,4 @@ -#! /usr/bin/perl -w +#! /usr/local/system/perl/bin/perl -w use strict; diff --git a/mxrouter/mxrouterctl b/mxrouter/mxrouterctl index 9ef4b34..a0eb331 100755 --- a/mxrouter/mxrouterctl +++ b/mxrouter/mxrouterctl @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! /usr/local/system/perl/bin/perl use strict; use warnings; diff --git a/mxvlan/mxvlanctl b/mxvlan/mxvlanctl index 0509ee7..8fc99d2 100755 --- a/mxvlan/mxvlanctl +++ b/mxvlan/mxvlanctl @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! /usr/local/system/perl/bin/perl use strict; use warnings; diff --git a/netlog/netlog b/netlog/netlog index 8e6dccf..b61fb07 100755 --- a/netlog/netlog +++ b/netlog/netlog @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! /usr/local/system/perl/bin/perl use warnings; use strict; diff --git a/pdist/pdist b/pdist/pdist index 47a91fe..d988b14 100755 --- a/pdist/pdist +++ b/pdist/pdist @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! /usr/local/system/perl/bin/perl # https://github.molgen.mpg.de/mariux64/mxtools diff --git a/pkgadmin/pkgadmin b/pkgadmin/pkgadmin index 7534a59..051604b 100755 --- a/pkgadmin/pkgadmin +++ b/pkgadmin/pkgadmin @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! /usr/local/system/perl/bin/perl use strict; use warnings; diff --git a/pmirror/pmirror b/pmirror/pmirror index 62bc5b8..b86b9fd 100755 --- a/pmirror/pmirror +++ b/pmirror/pmirror @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! /usr/local/system/perl/bin/perl # https://github.molgen.mpg.de/mariux64/mxtools diff --git a/put_websafe/put_websafe b/put_websafe/put_websafe index 0cbb730..c605236 100755 --- a/put_websafe/put_websafe +++ b/put_websafe/put_websafe @@ -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);