????
Current Path : /scripts/ |
Current File : //scripts/ensurerpm2 |
#!/usr/local/cpanel/3rdparty/bin/perl # cpanel - scripts/ensurerpm2 Copyright 2020 cPanel, L.L.C. # All rights reserved. # copyright@cpanel.net http://cpanel.net # This code is subject to the cPanel license. Unauthorized copying is prohibited use strict; use warnings; use IPC::Open3; use Cpanel::SysPkgs (); use Cpanel::CloseFDs (); $| = 1; ## no critic (Variables::RequireLocalizedPunctuationVars) Cpanel::CloseFDs::fast_closefds(); # Prevent potential zombie under upcp if ( $ENV{'RPMINSTALL'} eq "1" ) { exit(); } my $safe = 0; my $stdin = 0; my $quiet = 0; my $usecache = 0; my $usefile = 0; my $usestdin = 0; while ( $#ARGV != -1 ) { $_ = $ARGV[0]; if (/^\-\-/) { my $arg = shift(@ARGV); $arg =~ s/^\-\-//g; $arg =~ tr/[A-Z]/[a-z]/; if ( $arg eq "safe" ) { $safe = 1; } # not used if ( $arg eq "quiet" ) { $quiet = 1; } # not used if ( $arg eq "usecache" ) { $usecache = 1; } # not used if ( $arg eq "file" ) { $usefile = 1; } if ( $arg eq "stdin" ) { $usestdin = 1; } } else { last; } } if ($usestdin) { while (<STDIN>) { chomp(); my @PKGS = split( /[\s]+/, $_ ); foreach (@PKGS) { next if ( $_ eq '' ); push( @ARGV, $_ ); } } } if ($usefile) { open( ER, "<", "ensurerpm.list" ); while (<ER>) { chomp(); my @PKGS = split( /[\s]+/, $_ ); foreach (@PKGS) { next if ( $_ eq '' ); push( @ARGV, $_ ); } } close(ER); } my $syspkgobj = Cpanel::SysPkgs->new(); if ($syspkgobj) { $syspkgobj->ensure( 'pkglist' => \@ARGV ); } else { print "Could not create SysPkgs object\n"; } if ( grep m/bind/i, @ARGV ) { system '/usr/local/cpanel/scripts/fixrndc'; } exit(0);