Added more complete PrefixManagement class, and added skeletons for new KernelManagement Functions.
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -360,4 +360,8 @@ MigrationBackup/
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
FodyWeavers.xsd
|
||||
|
||||
# Composer
|
||||
vendor/
|
||||
composer.json.lock
|
||||
@@ -69,7 +69,7 @@ class KernelManagement
|
||||
{
|
||||
$kernelPath = realpath($this->cPrefixPath."/boot/kernel");
|
||||
}
|
||||
|
||||
// TODO: Finish Function
|
||||
}
|
||||
|
||||
private function loadConfiguration()
|
||||
@@ -125,6 +125,32 @@ class KernelManagement
|
||||
|
||||
}
|
||||
|
||||
private function __getBootSlot()
|
||||
{
|
||||
// This will allow us to know what boot slot we're supposed to be flashing into, perhaps we can make a treble compatible system updater with this?
|
||||
$bootSlot = trim(`getprop ro.boot.slot_suffix`);
|
||||
if(empty($bootSlot))
|
||||
{
|
||||
$bootSlot = "";
|
||||
}
|
||||
return $bootSlot;
|
||||
}
|
||||
|
||||
public function installKernelTree($branch = 'flo', $repository = "https://tonoxisisle.services/git/tononixOS/ubports_kernel_google_msm", $kernelName = "3.4.y-tononixOS")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function removeKernelTree($kernelName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function buildKernel($kernelName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function detectBootConfiguration()
|
||||
{
|
||||
if(!file_exists($this->cPrefixPath."/boot/old_boot.img"))
|
||||
@@ -141,6 +167,8 @@ class KernelManagement
|
||||
$this->aBootConfiguration['secondaddr'] = $aboot->get("secondaddr");
|
||||
$this->aBootConfiguration['tagsaddr'] = $aboot->get("tagsaddr");
|
||||
$this->aBootConfiguration['cmdline'] = $aboot->get("cmdline");
|
||||
$bootSlot = $this->__getBootSlot();
|
||||
if(!empty($bootSlot)) $this->aBootConfiguration['bootslot'] = $bootSlot;
|
||||
$this->saveConfiguration();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace libTononix;
|
||||
|
||||
use \Nette\Utils\Finder;
|
||||
use \Noodlehaus\Config;
|
||||
use \Noodlehaus\Parser\Xml;
|
||||
use \Noodlehaus\Parser\Properties;
|
||||
use \Noodlehaus\Parser\Json;
|
||||
|
||||
class PrefixManagement
|
||||
{
|
||||
|
||||
protected $cPrefixPath;
|
||||
|
||||
private $oConfiguration;
|
||||
|
||||
function __construct($prefix = "/home/phablet/.local/system")
|
||||
{
|
||||
$this->cPrefixPath = $prefix;
|
||||
if(!is_dir($this->cPrefixPath))
|
||||
{
|
||||
return false;
|
||||
$this->cPrefixPath = $this->tryDetectPrefix();
|
||||
|
||||
}
|
||||
|
||||
$this->setupEnvironment();
|
||||
// $this->oConfiguration = new \Noodlehaus\Config($this->cPrefixPath."/etc/tononixOS/prefix.conf", new \Noodlehaus\Parser\Xml);
|
||||
|
||||
}
|
||||
|
||||
function tryDetectPrefix()
|
||||
{
|
||||
$files = Finder::findFiles('*.stage3-finished')->from(getenv("HOME"));
|
||||
return $files;
|
||||
foreach(\Nette\Utils\Finder::findFiles('*.stage3-finished')->from(getenv("HOME"))->exclude(['.config','.vscode','.nano','.presage','.ellipsis','.antigen','.android','.npm','.ssh','.pki','anbox-data']) as $key => $file)
|
||||
{
|
||||
return $key;
|
||||
}
|
||||
return $false;
|
||||
}
|
||||
|
||||
function setupEnvironment()
|
||||
{
|
||||
setenv("EPREFIX=".$this->cPrefixPath);
|
||||
setenv("BPREFIX=".$this->cPrefixPath);
|
||||
setenv("SHELL=".$this->cPrefixPath."/usr/bin/bash");
|
||||
$pathArray = array($this->cPrefixPath."/usr/local/bin",
|
||||
$this->cPrefixPath."/usr/local/sbin",
|
||||
$this->cPrefixPath."/usr/bin",
|
||||
$this->cPrefixPath."/usr/sbin",
|
||||
$this->cPrefixPath."/bin",
|
||||
$this->cPrefixPath."/sbin");
|
||||
$pathString = implode(":",$pathArray);
|
||||
$pathString = $pathString . ":" . getenv("PATH");
|
||||
setenv("PATH=$pathString");
|
||||
}
|
||||
|
||||
function installPackage($packageAtom)
|
||||
{
|
||||
exec('emerge --oneshot --update $packageAtom', $emergeLog, $retVal);
|
||||
return array("log"=>$emergeLog,
|
||||
"return" => $retVal);
|
||||
}
|
||||
|
||||
function removePackage($packageAtom)
|
||||
{
|
||||
exec('emerge --depclean --verbose '.$packageAtom, $emergeLog, $retVal);
|
||||
return array("log"=>$emergeLog,
|
||||
"return" => $retVal);
|
||||
}
|
||||
|
||||
function syncPackageLists()
|
||||
{
|
||||
exec('emerge --sync', $emergeLog, $retVal);
|
||||
return array("log"=>$emergeLog,
|
||||
"return" => $retVal);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"require": {
|
||||
"hassankhan/config": "^2.2",
|
||||
"nette/finder": "^2.5"
|
||||
"nette/finder": "^2.5",
|
||||
"czproject/git-php": "^4.0",
|
||||
"sebastian/version": "^3.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user