r850 - in trunk: . faq lfs scripts templates

jeroen at linuxfromscratch.org jeroen at linuxfromscratch.org
Sun Sep 26 06:42:31 PDT 2004


Author: jeroen
Date: 2004-09-26 07:42:29 -0600 (Sun, 26 Sep 2004)
New Revision: 850

Modified:
   trunk/faq/index.html
   trunk/lfs/faq.html
   trunk/mail.html
   trunk/scripts/styleswitcher.js
   trunk/templates/template.html
Log:
Add glibc-nss issue due to Reiser4 to the FAQ. Props to Jeremy Utley

Modified: trunk/faq/index.html
===================================================================
--- trunk/faq/index.html	2004-09-22 10:31:34 UTC (rev 849)
+++ trunk/faq/index.html	2004-09-26 13:42:29 UTC (rev 850)
@@ -147,6 +147,7 @@
 	<li id="asm-global-directive"><a href="../lfs/faq.html#asm-global-directive">Glibc: "cannot determine asm global directive".</a></li>
 	<li id="glibc-no-ld_map"><a href="../lfs/faq.html#glibc-no-ld_map">Glibc: "ld.map: No such file or directory".</a></li>
 	<li id="glibc-awk-fail"><a href="../lfs/faq.html#glibc-awk-fail">Glibc fails and mentions BEGIN and END.</a></li>
+	<li id="glibc-nss"><a href="../lfs/faq.html#glibc-nss">Glibc compilation errors out due to a missing nss.h header file</a></li>
 	<li id="sh-utils-getloadavg"><a href="../lfs/faq.html#sh-utils-getloadavg">Sh-tuils: "undefined reference to `getloadavg'".</a></li>
 	<li id="cpp-fails-sanity-check"><a href="../lfs/faq.html#cpp-fails-sanity-check">Ncurses: C++ preprocessor "/lib/cpp" fails sanity check</a></li>
 </ul>

Modified: trunk/lfs/faq.html
===================================================================
--- trunk/lfs/faq.html	2004-09-22 10:31:34 UTC (rev 849)
+++ trunk/lfs/faq.html	2004-09-26 13:42:29 UTC (rev 850)
@@ -118,6 +118,7 @@
 	<li><a href="#asm-global-directive">Glibc: "cannot determine asm global directive".</a></li>
 	<li><a href="#glibc-no-ld_map">Glibc: "ld.map: No such file or directory".</a></li>
 	<li><a href="#glibc-awk-fail">Glibc fails and mentions BEGIN and END.</a></li>
+	<li><a href="#glibc-nss">Glibc compilation errors out due to a missing nss.h header file</a></li>
 	<li><a href="#sh-utils-getloadavg">Sh-tuils: "undefined reference to `getloadavg'".</a></li>
 	<li><a href="#cpp-fails-sanity-check">Ncurses: C++ preprocessor "/lib/cpp" fails sanity check</a></li>
 </ul>
@@ -526,6 +527,10 @@
 			</ul>
 			<p>then gawk is failing. The key is the BEGIN and END in the output. The probable reason is that it's not statically linked which you can fix by going back to Chapter 5 and recompiling it.</p>
 		</dd>
+	<dt id="glibc-nss">Glibc compilation errors out due to a missing nss.h header file</dt>
+		<dd>
+			<p>This usually indicates that you are compiling LFS onto a Reiser4 partition. Unfortunately, there is currently no known solution, other than to use a different type of filesystem. </p>
+		</dd>
 	<dt id="sh-utils-getloadavg">Sh-utils: "undefined reference to `getloadavg'".</dt>
 		<dd>
 			<p>If you're trying to build static sh-utils and you're getting an error like this:</p>

Modified: trunk/mail.html
===================================================================
--- trunk/mail.html	2004-09-22 10:31:34 UTC (rev 849)
+++ trunk/mail.html	2004-09-26 13:42:29 UTC (rev 850)
@@ -6,9 +6,9 @@
 	<meta name="description" content="Linux From Scratch - build your own Linux distribution from scratch" />
 	<meta name="keywords" content="Linux, LinuxFromScratch, Linux From Scratch, build your own Linux, DIY Linux, do-it-yourself Linux, create your own Linux" />
 	<meta name="MSSmartTagsPreventParsing" content="true" />
-	<link rel="alternate stylesheet" type="text/css" href="style/3columns.css" media="screen" title="ThreeColumn" />
-	<link rel="stylesheet" type="text/css" href="style/2columns.css" media="screen" title="TwoColumn" />
-	<link rel="alternate stylesheet" type="text/css" href="style/2columns-menu.css" media="screen" title="TwoColumnMenu" />
+	<link rel="alternate stylesheet" type="text/css" href="style/3columns.css" media="screen" title="Three columns [Navigation | Content | Navigation]" />
+	<link rel="stylesheet" type="text/css" href="style/2columns.css" media="screen" title="Two columns [Content (2 columns) | Navigation]" />
+	<link rel="alternate stylesheet" type="text/css" href="style/2columns-menu.css" media="screen" title="Two columns, menu [Content (2 columns) | Navigation, general navigation as menu]" />
 	<link rel="stylesheet" type="text/css" href="style/print.css" media="print" />
 	<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
 	<script type="text/javascript" src="scripts/styleswitcher.js"></script>
@@ -36,12 +36,6 @@
 			</p>
 		</form>
 	</div>
-	<ul id="styleselect">
-		<li>Select layout:</li>
-		<li><a href="#" onclick="setActiveStyleSheet('TwoColumn'); return false;" title="Content (2 columns) | Navigation">Two columns</a></li>
-		<li><a href="#" onclick="setActiveStyleSheet('TwoColumnMenu'); return false;" title="Content (2 columns) | Navigation, general navigation as menu">Two columns, Menu</a></li>
-		<li><a href="#" onclick="setActiveStyleSheet('ThreeColumn'); return false;" title="Navigation|Content|Navigation">Three columns</a></li>
-	</ul>
 </div>
 
 <div id="container">

Modified: trunk/scripts/styleswitcher.js
===================================================================
--- trunk/scripts/styleswitcher.js	2004-09-22 10:31:34 UTC (rev 849)
+++ trunk/scripts/styleswitcher.js	2004-09-26 13:42:29 UTC (rev 850)
@@ -1,17 +1,101 @@
+function updateStyleSwitcherMarkup() {
+  var styleswitcher = document.createElement("ul");
+  styleswitcher.setAttribute("id", "styleselect");
+
+  var node = document.createElement("li");
+  node.appendChild(document.createTextNode("Select layout:"));
+  styleswitcher.appendChild(node);
+
+  var count = 0;
+  var links = document.getElementsByTagName("link");
+  for (var i = 0; i < links.length; i++) {
+    var link = links[i];
+    var rel = link.getAttribute("rel");
+    var media = link.getAttribute("media");
+    var href = link.getAttribute("href");
+    var title = link.getAttribute("title");
+    if (rel && rel.indexOf("style") != -1
+        && media && media.indexOf("screen") != -1
+        && href
+        && link.disabled
+        && title) {
+      node = document.createElement("a");
+      node.setAttribute("href", "#");
+      var style = fileNameToStyleName(href);
+      node.setAttribute("onclick", "setActiveStyleSheet('" + style + "'); return false;");
+      var linkTitle = createLinkTitleFromStyleTitle(title);
+      if (linkTitle) node.setAttribute("title", linkTitle);
+      var text = createLinkTextFromStyleTitle(title);
+      if (!text) text = style;
+      node.appendChild(document.createTextNode(text));
+      styleswitcher.appendChild(node);
+      count++;
+    }
+  }
+
+  /* Only insert the styleswitcher if there is at least one alternate stylesheet
+   * to choose from. */
+  if (count) {
+    var old = document.getElementById("styleselect");
+    if (old) {
+      old.parentNode.replaceChild(styleswitcher, old);
+    } else {
+      document.getElementById("header").appendChild(styleswitcher);
+    }
+  }
+}
+
+/* Returns a text that can be used as the hyperlink text in the styleswitcher,
+ * created from the stylesheet description ('title' attribute of the
+ * corresponding 'link' element).
+ * If no suitable link text can be created, this function returns null.
+ */
+function createLinkTextFromStyleTitle(styleTitle) {
+  if (!styleTitle) return null;
+  var end = styleTitle.indexOf(" [");
+  if (end == -1) end = styleTitle.length;
+  var text = styleTitle.substring(0, end).replace(/^\s*(.*\S)?\s*$/, "$1");
+  if (!text.length) return null;
+  return text;
+}
+
+/* Returns a text that can be used as tooltip for the hyperlink in the
+ * styleswitcher, created from the stylesheet description ('title' attribute of
+ * the corresponding 'link' element).
+ * If no suitable link text can be created, this function returns null.
+ */
+function createLinkTitleFromStyleTitle(styleTitle) {
+  if (!styleTitle) return null;
+  var start = styleTitle.indexOf("[") + 1;
+  if (!start) return null;
+  var end = styleTitle.lastIndexOf("]");
+  if (end == -1) end = styleTitle.length;
+  var text = styleTitle.substring(start, end).replace(/^\s*(.*\S)?\s*$/, "$1");
+  if (!text.length) return null;
+  return text;
+}
+
+
 function setActiveStyleSheet(title) {
+  if (!title) return;
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
-    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
-      a.disabled = true;
-      if(a.getAttribute("title") == title) a.disabled = false;
+    var href = a.getAttribute("href");
+    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")
+       && href) {
+      a.disabled = (href.indexOf(title + ".css") == -1);
+        /* Do not remove the addition of ".css": think of "2columns" and
+         * "2columns-menu". Got it? ;-) */
     }
   }
+  updateStyleSwitcherMarkup();
 }
 
 function getActiveStyleSheet() {
   var i, a;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
-    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
+    var media = a.getAttribute("media");
+    if(a.getAttribute("rel").indexOf("style") != -1 && media && media.indexOf("screen") != -1 && a.getAttribute("title") && !a.disabled && a.getAttribute("href")) return fileNameToStyleName(a.getAttribute("href"));
   }
   return null;
 }
@@ -19,14 +103,55 @@
 function getPreferredStyleSheet() {
   var i, a;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
+    var media = a.getAttribute("media");
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("rel").indexOf("alt") == -1
+       && media && media.indexOf("screen") != -1
        && a.getAttribute("title")
-       ) return a.getAttribute("title");
+       && a.getAttribute("href")
+       ) return fileNameToStyleName(a.getAttribute("href"));
   }
   return null;
 }
 
+/* Extracts the stylesheet name from a filename (part of a URL).
+ * This makes the names look nicer, but keep in mind that we therefore can't use
+ * stylesheets with the same name in different directories.
+ */
+function fileNameToStyleName(filename) {
+  if (!filename) return null;
+
+  var start = filename.lastIndexOf("/") + 1;
+  var end = filename.length;
+  if (filename.substring(end - 4, end) == ".css") end -= 4;
+    /* This is a fallback to avoid crashing on unusual file names.
+     * But function 'setActiveStylesheet' can't handle stylesheets which end in
+     * something else but ".css", so always name them "stylename.css"! */
+
+  return filename.substring(start, end);
+}
+
+/* Translates old stylesheet names (used before 2004-09-20) to the new ones (as
+ * of 2004-09-20), so that existing cookies will continue to work. This function
+ * should be removed once we switch the website to the Wiki if we are going to
+ * break existing cookies anyway.
+ */
+function translateStyleName(oldName) {
+  if (!oldName) return oldName;
+
+  switch (oldName) {
+    case "ThreeColumn":
+      return "3columns";
+    case "TwoColumn":
+      return "2columns";
+    case "TwoColumnMenu":
+      return "2columns-menu";
+  }
+
+  return oldName;
+}
+
+
 function createCookie(name,value,days) {
   if (days) {
     var date = new Date();
@@ -48,9 +173,10 @@
   return null;
 }
 
+
 window.onload = function(e) {
   var cookie = readCookie("style");
-  var title = cookie ? cookie : getPreferredStyleSheet();
+  var title = cookie ? translateStyleName(cookie) : getPreferredStyleSheet();
   setActiveStyleSheet(title);
 }
 
@@ -58,7 +184,3 @@
   var title = getActiveStyleSheet();
   createCookie("style", title, 365);
 }
-
-var cookie = readCookie("style");
-var title = cookie ? cookie : getPreferredStyleSheet();
-setActiveStyleSheet(title);
\ No newline at end of file

Modified: trunk/templates/template.html
===================================================================
--- trunk/templates/template.html	2004-09-22 10:31:34 UTC (rev 849)
+++ trunk/templates/template.html	2004-09-26 13:42:29 UTC (rev 850)
@@ -6,9 +6,9 @@
 	<meta name="description" content="Linux From Scratch - build your own Linux distribution from scratch" />
 	<meta name="keywords" content="Linux, LinuxFromScratch, Linux From Scratch, build your own Linux, DIY Linux, do-it-yourself Linux, create your own Linux" />
 	<meta name="MSSmartTagsPreventParsing" content="true" />
-	<link rel="alternate stylesheet" type="text/css" href="style/3columns.css" media="screen" title="ThreeColumn" />
-	<link rel="stylesheet" type="text/css" href="style/2columns.css" media="screen" title="TwoColumn" />
-	<link rel="alternate stylesheet" type="text/css" href="style/2columns-menu.css" media="screen" title="TwoColumnMenu" />
+	<link rel="alternate stylesheet" type="text/css" href="style/3columns.css" media="screen" title="Three columns [Navigation | Content | Navigation]" />
+	<link rel="stylesheet" type="text/css" href="style/2columns.css" media="screen" title="Two columns [Content (2 columns) | Navigation]" />
+	<link rel="alternate stylesheet" type="text/css" href="style/2columns-menu.css" media="screen" title="Two columns, menu [Content (2 columns) | Navigation, general navigation as menu]" />
 	<link rel="stylesheet" type="text/css" href="style/print.css" media="print" />
 	<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
 	<script type="text/javascript" src="scripts/styleswitcher.js"></script>
@@ -36,12 +36,6 @@
 			</p>
 		</form>
 	</div>
-	<ul id="styleselect">
-		<li>Select layout:</li>
-		<li><a href="#" onclick="setActiveStyleSheet('TwoColumn'); return false;" title="Content (2 columns) | Navigation">Two columns</a></li>
-		<li><a href="#" onclick="setActiveStyleSheet('TwoColumnMenu'); return false;" title="Content (2 columns) | Navigation, general navigation as menu">Two columns, Menu</a></li>
-		<li><a href="#" onclick="setActiveStyleSheet('ThreeColumn'); return false;" title="Navigation|Content|Navigation">Three columns</a></li>
-	</ul>
 </div>
 
 <div id="container">




More information about the website mailing list