diff --git a/php/Stack/apt.php b/php/Stack/apt.php index fc4f72ea..e8f8bc95 100644 --- a/php/Stack/apt.php +++ b/php/Stack/apt.php @@ -12,29 +12,13 @@ class APT extends PKG_MANAGER { function __construct($data=array()) { + parent::__construct($this->stack_os_scope); $this->pkg = $data; - print_r($this->pkg); //debugging purpose only + //print_r($this->pkg); //debugging purpose only } - public function validate_stack_type($stacktype){ - $os_type = EE_CLI\Utils\get_OS(); - $flag = false; - foreach ($this->stack_os_scope as $value) { - - if ($value == trim($os_type['DISTRIB_ID'])) { - $flag = true; - print_r($os_type['DISTRIB_ID']); - return $flag; - } - } - - if (!$flag) die("Configuration doesnot match with system status \n"); - } - - - public function install() { $process = EE_CLI\Process::create( "sudo apt-get install {$this->pkg['package_name']}" ); diff --git a/php/Stack/package_manager.php b/php/Stack/package_manager.php index 78aefbef..b79f7e6c 100644 --- a/php/Stack/package_manager.php +++ b/php/Stack/package_manager.php @@ -12,7 +12,25 @@ abstract class PKG_MANAGER { protected $stack_os_scope ; - public function __construct() {} + function __construct($stack=array()) { + + $this->stack_os_scope = $stack; + } + + function validate_stack_type($stacktype){ + $os_type = EE_CLI\Utils\get_OS(); + $flag = false; + foreach ($this->stack_os_scope as $value) { + + if ($value == trim($os_type['DISTRIB_ID'])) { + $flag = true; + print_r($os_type['DISTRIB_ID']); + return $flag; + } + } + + if (!$flag) die("Configuration does not match with system status \n"); + } }