if(isset($_REQUEST["action"])) {
switch($_REQUEST["action"]) {
case "addrepo":
- GLCASpageBuilder($this,"doAddRepo");
+ GLCASpageBuilder($this,"doAddRepoForm");
return;
break;
case "scanrepo":
$this->mainBody($url);
}
- function doAddRepo($url)
+ function doAddRepoForm($url)
{
$myRep = new GLCASRepo($this->config);
- $glt = $myRep->getRepoDetailsYum($_REQUEST["repourl"]);
+ $wasyum = false;
+ if($_REQUEST["repotype"] == "yumbase") {
+ $glt = $myRep->getRepoDetailsYum($_REQUEST["repourl"]);
+ $wasyum = true;
+ } else if($_REQUEST["repotype"] == "yummirrorlist") {
+ $glt = $myRep->getRepoDetailsYum($_REQUEST["repourl"], true);
+ $wasyum = true;
+ } else if($_REQUEST["repotype"] == "apt") {
+ $glt = $myRep->getRepoDetailsApt($_REQUEST["repourl"]);
+ }
+
- echo "<pre>$glt</pre>";
+ if($wasyum) {
+ $os = $glt["OS"];
+ $version = $glt["version"];
+ $arch = $glt["arch"];
+ echo "<form method=\"post\" action=\"repoaddreal\">";
+ echo "OS: <input type=\"text\" name=\"OS\" value=\"$os\"><br>";
+ echo "Version: <input type=\"text\" name=\"version\" value=\"$version\"><br>";
+ echo "Architecture: <input type=\"text\" name=\"Architecture\" value=\"$arch\"><br>";
+ echo "Short URL <input type=\"text\" name=\"shorturl\"><br>";
+ echo "URL Prefix (blank for none) <input type=\"text\" name=\"shorturl\"><br>";
+ echo "<input type=\"submit\" name=\"Add\" value=\"add\"><br>";
+ echo "</form>";
+ } else {
+ // apt is much tricker cause one repo can provide multiple versions, OS's and architectures.
+ }
}
function mainBody($url)
--- /dev/null
+<?php
+
+// this class will provide OS knowledge - though how i have no idea yet
+class GLCASKnownOS {
+
+ function __construct()
+ {
+ $knownOS = getKnownOSList();
+ }
+
+ function getOSList()
+ {
+ }
+
+ function getRepoTypeForOS($os)
+ {
+
+ }
+
+ function getRepoTypes()
+ {
+
+ }
+
+ public $knownOS;
+}
+
+function getKnownOSList()
+{
+ // repo types
+ $kos["repotype"]["yum"] = "Yellowdog Updater Modified";
+ $kos["repotype"]["apt"] = "APT";
+
+ // repo providers
+ $kos["repotype"]["yum"][0] = "baseurl";
+ $kos["repotype"]["yum"][1] = "mirrorlist";
+ $kos["repotype"]["apt"][0] = "baseurl";
+
+ // OS's
+ $kos["os"]["Fedora"] = "Fedora";
+ $kos["os"]["Debian"] = "Debian";
+ $kos["os"]["RedHat"] = "RedHat Enterprise Linux";
+ $kos["os"]["Ubuntu"] = "Ubuntu";
+ $kos["os"]["CentOS"] = "Community Enterprise OS";
+
+ // Repo types per os
+ $kos["os"]["Fedora"]["repotype"] = "yum";
+ $kos["os"]["Debian"]["repotype"] = "apt";
+ $kos["os"]["RedHat"]["repotype"] = "yum";
+ $kos["os"]["Ubuntu"]["repotype"] = "apt";
+ $kos["os"]["CentOS"]["repotype"] = "yum";
+
+
+
+ return $kos;
+}
+
+?>
\ No newline at end of file
<?php
$URL_HANDLERS["*"] = "GLCASRepo";
+
class GLCASRepo {
function __construct($config)
{
echo "for the repo, i am the repo $url";
}
- function getRepoDetailsYum($url)
+ function getRepoDetailsYum($url, $ismirrorlist=false)
{
$actionurl = $url."/repodata/repomd.xml";
$ld = file_get_contents($actionurl);
+ // so here we try and get what this repository provides (os, version, arch), for yum this
+ // should come straight off the url... i.e. centos/6.0/os/x86_64/ (centos, 6.0, base os, 64bit arch)
+
if(!$ld) return false;
- return $ld;
+ $glt["OS"] = "Fedora";
+ $glt["version"] = "15";
+ $glt["arch"] = "x86_64";
+
+ return $glt;
}
private $config;