GLCASpageBuilder($this,"doRepoNextForm");
return;
break;
+ case "addrepoapt":
+ GLCASpageBuilder($this,"doAddRepoApt");
+ return;
case "addrepoyum":
GLCASpageBuilder($this,"doAddRepoYum");
return;
{
$myRep = new GLCASRepo($this->config);
+ $kos = getKnownOSList();
+
$wasyum = false;
$wasapt = false;
if($_REQUEST["repotype"] == "yumbase") {
$extratext = "";
$provides = "";
if($glt["nrepos"] > 0) {
- $kos = getKnownOSList();
+
foreach($glt["knownrepo"] as $key => $val) {
$reponame = $kos["apt"][$val];
//echo "Fount a repo, $val which is $reponame<br>";
} else {
//echo "Looks like an apt repo, but I cant find any known distro's<br>";
}
+ //$existing_repos["distros"] = "Ubuntu, Debian";
+ //$existing_repos["versions"] = "8.04LTS, 9.10, 10.04LTS, 10.10, 11.04, 11.10";
+ //$existing_repos["arch"] = "x86_64, i386";
+
+ $distros = $glt["distros"];
+ $version = $glt["versions"];
+ $archs = $glt["arch"];
+
+ //echo "<pre>";
+ //print_r($glt);
+ //echo "</pre>";
+
+ echo "The joy of apt is that there could be a million distro's under the root of an apt mirror";
+ echo "if it doesn't list here, but you know its there, its still usable for glcas";
echo "<form method=\"post\" action=\"?action=addrepoapt\">";
echo "<input type=\"hidden\" name=\"repourl\" value=\"$repourl\">";
+ echo "<input type=\"hidden\" name=\"distro\" value=\"$distros\">";
+ echo "<input type=\"hidden\" name=\"provides\" value=\"Multiple\">";
+ echo "<input type=\"hidden\" name=\"arch\" value=\"$archs\">";
echo "<table>";
echo "<tr><td>Description</td><td><input type=\"text\" name=\"desc\" value=\"APT Repo$extratext\"></td>";
- echo "<tr><td>Provides</td><td><textarea name=\"provides\">$provides</text area></td></tr>";
+
+ // TODO: deal with block bit
+ echo "<tr><td>Provides (tick those you wish to BLOCK - not implemented)</td><td>";
+ foreach($glt["knownrepo"] as $key => $val) {
+ $reponame = $kos["apt"][$val["name"]];
+ $a = "";
+ $b = "";
+ if($glt["knownrepo"][$key]["i386"]) $a = "i386";
+ if($glt["knownrepo"][$key]["amd64"]) $b = "x86_64";
+ if($a != "" && $b != "") $archs = "$a/$b";
+ else $archs = "$a$b";
+ echo "<input type=\"checkbox\" name=\"blocked-".$val["name"]."\"> $reponame ($archs)<br>";
+ }
+
+ echo "</td></tr>";
+ //echo "<tr><td>Provides</td><td><textarea name=\"provides\" rows=\"".$glt["nrepos"]."\" cols=\"100\">$provides</textarea></td></tr>";
echo "<tr><td>Short URL</td><td><input type=\"text\" name=\"shorturl\"></td></tr>";
echo "<tr><td>URL Prefix (blank for none)</td><td><input type=\"text\" name=\"prefix\"></td></tr>";
- echo "<tr><td>Expire time for Meta Data</td><td><input type=\"text\" name=\"expiretime\"> days</td></tr>";
+ echo "<tr><td>Expire time for Meta Data</td><td><input type=\"text\" name=\"expiretime\" value=\"3\"> days</td></tr>";
+ echo "<tr><td><input type=\"submit\" name=\"Add\" value=\"Add\"></td></tr>";
echo "</table>";
echo "</form>";
return true;
echo "<tr><td>Short URL</td><td><input type=\"text\" name=\"shorturl\"></td></tr>";
echo "<tr><td>URL Prefix (blank for none)</td><td><input type=\"text\" name=\"prefix\"></td></tr>";
echo "<tr><td>Do Initial Update (can take a while, but done in background)</td><td><input type=\"checkbox\" name=\"initial\" checked></td></tr>";
- echo "<tr><td>Expire time for Meta Data</td><td><input type=\"text\" name=\"expiretime\"> days</td></tr>";
+ echo "<tr><td>Expire time for Meta Data</td><td><input type=\"text\" name=\"expiretime\" value=\"3\"> days</td></tr>";
echo "<tr><td><input type=\"submit\" name=\"Add\" value=\"Add\"></td></tr>";
echo "</table>";
echo "</form>";
}
}
+
+ function doAddRepoApt($url)
+ {
+ $repo = new GLCASRepo($this->config);
+
+ $desc = $_REQUEST["desc"];
+ $OS = $_REQUEST["distro"];
+ $version = $_REQUEST["provides"];
+ $arch = $_REQUEST["arch"];
+ $shorturl = $_REQUEST["shorturl"];
+ $prefix = $_REQUEST["prefix"];
+ $repurl = $_REQUEST["repourl"];
+ $expiretime = $REQUEST["expiretime"];
+ $init = false;
+ if(isset($_REQUEST["initial"])) $init = true;
+
+ $blocklist = null;
+ $bn = 0;
+ foreach($_REQUEST as $key => $val) {
+ if(preg_match("/^blocked-*/", $key)) {
+ $blocked = preg_replace("/^blocked-/", "", $key);
+ //echo "<br>got block for $blocked<br>";
+ $blocklist[$bn] = "dists\/$blocked.*";
+ $bn++;
+ }
+ }
+
+ //echo "<pre>";
+ //print_r($_REQUEST);
+ //echo "</pre>";
+
+ //exit(0);
+
+ $repo->addRepo($desc, $OS, $version, $arch, "-", $shorturl, $prefix, $repurl, "APT", $init, $expiretime, $blocklist);
+
+ // next we need to deal with that "blocked" bit
+
+ global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
+ header("Location: $BASE_URL/admin/");
+ }
function doAddRepoYum($url)
{
function doUpdateRepo($url)
{
$rkey = $_REQUEST["repo"];
+
+ error_log("would update for repo");
$repo = new GLCASRepo($this->config);
//echo "</pre>";
// wrap all this in a table
- echo "<table><tr><td valign=\"top\">";
+ echo "<table border=\"1\"><tr><td valign=\"top\">";
// now, add a repo
echo "<h3>Add A Repo</h3>";
echo "<form method=\"post\" action=\"?action=reponext\">";
echo "Type <select name=\"repotype\">";
echo "<option value=\"yumbase\">YUM (Base URL)</option>";
- echo "<option value=\"yummirrorlist\">YUM (Mirror List) - not implemented</option>";
- echo "<option value=\"apt\">APT - not implemented</option>";
+ echo "<option value=\"apt\">APT</option>";
echo "</select><br>";
echo "URL <input type=\"text\" name=\"repourl\"><br>";
echo "<input type=\"submit\" name=\"Add\" value=\"Add\"><br>";
echo "Hint <select name=\"repohint\">";
echo "<option value=\"fedora\">Fedora</option>";
echo "<option value=\"centos\">Centos</option>";
- echo "<option value=\"ubuntu\">Ubuntu</option>";
echo "</select><br>";
echo "URL <input type=\"text\" name=\"repourl\"><br>";
echo "<input type=\"submit\" name=\"Scan\" value=\"Scan\"><br>";
echo "</form>";
- echo "</td></tr></table><hr>";
+ echo "</td><td valign=\"top\">";
+
+ // now for mirror lists
+ echo "<h3>Via Mirrolist - not implemented</h3>";
+ echo "<form method=\"post\" action=\"?action=mirrorlist\">";
+ echo "Distro <select name=\"mirrordistro\">";
+ echo "<option value=\"fedora\">Fedora</option>";
+ echo "<option value=\"centos\">Centos</option>";
+ echo "</select><br>";
+ echo "Architecture <select name=\"arch\">";
+ echo "<option value=\"x86_64\">64 bit</option>";
+ echo "<option value=\"i386\">32 bit</option>";
+ echo "</select><br>";
+ echo "Version <input type=\"text\" name=\"version\"><br>";
+ echo "Get updates too <input type=\"checkbox\" name=\"getupdates\"><br>";
+ echo "<input type=\"submit\" name=\"Scan\" value=\"Scan\"><br>";
+ echo "</form>";
+
+
+ echo "</td></tr></table>";
// repo storage location
echo "<h3>Storage<h3><br>";
echo "<form method=\"post\" action=\"?action=setstorage\">";
$storloc = $this->config->getConfigVar("storagelocation");
- echo "<input type=\"text\" name=\"storageloc\" value=\"$storloc\" size=\"100\">";
+ echo "<input class=\"storage\" type=\"text\" name=\"storageloc\" value=\"$storloc\" size=\"100\">";
echo "<input type=\"submit\" name=\"Set\" value=\"Set\">";
echo "</form>";
}