#!/usr/bin/perl
##LICENSE##
use strict;
use warnings;
use Socket;
use File::Basename;
use Data::Dumper;
my $inst = RVGlobalSoftInstaller->new(programName => 'rvglobalsoft', INSTALLTITLE => 'RVGlobalSoft Installer');
#require reqPackage to call another
$inst->{'reqPackage'} = 'rvglobalsoft-upgrade';
#setup reqPackage information
$inst->setInstallPackage("$inst->{'reqPackage'}.ProductName", 'RVGlobalSoft Installer');
$inst->setInstallPackage("$inst->{'reqPackage'}.ProductCode", 'rvglobalsoft-upgrade');
$inst->setInstallPackage("$inst->{'reqPackage'}.SaveFilename", 'rvglobalsoftauto.tar.bz2');
#setup for installer
$inst->setInstallPackage("$inst->{'reqPackage'}.auto.installer", 'autorvglobalsoft');
$inst->setInstallPackage("$inst->{'reqPackage'}.auto.real", 'real_autorvglobalsoft');
$inst->startInstaller();
$inst->exitScript();
package RVGlobalSoftInstaller;
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;
# my @logTarData = ();
# #TODO uncompress solution
# chdir($self->getInstallConfig('sourcePath'));
# my $pid3 = open3(*CMD_IN, *CMD_OUT, *CMD_ERR, $self->{'cmd'}->{'tar'} . ' -jxvf ' . $self->getInstallPackage("$self->{'reqPackage'}.SaveFilename"));
# waitpid($pid3, 0);
# close(CMD_IN);
# my @errs = <CMD_ERR>;
# close(CMD_ERR);
# if (@errs) {
# my $errMsg = join("", @errs);
# $errMsg=~s/\n$//;
# $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("$self->{failedColor}");
# $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Sorry') . ', '.$errMsg, 0, 'subMsg' . $self->{ACTION}, '', '#FF0000');
# $self->{ScreenControl}->DisplayMsg("\e[0m", 1);
# $self->{ScreenControl}->LogMsg('Uncompress the package has been uncompleted, ' . $errMsg . ".\n");
# $self->exitScript();
# } else {
# while (my $pData = <CMD_OUT>) {
# $pData=~s/\r|\n//gi;
# $self->{ScreenControl}->DisplayMsg($pData , '1', 'subMsg' . $self->{ACTION});
# $self->{ScreenControl}->LogMsg($pData . "\n");
# push(@logTarData, $pData);
# }
# close(CMD_OUT);
# }
#
# my $chData = 1;
# my $errorMsg = '';
# foreach my $data ( @logTarData ) {
# if ( $data =~ m/\/$/) {
# if ( !-d $data) {
# $errorMsg = sprintf("%s %s %s", $self->{Language}->TranSlate('the folder'), $data, $self->{Language}->TranSlate('cannot uncompressed'));
# $chData = 0;
# last;
# }
# }
# else {
# if ( !-e $data) {
# $errorMsg = sprintf("%s %s %s", $self->{Language}->TranSlate('the file'), $data, $self->{Language}->TranSlate('cannot uncompressed'));
# $chData = 0;
# last;
# }
# }
# }
#
# chdir($self->getInstallConfig('thisPath'));
# if ( !$chData ) {
# $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("$self->{failedColor}");
# $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Sorry') . ', ' . $errorMsg . '.', 1, 'subMsg' . $self->{ACTION}, '', '#FF0000');
# $self->{ScreenControl}->DisplayMsg("\e[0m", 1);
# $self->{ScreenControl}->LogMsg('Uncompress the package has been uncompleted, ' . $errorMsg . ".\n");
# $self->exitScript();
# }
# else {
# if ( -e $self->getInstallPackage("$self->{'reqPackage'}.SaveFilename")) {
# unlink($self->getInstallPackage("$self->{'reqPackage'}.SaveFilename"));
# }
# if ( -e $self->getInstallPackage("$self->{'reqPackage'}.SaveFilename")) {
# unlink($self->getInstallPackage("$self->{'reqPackage'}.SaveFilename"));
# }
#
# $self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{completedColor}");
# $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Completed') , '', 'subMsg' . $self->{ACTION});
# $self->{ScreenControl}->DisplayMsg("\e[0m ]", 1);
# $self->{ScreenControl}->LogMsg('Uncompress the package has been completed' . "\n");
# }
}
sub Process_SetupInstaller_rsyncFileAfterUncompress {
my $self = shift;
system($self->{'cmd'}->{'rsync'} . ' -avz --timeout=60 ' . $self->getInstallConfig('sourcePath') . '/ ' . $self->getInstallConfig('thisPath'));
return 1;
# my $pid3 = open3(*CMD_IN, *CMD_OUT, *CMD_ERR, $self->{'cmd'}->{'rsync'} . ' -avz --timeout=60 ' . $self->getInstallConfig('sourcePath') . '/ ' . $self->getInstallConfig('thisPath'));
# waitpid($pid3, 0);
# close(CMD_IN);
# my @errs = <CMD_ERR>;
# close(CMD_ERR);
# if (@errs) {
# my $errMsg = join("", @errs);
# $errMsg=~s/\n$//;
# $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("$self->{failedColor}");
# $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Sorry') . ', '.$errMsg, 0, 'subMsg' . $self->{ACTION}, '', '#FF0000');
# $self->{ScreenControl}->DisplayMsg("\e[0m", 1);
# $self->{ScreenControl}->LogMsg("Rsync the package has not completed, $errMsg.\n");
# $self->exitScript();
# } else {
# while (my $rsyncData = <CMD_OUT>) {
# $rsyncData=~s/\r|\n//gi;
# $self->{ScreenControl}->DisplayMsg($rsyncData, 1, 'subMsg' . $self->{ACTION});
# $self->{ScreenControl}->LogMsg($rsyncData . "\n");
# }
# close(CMD_OUT);
# }
}
}
Copyright 2K16 - 2K18 Indonesian Hacker Rulez