diff --git a/php/Stack_PKG/apt.php b/php/Stack_PKG/apt.php index fedb2105..93462217 100644 --- a/php/Stack_PKG/apt.php +++ b/php/Stack_PKG/apt.php @@ -1,10 +1,12 @@ stack_os_scope as $value) { + + if ($value == $os_type['DISTRIB_ID']) { + $flag = true; + return $flag; + } + } + + if (!$flag) die("Configuration doesnot match with system status"); + } + + + function install() { - $this->cmd = 'apt-get install '.$this->pkg['package_name'] ; - $this->execute_local(); + + $process = EE_CLI\Process::create( "apt-get install {$this->pkg['package_name']}" ); + $result = $process->run(); + + if ( 0 !== $result->return_code ) { + //logging part here if installation fail + } } private function update(){ - $this->cmd = 'apt-get update '; - $this->execute_local(); + $process = EE_CLI\Process::create( "apt-get update" ); + $result = $process->run(); } diff --git a/php/pkgm/package_manager.php b/php/pkgm/package_manager.php index 701a7d46..def6bfa6 100644 --- a/php/pkgm/package_manager.php +++ b/php/pkgm/package_manager.php @@ -7,6 +7,8 @@ abstract class PKG_MANAGER { + protected $stack_os_scope ; + public function __construct() {}