CHips L MINI SHELL

CHips L pro

Current Path : /proc/self/root/proc/2/root/usr/local/rvglobalsoft/rvmanager/auto/
Upload File :
Current File : //proc/self/root/proc/2/root/usr/local/rvglobalsoft/rvmanager/auto/real_autorvglobalsoftmanager.cgi

#!/usr/bin/perl
##LICENSE##

use strict;
use warnings;
use Socket;
use File::Basename;
use Data::Dumper;


my $inst = RVGSManagerRealInstaller->new(programName => 'rvglobalsoftmanager', INSTALLTITLE => 'RVGlobalSoft Manager Package Installer');

#require reqPackage to call another
$inst->{'reqPackage'} = 'rvglobalsoftmanager-package';

#setup reqPackage information
$inst->setInstallPackage("$inst->{'reqPackage'}.ProductName", 'RVGlobalSoft Manager');
$inst->setInstallPackage("$inst->{'reqPackage'}.ProductCode", 'rvglobalsoftmanager-package');
$inst->setInstallPackage("$inst->{'reqPackage'}.SaveFilename", 'rvglobalsoftmanager.tar.bz2');

#setup for installer
$inst->setInstallPackage("$inst->{'reqPackage'}.auto.installer", 'autorvglobalsoftmanager');
$inst->setInstallPackage("$inst->{'reqPackage'}.auto.real", 'real_autorvglobalsoftmanager');

#$inst->setFunctionConfig("installRVGlobalSoftManagerUI.next", 'DownloadInstaller');
#$inst->setFunctionConfig("installRVGlobalSoftManagerUI.group", 'UpdateInstaller');
#$inst->setFunctionConfig("DownloadInstaller.next", 'end');
#$inst->setFunctionConfig("DownloadInstaller.group", 'UpdateInstaller');

#$inst->setFunctionConfig("SetupInstaller.next", 'ConfigAndSetupRVGlobalSoftManager');
#$inst->setFunctionConfig("ConfigAndSetupRVGlobalSoftManager.next", 'end');
#$inst->setFunctionConfig("ConfigAndSetupRVGlobalSoftManager.group", 'UpdateInstaller');

$inst->startInstaller();
$inst->exitScript();
























package RVGSManagerRealInstaller;
use strict;
use warnings;
use File::Basename;
use Data::Dumper;
use IPC::Open3;
BEGIN {
    push(@INC, dirname(__FILE__));
}
use base qw(RVSInstaller);
{
    sub new {
        my $class = shift;
        my $self = $class->SUPER::new( @_ );
        
        bless $self, $class;
        return $self;
    }
    
    sub Process_SetupInstaller_uncompressFile {
        my $self = shift;
        
        system($self->{'cmd'}->{'tar'} . ' -jxvf ' . $self->getInstallPackage("$self->{'reqPackage'}.SaveFilename")) if(-f $self->getInstallPackage("$self->{'reqPackage'}.SaveFilename"));
    	return 1;
    }
    
    sub Process_SetupInstaller_rsyncFileAfterUncompress {
        my $self = shift;
        
        #avoid rsync to sync zip package
        my $packageFile = sprintf("%s/%s", $self->getInstallConfig('sourcePath'), $self->getInstallPackage("$self->{'reqPackage'}.SaveFilename"));
        if (-f $packageFile) {
            unlink($packageFile);
        }
        
        #chmod data
        chmod(0755, $self->getInstallConfig('sourcePath')."/index.cgi") if(-e  $self->getInstallConfig('sourcePath')."/index.cgi");
        
        system($self->{'cmd'}->{'rsync'} . ' -avz --timeout=60 ' . $self->getInstallConfig('sourcePath') . '/ ' . $self->getInstallConfig('thisPath'));
        return 1;
    }
    
    sub Process_installRVGlobalSoftManagerUI {
        my $self = shift;
        my $param = shift;
        my %hParam = %{$param};
        #just for naming package no process in this part
        
        $self->callNextFunc(\%hParam);
    }
    
	sub Process_ConfigAndSetupRVGlobalSoftManager {
        my $self = shift;
        my $param = shift;
        my %hParam = %{$param};
        #just for naming package no process in this part
        
        #Register AppConfig for cPanel 11.38++
	    if(-e '/usr/local/cpanel/cpkeyclt'){
	        $self->registerAppConfig();
	    }
        
        $self->callNextFunc(\%hParam);
	}
    
    sub Process_end {
        my $self = shift;

        $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Setup plugins for RVGlobalSoft Manager and make it available') , '', 'subMsg' . $self->{ACTION});
        
        #copy icon link to cgi path
        if (-e $self->getInstallConfig('thisPath')."/auto/appconfig/rvgicon.png"
            && -d '/usr/local/cpanel/whostmgr/docroot/addon_plugins'
            && !-l '/usr/local/cpanel/whostmgr/docroot/addon_plugins/rvgicon.png' ) {
            	
            system('ln -s '.$self->getInstallConfig('thisPath').'/auto/appconfig/rvgicon.png /usr/local/cpanel/whostmgr/docroot/addon_plugins/ > /dev/null 2>&1');
        }
        
        
        #chmod data
        chmod(0755, $self->getInstallConfig('thisPath')."/index.cgi") if(-e  $self->getInstallConfig('thisPath')."/index.cgi");
        chmod(0755, $self->getInstallConfig('thisPath')."/panelmenu/cpanel/whm/addon_rvglobalsoftmanager.cgi") if(-e  $self->getInstallConfig('thisPath')."/panelmenu/cpanel/whm/addon_rvglobalsoftmanager.cgi");
        
        my $symlinkPath = '/usr/local/cpanel/whostmgr/docroot/cgi/'.$self->{'programName'};
        #create symlink to cgi path
        if ($self->getInstallConfig('cpMode') eq 'Cpanel') {
            if (!-l $symlinkPath) {
                symlink($self->getInstallConfig('thisPath').'/', $symlinkPath);
            }
        }
        
        #add RVGlobalSoft Manager plugin to whm
        my $targetPlugin = '/usr/local/cpanel/whostmgr/docroot/cgi/addon_rvglobalsoftmanager.cgi';
        if ($self->getInstallConfig('cpMode') eq 'Cpanel') {
            if(-e '/usr/local/rvglobalsoft/rvglobalsoftmanager/panelmenu/cpanel/whm/addon_rvglobalsoftmanager.cgi'){
            	
                system ('"' .$self->{'cmd'}->{'cp'} . '" -af /usr/local/rvglobalsoft/rvglobalsoftmanager/panelmenu/cpanel/whm/addon_rvglobalsoftmanager.cgi ' . $targetPlugin );
            }
            chmod(0755, $targetPlugin);
        }
        
        if ( -d $self->getInstallConfig('sourcePath')) {
            RVSInstaller::Process::unlinkAll($self->getInstallConfig('sourcePath'));
        }
        
        #Remove rvmanager
        my $rvmanagerOld = '/usr/local/rvglobalsoft/rvmanager';
        RVSInstaller::Process::unlinkAll($self->getInstallConfig('sourcePath')) if(-d $rvmanagerOld);
        symlink('/usr/local/rvglobalsoft/rvglobalsoftmanager', $rvmanagerOld) if(!-e $rvmanagerOld);
        symlink('/usr/local/rvglobalsoft/rvglobalsoftmanager/rvglobalsoftmanagerversion.txt', $rvmanagerOld . '/rvmanagerversion.txt') if(!-e $rvmanagerOld . '/rvmanagerversion');
        RVSInstaller::Process::unlinkAll('/usr/local/cpanel/whostmgr/docroot/cgi/addon_rvmanager.cgi') if(-e '/usr/local/cpanel/whostmgr/docroot/cgi/addon_rvmanager.cgi');
        
        #install rvglobalsoft api
		if(!-f '/usr/local/rvglobalsoft/rvglobalsoft/var/INSTALL_COMPLETE'){
			system('cd /usr/src; rm -fv rvglobalsoftapiinstall.sh; wget --no-check-certificate https://download.rvglobalsoft.com/rvglobalsoftapiinstall.sh; chmod +x rvglobalsoftapiinstall.sh; ./rvglobalsoftapiinstall.sh');	
		}
        
        #if register success
        if (-l $symlinkPath && -x $targetPlugin) {
            $self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{completedColor}");
            $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Completed') , '', 'subMsg' . $self->{ACTION});
            $self->{ScreenControl}->DisplayMsg("\e[0m ]", 1);
            $self->{ScreenControl}->DisplayMsg('', 1);
            $self->{ScreenControl}->DisplayMsg("Install ".$self->getInstallPackage("$inst->{'reqPackage'}.ProductName")." has completed.", 1, 'msg' . $self->{ACTION});
        } else {
            $self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{failedColor}");
            $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Failed'));
            $self->{ScreenControl}->DisplayMsg("\e[0m ]", 1);
            $self->{ScreenControl}->DisplayMsg('', 1);
            $self->{ScreenControl}->DisplayMsg("Install ".$self->getInstallPackage("$inst->{'reqPackage'}.ProductName")." has error.", 1, 'msg' . $self->{ACTION});
        }
        
        $self->exitScript();
    }
}

Copyright 2K16 - 2K18 Indonesian Hacker Rulez