CHips L MINI SHELL

CHips L pro

Current Path : /scripts/
Upload File :
Current File : //scripts/ensurerpm2

#!/usr/local/cpanel/3rdparty/bin/perl
# cpanel - ensurerpm2                              Copyright 2011 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::Sys::GetOS ();
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 $os = Cpanel::Sys::GetOS::getos();

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);

Copyright 2K16 - 2K18 Indonesian Hacker Rulez