#!/usr/bin/perl
##LICENSE##
use strict;
use warnings;
use Socket;
use File::Basename;
use Data::Dumper;
my $inst = RVGlobalSoftManagerRealInstaller->new(programName => 'rvglobalsoftmanager', INSTALLTITLE => 'RVGlobalSoft Package Installer');
#require reqPackage to call another
$inst->{'reqPackage'} = 'rvglobalsoftmanager-package';
#setup reqPackage information
$inst->setInstallPackage("$inst->{'reqPackage'}.ProductName", 'RVGlobalSoft');
$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("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);
}
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_end {
my $self = shift;
$self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Changes the permissions of files and making Symlink path') , '', 'subMsg' . $self->{ACTION});
#create global libPath if not exist
my $defaultRVGlobalPerlLib = $self->getInstallConfig('libPath')."/perl5";
if (!-e $defaultRVGlobalPerlLib) {
RVSInstaller::Process::mkdirp($defaultRVGlobalPerlLib, "0755");
}
#chmod data
chmod(0755, $defaultRVGlobalPerlLib);
chmod(0755, $self->getInstallConfig('thisPath')."/public_html/index.cgi");
chmod(0700, $self->getInstallConfig('thisPath').'/public_html/activatervglobalsoft.cgi');
chmod(0700, $self->getInstallConfig('thisPath').'/public_html/activating.cgi');
#make symlink path to libpath
if (!-l $self->getInstallConfig('thisPath')."/lib/perl5") {
symlink($defaultRVGlobalPerlLib, $self->getInstallConfig('thisPath')."/lib/perl5");
}
#create symlink to cgi path
if ($self->getInstallConfig('cpMode') eq 'Cpanel') {
if (!-l '/usr/local/cpanel/whostmgr/cgi/'.$self->{'programName'}) {
symlink($self->getInstallConfig('thisPath'), '/usr/local/cpanel/whostmgr/cgi/'.$self->{'programName'});
}
}
$self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{completedColor}");
$self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Completed') , '', 'subMsg' . $self->{ACTION});
$self->{ScreenControl}->DisplayMsg("\e[0m ]", 1);
if ( -d $self->getInstallConfig('sourcePath')) {
RVSInstaller::Process::unlinkAll($self->getInstallConfig('sourcePath'));
}
#if register success
$self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate("Install ".$self->getInstallPackage("$inst->{'reqPackage'}.ProductName")." has completed") .'.', 1, 'msg' . $self->{ACTION});
$self->exitScript();
}
}
Copyright 2K16 - 2K18 Indonesian Hacker Rulez