If you are running Firefox, then the credentials you entered were incorrect. Please confirm that the username and password you entered are valid for the Red Hat Customer Portal.
\
-
\
- \
-
'));
-
- addClickFunction(buttonId, topicId, popoverId);
- } else if (solutionsResponse.status == 200) {
- var solutions = JSON.parse(solutionsResponse.responseText);
-
- if (!solutions.solution) {
- if (position > 0) {
- getSolutions(topic, position - 25, topicId, popoverId);
- }
- } else {
- var solutionsTable = "
";
-
- for (var solutionIndex = 0, solutionCount = solutions.solution.length; solutionIndex < solutionCount; ++solutionIndex) {
- var solution = solutions.solution[solutionIndex];
- var published = solution.moderation_state == "published";
- solutionsTable += '
If you are running Firefox, you may be prompted for a username and password. These credentials are the ones that you use to log into the Red Hat Customer Portal
\
-
\
- \
-
'));
-
- addClickFunction(buttonId, unsafeWindow.eventDetails.topicId, unsafeWindow.eventDetails.popoverId);
- }
- });
-
- /*
- Build the callout that displays the bug submission link.
- */
- var height = 250;
- var width = 200;
- var smallHeight = 150;
-
- var callout = null;
-
- function getSpecIdFromURL() {
- var urlComponents = window.location.href.split("/");
- for (var index = urlComponents.length - 1; index >= 0; --index) {
- var integer = parseInt(urlComponents[index]);
- if (!isNaN(integer)) {
- return integer;
- }
- }
-
- return null;
- }
-
- function buildBugCallout(top, left, text, parent) {
-
- var iframeSrc = null;
-
- var parentSection = parent.parentNode;
- while (parentSection && (parentSection.nodeName != "DIV" || parentSection.className != "section")) {
- parentSection = parentSection.parentNode;
- }
-
-
- if (parentSection && parentSection.nodeName == "DIV" && parentSection.className == "section") {
- var elements = parentSection.childNodes;
- for (var i = elements.length - 1; i >= 0; --i) {
- var element = elements[i];
- if (element.className.match(".*RoleCreateBugPara.*")) {
- if (element.innerHTML.match(".*Report a bug.*")) {
- iframeSrc = element.children[0].getAttribute("href");
- break;
- }
- }
- }
- }
-
- if (iframeSrc) {
-
- var bzURLRegex = /.*?(&|\?)comment=(.*?)(&|$)/;
- var match = bzURLRegex.exec(iframeSrc);
- iframeSrc = iframeSrc.replace("comment=" + match[2], "comment=" + encodeURIComponent("Selected Text: \"" + text + "\"\n\nBug Details: ") + "&short_desc==" + encodeURIComponent("PressZilla Bug"));
-
- logToConsole(iframeSrc);
-
- callout = jQuery('
\
- The content selected does not have any bug information. This may be because you selected text in a boilerplate section of the document which was not supplied by PressGang, or because the content specification has not enabled bug links.\
-
\
-
\
-
');
- jQuery(document.body).append(callout);
- }
-
-
- }
-
- function removeCallout() {
- if (callout) {
- callout.remove();
- callout = null;
- }
- }
-
- // http://stackoverflow.com/questions/1335252/how-can-i-get-the-dom-element-which-contains-the-current-selection
- function getSelectionBoundaryElement(isStart) {
- var range, sel, container;
- if (document.selection) {
- range = document.selection.createRange();
- range.collapse(isStart);
- return {parent: range.parentElement(), selection: range};
- } else {
- sel = window.getSelection();
- if (sel.getRangeAt) {
- if (sel.rangeCount > 0) {
- range = sel.getRangeAt(0);
- }
- } else {
- // Old WebKit
- range = document.createRange();
- range.setStart(sel.anchorNode, sel.anchorOffset);
- range.setEnd(sel.focusNode, sel.focusOffset);
-
- // Handle the case when the selection was selected backwards (from the end to the start in the document)
- if (range.collapsed !== sel.isCollapsed) {
- range.setStart(sel.focusNode, sel.focusOffset);
- range.setEnd(sel.anchorNode, sel.anchorOffset);
- }
- }
-
- if (range) {
- container = range[isStart ? "startContainer" : "endContainer"];
-
- // Check if the container is a text node and return its parent if so
- return {parent: container.nodeType === 3 ? container.parentNode : container, selection: sel};
- }
- }
- }
-
- jQuery(document).mouseup(function(e) {
-
- if (callout) {
- var x = e.pageX;
- var y = e.pageY;
- var offset = callout.offset();
-
- if (x >= offset.left && x <= offset.left + callout.width() &&
- y >= offset.top && y <= offset.top + callout.height()) {
- // click was over callout, so don't do anything
- logToConsole("Clicked over callout");
- return;
- }
- }
-
- removeCallout();
- var selectionDetails = getSelectionBoundaryElement(true);
- if (selectionDetails && selectionDetails.selection && jQuery.trim(selectionDetails.selection.toString()).length != 0) {
-
- var selectedText = jQuery.trim(selectionDetails.selection.toString());
- var top = jQuery(selectionDetails.parent).offset().top;
- var left = jQuery(document.body).offset().left + jQuery(document.body).width() + 20;
-
- logToConsole(selectedText);
-
- buildBugCallout(top, left, selectedText, selectionDetails.parent);
- }
-
- return;
- });
-
-} else if (NEW_WINDOW_NAME == window.name) {
-
- logToConsole("Detected Bugzilla Window");
-
- //jQuery(document.body).css("display", "none");
-
- //jQuery(document).ready(function() {
-
- //jQuery(document.body).css("display", "");
-
- if (jQuery("#Bugzilla_login").length != 0) {
- // logging in
-
- var hiddenElements = jQuery("form>input[type=hidden]");
-
- var newForm = jQuery(''
- );
-
- createForm.append(componentSelect);
- createForm.append(versionSelect);
- createForm.append(shortDesc);
- createForm.append(assignedTo);
- createForm.append(cfBuildId);
- createForm.append(cfEnvironment);
- createForm.append(hidden);
- createForm.find('#CommentCell').append(comment);
- createForm.find('#SubmittCell').append(commit);
-
- jQuery("body").empty();
- jQuery("body").css("background-image", "none");
- comment.attr("rows", 25);
- jQuery("body").append(createForm);
-
- } else if (window.location.pathname == "/show_bug.cgi") {
- // Viewing the submitted bug
- var regex = /.*?id=(\d+)/;
- var match = regex.exec(window.location.href);
- if (match) {
- var id = match[1];
- var link = jQuery('Bug ' + id + ' Created');
- var close = jQuery('');
-
- var createForm = jQuery('\
- '
- );
-
- jQuery("body").empty();
- jQuery("body").css("background-image", "none");
-
- jQuery("#LinkCell", createForm).append(link);
- jQuery("#CloseCell", createForm).append(close);
- jQuery("body").append(createForm);
-
- }
- } else if (jQuery("#bugzilla-body").length != 0) {
- // something else (maybe product selection)
- var bugzillaBody = jQuery("#bugzilla-body");
- jQuery("body").empty();
- jQuery("body").css("background-image", "none");
- jQuery("body").append(bugzillaBody);
- }
- //}
-}
\ No newline at end of file
diff --git a/build_books.sh b/build_books.sh
index fbe676b..5cc1b8e 100755
--- a/build_books.sh
+++ b/build_books.sh
@@ -2,30 +2,30 @@
function cleanHTMLDir()
{
- CLEAN_DIR=$1
+ CLEAN_DIR=$1
- if [ -d /var/www/html/${CLEAN_DIR} ] || [ -e /var/www/html/${CLEAN_DIR} ]
- then
- rm -rf /var/www/html/${CLEAN_DIR}
- fi
+ if [ -d /var/www/html/${CLEAN_DIR} ] || [ -e /var/www/html/${CLEAN_DIR} ]
+ then
+ rm -rf /var/www/html/${CLEAN_DIR}
+ fi
}
function backupAndCleanHTMLDir()
{
- CLEAN_DIR=$1
+ CLEAN_DIR=$1
- if [ -d /var/www/html/${CLEAN_DIR} ] || [ -e /var/www/html/${CLEAN_DIR} ]
- then
- if [ -d /var/www/html/backup/${CLEAN_DIR} ] || [ -e /var/www/html/backup/${CLEAN_DIR} ]
- then
- rm -rf /var/www/html/backup/${CLEAN_DIR}
- fi
+ if [ -d /var/www/html/${CLEAN_DIR} ] || [ -e /var/www/html/${CLEAN_DIR} ]
+ then
+ if [ -d /var/www/html/backup/${CLEAN_DIR} ] || [ -e /var/www/html/backup/${CLEAN_DIR} ]
+ then
+ rm -rf /var/www/html/backup/${CLEAN_DIR}
+ fi
- mkdir -p /var/www/html/backup/${CLEAN_DIR}
- cp -r /var/www/html/${CLEAN_DIR} /var/www/html/backup/${CLEAN_DIR}
- rm -rf /var/www/html/${CLEAN_DIR}
- fi
+ mkdir -p /var/www/html/backup/${CLEAN_DIR}
+ cp -r /var/www/html/${CLEAN_DIR} /var/www/html/backup/${CLEAN_DIR}
+ rm -rf /var/www/html/${CLEAN_DIR}
+ fi
}
@@ -41,8 +41,8 @@ PUBLICAN_BOOK_ZIPS_COMPLETE=${APACHE_HTML_DIR}${PUBLICAN_BOOK_ZIPS}
if [ "$#" -lt ${EXPECTED_ARGS} ]
then
- echo ERROR! Expected more arguments.
- exit 1
+ echo ERROR! Expected more arguments.
+ exit 1
fi
# Get the suffix on the directory
@@ -51,145 +51,121 @@ shift
while (( "$#" ))
do
- IFS='=' read -ra ADDR <<< "$1"
-
- # Extract the language, Common Content language and CSP id
- # from the command line argument
- BUILD_LANG=${ADDR[0]}
- PUBLICAN_LANG=${ADDR[1]}
- CSPID=${ADDR[2]}
+ IFS='=' read -ra ADDR <<< "$1"
- # Shift the arguments down
- shift
+ # Extract the language, Common Content language and CSP id
+ # from the command line argument
+ BUILD_LANG=${ADDR[0]}
+ PUBLICAN_LANG=${ADDR[1]}
+ CSPID=${ADDR[2]}
- # Start with a clean temp dir for every build
- if [ -d ${TMP_DIR}${DIR_SUFFIX} ]
- then
- rm -rf ${TMP_DIR}${DIR_SUFFIX}
- fi
-
- mkdir ${TMP_DIR}${DIR_SUFFIX}
+ # Shift the arguments down
+ shift
- # Enter the temp directory
- pushd ${TMP_DIR}${DIR_SUFFIX}
+ # Start with a clean temp dir for every build
+ if [ -d ${TMP_DIR}${DIR_SUFFIX} ]
+ then
+ rm -rf ${TMP_DIR}${DIR_SUFFIX}
+ fi
- # Build the book as HTML-SINGLE with no overrides
- date > build.log
+ mkdir ${TMP_DIR}${DIR_SUFFIX}
- echo "csprocessor build --lang ${BUILD_LANG} --flatten --editor-links --show-report --target-lang ${PUBLICAN_LANG} --output ${BOOKNAME}.zip ${CSPID} >> build.log"
- csprocessor build --lang ${BUILD_LANG} --flatten --editor-links --show-report --target-lang ${PUBLICAN_LANG} --output ${BOOKNAME}.zip ${CSPID} >> build.log
+ # Enter the temp directory
+ pushd ${TMP_DIR}${DIR_SUFFIX}
- CSP_STATUS=$?
-
- # If the csp build failed then continue to the next item
- if [ $CSP_STATUS != 0 ]
- then
- cleanHTMLDir ${BUILD_LANG}/${CSPID}
+ # Build the book as HTML-SINGLE with no overrides
+ date > build.log
- mkdir -p /var/www/html/${BUILD_LANG}/${CSPID}
- cp build.log /var/www/html/${BUILD_LANG}/${CSPID}
+ echo "csprocessor build --lang ${BUILD_LANG} --flatten --editor-links --show-report --target-lang ${PUBLICAN_LANG} --output ${BOOKNAME}.zip ${CSPID} >> build.log"
+ csprocessor build --lang ${BUILD_LANG} --flatten --editor-links --show-report --target-lang ${PUBLICAN_LANG} --output ${BOOKNAME}.zip ${CSPID} >> build.log
- continue
- fi
+ CSP_STATUS=$?
- unzip ${BOOKNAME}.zip
+ backupAndCleanHTMLDir ${BUILD_LANG}/${CSPID}
+ mkdir -p /var/www/html/${BUILD_LANG}/${CSPID}
+ cp build.log /var/www/html/${BUILD_LANG}/${CSPID}
- # The zip file will be extracted to a directory name that
- # refelcts the name of the book. We don't know this name,
- # but we can loop over the subdirectories and then break
- # once we have processed the first directory.
- for dir in ./*/
- do
+ # If the csp build failed then continue to the next item
+ if [ $CSP_STATUS != 0 ]
+ then
+ continue
+ fi
- # Enter the extracted book directory
- pushd ${dir}
+ unzip ${BOOKNAME}.zip
- # Clone the publican.cfg for the html and remark builds
- cp publican.cfg publican-html.cfg
- cp publican.cfg publican-remarks.cfg
+ # The zip file will be extracted to a directory name that
+ # refelcts the name of the book. We don't know this name,
+ # but we can loop over the subdirectories and then break
+ # once we have processed the first directory.
+ for dir in ./*/
+ do
- # Add the extra options for the html and remark builds
- echo -e "\nchunk_first: 1" >> publican-html.cfg
- echo -e "\nshow_remarks: 1" >> publican-remarks.cfg
+ # Enter the extracted book directory
+ pushd ${dir}
- # Do the original publican build
- echo "publican build --formats=html-single,pdf --langs=${PUBLICAN_LANG} &> publican.log"
- publican build --formats=html-single,pdf --langs=${PUBLICAN_LANG} &> publican.log
-
- PUBLICAN_STATUS=$?
+ # Clone the publican.cfg for the remark builds
+ cp publican.cfg publican-remarks.cfg
- mkdir -p /var/www/html/${BUILD_LANG}/${CSPID}
- cp publican.log /var/www/html/${BUILD_LANG}/${CSPID}
+ # Add the extra options for the html and remark builds
+ echo -e "\nchunk_first: 1" >> publican.cfg
+ echo -e "\nshow_remarks: 1" >> publican-remarks.cfg
- backupAndCleanHTMLDir ${BUILD_LANG}/${CSPID}
- mkdir -p /var/www/html/${BUILD_LANG}/${CSPID}
-
- cp -R tmp/${PUBLICAN_LANG}/html-single/* /var/www/html/${BUILD_LANG}/${CSPID}
- cp -R tmp/${PUBLICAN_LANG}/pdf/* /var/www/html/${BUILD_LANG}/${CSPID}
+ # Do the original publican build
+ echo "publican build --formats=html-single,pdf,html --langs=${PUBLICAN_LANG} &> publican.log"
+ publican build --formats=html-single,pdf,html --langs=${PUBLICAN_LANG} &> publican.log
- # don't bother with the html or remark if the html-single failed
- if [ $PUBLICAN_STATUS == 0 ]
- then
-
- # Clean up
- rm -rf tmp
- rm publican.log
+ PUBLICAN_STATUS=$?
- # Do the html publican build
- echo "publican build --langs=${PUBLICAN_LANG} --formats=html --config=publican-html.cfg &> publican.log"
+ cp -R tmp/${PUBLICAN_LANG}/html-single/* /var/www/html/${BUILD_LANG}/${CSPID}
+ cp -R tmp/${PUBLICAN_LANG}/pdf/* /var/www/html/${BUILD_LANG}/${CSPID}
+ cp publican.log /var/www/html/${BUILD_LANG}/${CSPID}
- publican build --langs=${PUBLICAN_LANG} --formats=html --config=publican-html.cfg &> publican.log
+ # Copy the html to its own directory
+ cleanHTMLDir ${BUILD_LANG}/${CSPID}/html
+ mkdir /var/www/html/${BUILD_LANG}/${CSPID}/html
- if [ -d /var/www/html/${BUILD_LANG}/${CSPID}/html ] || [ -e /var/www/html/${BUILD_LANG}/${CSPID}/html ]
- then
- rm -rf /var/www/html/${BUILD_LANG}/${CSPID}/html
- fi
+ cp -R tmp/${PUBLICAN_LANG}/html/* /var/www/html/${BUILD_LANG}/${CSPID}/html
+ cp publican.log /var/www/html/${BUILD_LANG}/${CSPID}/html
- mkdir /var/www/html/${BUILD_LANG}/${CSPID}/html
- cp -R tmp/${PUBLICAN_LANG}/html/. /var/www/html/${BUILD_LANG}/${CSPID}/html
+ # don't bother with the remark if the html-single failed
+ if [ $PUBLICAN_STATUS == 0 ]
+ then
- cp publican.log /var/www/html/${BUILD_LANG}/${CSPID}/html
+ # Clean up
+ rm -rf tmp
+ rm publican.log
- # Clean up
- rm -rf tmp
- rm publican.log
+ # Do the remarks build
+ echo "publican build --langs=${PUBLICAN_LANG} --formats=html-single --config=publican-remarks.cfg &> publican.log"
+ publican build --langs=${PUBLICAN_LANG} --formats=html-single --config=publican-remarks.cfg &> publican.log
- # Do the remarks build
- echo "publican build --langs=${PUBLICAN_LANG} --formats=html-single --config=publican-remarks.cfg &> publican.log"
+ cleanHTMLDir ${BUILD_LANG}/${CSPID}/remarks
+ mkdir -p /var/www/html/${BUILD_LANG}/${CSPID}/remarks
- publican build --langs=${PUBLICAN_LANG} --formats=html-single --config=publican-remarks.cfg &> publican.log
+ cp -R tmp/${PUBLICAN_LANG}/html-single/* /var/www/html/${BUILD_LANG}/${CSPID}/remarks
+ cp publican.log /var/www/html/${BUILD_LANG}/${CSPID}/remarks
- if [ -d /var/www/html/${BUILD_LANG}/${CSPID}/remarks ] || [ -e /var/www/html/${BUILD_LANG}/${CSPID}/remarks ]
- then
- rm -rf /var/www/html/${BUILD_LANG}/${CSPID}/remarks
- fi
-
- mkdir -p /var/www/html/${BUILD_LANG}/${CSPID}/remarks
- cp -R tmp/${PUBLICAN_LANG}/html-single/. /var/www/html/${BUILD_LANG}/${CSPID}/remarks
-
- cp publican.log /var/www/html/${BUILD_LANG}/${CSPID}/remarks
-
-# # Build the publican zip file without editor links
-# DATE_MARKER=$(date '+%Y-%m-%dT%k:%M:%S.000%z')
-# BOOK_FILE_NAME="${PUBLICAN_BOOK_ZIPS_COMPLETE}/${BUILD_LANG}/${CSPID} ${DATE_MARKER}.zip"
+# # Build the publican zip file without editor links
+# DATE_MARKER=$(date '+%Y-%m-%dT%k:%M:%S.000%z')
+# BOOK_FILE_NAME="${PUBLICAN_BOOK_ZIPS_COMPLETE}/${BUILD_LANG}/${CSPID} ${DATE_MARKER}.zip"
#
-# if [ -f "${BOOK_FILE_NAME}" ]
-# then
-# rm -rf "${BOOK_FILE_NAME}"
-# fi
+# if [ -f "${BOOK_FILE_NAME}" ]
+# then
+# rm -rf "${BOOK_FILE_NAME}"
+# fi
#
-# echo "csprocessor build --lang ${BUILD_LANG} --output "${BOOK_FILE_NAME}" ${CSPID} >> build.log"
-# csprocessor build --lang ${BUILD_LANG} --output "${BOOK_FILE_NAME}" ${CSPID} >> build.log
+# echo "csprocessor build --lang ${BUILD_LANG} --target-lang ${PUBLICAN_LANG} --hide-errors --output "${BOOK_FILE_NAME}" ${CSPID} >> build.log"
+# csprocessor build --lang ${BUILD_LANG} --target-lang ${PUBLICAN_LANG} --hide-errors --output "${BOOK_FILE_NAME}" ${CSPID} >> build.log
+
+ fi
- fi
+ popd
- popd
-
- # we only want to process one directory
- break
+ # we only want to process one directory
+ break
- done
+ done
- cp build.log /var/www/html/${BUILD_LANG}/${CSPID}
- popd
+ cp build.log /var/www/html/${BUILD_LANG}/${CSPID}
+ popd
done
diff --git a/build_original_books.sh b/build_original_books.sh
index d6aa6fe..bbd1b2d 100755
--- a/build_original_books.sh
+++ b/build_original_books.sh
@@ -1,5 +1,15 @@
#!/bin/bash
+function cleanHTMLDir()
+{
+ CLEAN_DIR=$1
+
+ if [ -d /var/www/html/${CLEAN_DIR} ] || [ -e /var/www/html/${CLEAN_DIR} ]
+ then
+ rm -rf /var/www/html/${CLEAN_DIR}
+ fi
+}
+
TMP_DIR=/tmp/buildbooks
BOOKNAME=Book
EXPECTED_ARGS=2
@@ -36,146 +46,115 @@ fi
while (( "$#" ))
do
- # Extract the language and CSP id from the
- # command line argument
- CSPID=$1
-
- # Shift the arguments down
- shift
-
- # Start with a clean temp dir for every build
- if [ -d ${TMP_DIR}${DIR_SUFFIX} ]
- then
- rm -rf ${TMP_DIR}${DIR_SUFFIX}
- fi
-
- mkdir ${TMP_DIR}${DIR_SUFFIX}
-
- # Enter the temp directory
- pushd ${TMP_DIR}${DIR_SUFFIX}
-
- # Build the book as HTML-SINGLE with no overrides
- date > build.log
-
- echo "csprocessor build --flatten --show-report --editor-links --skip-bug-link-validation --output ${BOOKNAME}.zip ${CSPID} >> build.log"
- csprocessor build --flatten --editor-links --skip-bug-link-validation --output ${BOOKNAME}.zip ${CSPID} >> build.log
-
- CSP_STATUS=$?
-
- # If the csp build failed then continue to the next item
- if [ $CSP_STATUS != 0 ]
- then
- if [ -d /var/www/html/${CSPID} ]
- then
- rm -rf /var/www/html/${CSPID}
- fi
-
- mkdir /var/www/html/${CSPID}
- cp build.log /var/www/html/${CSPID}
-
- else
- unzip ${BOOKNAME}.zip
-
- # The zip file will be extracted to a directory name that
- # refelcts the name of the book. We don't know this name,
- # but we can loop over the subdirectories and then break
- # once we have processed the first directory.
- for dir in ./*/
- do
-
- # Enter the extracted book directory
- pushd ${dir}
-
- # Clone the publican.cfg for the html and remark builds
- cp publican.cfg publican-html.cfg
- cp publican.cfg publican-remarks.cfg
-
- # Add the extra options for the html and remark builds
- echo -e "\nchunk_first: 1" >> publican-html.cfg
- echo -e "\nshow_remarks: 1" >> publican-remarks.cfg
-
- # Do the original publican build
- echo 'publican build --formats=html-single --langs=en-US &> publican.log'
-
- publican build --formats=html-single --langs=en-US &> publican.log
-
- PUBLICAN_STATUS=$?
-
- if [ -d /var/www/html/${CSPID} ] || [ -e /var/www/html/${CSPID} ]
- then
- rm -rf /var/www/html/${CSPID}
- fi
-
- mkdir /var/www/html/${CSPID}
- cp -R tmp/en-US/html-single/. /var/www/html/${CSPID}
-
- cp publican.log /var/www/html/${CSPID}
-
- # don't bother with the html or remark if the html-single failed
- if [ $PUBLICAN_STATUS == 0 ] && [ $CSP_STATUS == 0 ]
- then
- # Clean up
- rm -rf tmp
- rm publican.log
-
- # Do the html publican build
- echo 'publican build --formats=html --langs=en-US &> publican.log'
-
- publican build --formats=html --langs=en-US --config=publican-html.cfg &> publican.log
-
- if [ -d /var/www/html/${CSPID}/html ] || [ -e /var/www/html/${CSPID}/html ]
- then
- rm -rf /var/www/html/${CSPID}/html
- fi
-
- mkdir /var/www/html/${CSPID}/html
- cp -R tmp/en-US/html/. /var/www/html/${CSPID}/html
-
- cp publican.log /var/www/html/${CSPID}/html
-
- # Clean up
- rm -rf tmp
- rm publican.log
-
- # Do the remarks build
- echo 'publican build --formats=html-single --langs=en-US &> publican.log'
-
- publican build --formats=html-single --langs=en-US --config=publican-remarks.cfg &> publican.log
-
- if [ -d /var/www/html/${CSPID}/remarks ] || [ -e /var/www/html/${CSPID}/remarks ]
- then
- rm -rf /var/www/html/${CSPID}/remarks
- fi
-
- mkdir -p /var/www/html/${CSPID}/remarks
- cp -R tmp/en-US/html-single/. /var/www/html/${CSPID}/remarks
-
- cp publican.log /var/www/html/${CSPID}/remarks
-
- # Build the publican zip file without editor links
- DATE_MARKER=$(date '+%Y-%m-%dT%k:%M:%S.000%z')
- BOOK_FILE_NAME="${PUBLICAN_BOOK_ZIPS_COMPLETE}/${CSPID} ${DATE_MARKER}.zip"
-
- if [ -f "${BOOK_FILE_NAME}" ]
- then
- rm -rf "${BOOK_FILE_NAME}"
- fi
-
- echo "csprocessor build --output "${BOOK_FILE_NAME}" ${CSPID} >> build.log"
- csprocessor build --output "${BOOK_FILE_NAME}" ${CSPID} >> build.log
-
- fi
- popd
-
- # we only want to process one directory
- break
-
- done
-
- cp build.log /var/www/html/${CSPID}
- fi
-
- popd
+ # Extract the language and CSP id from the
+ # command line argument
+ CSPID=$1
+
+ # Shift the arguments down
+ shift
+
+ # Start with a clean temp dir for every build
+ if [ -d ${TMP_DIR}${DIR_SUFFIX} ]
+ then
+ rm -rf ${TMP_DIR}${DIR_SUFFIX}
+ fi
+
+ mkdir ${TMP_DIR}${DIR_SUFFIX}
+
+ # Enter the temp directory
+ pushd ${TMP_DIR}${DIR_SUFFIX}
+
+ # Build the book as HTML-SINGLE with no overrides
+ date > build.log
+
+ echo "csprocessor build --flatten --editor-links --skip-bug-link-validation --output ${BOOKNAME}.zip ${CSPID} >> build.log"
+ csprocessor build --flatten --editor-links --skip-bug-link-validation --output ${BOOKNAME}.zip ${CSPID} >> build.log
+
+ CSP_STATUS=$?
+
+ cleanHTMLDir ${CSPID}
+ mkdir /var/www/html/${CSPID}
+ cp build.log /var/www/html/${CSPID}
+
+ # If the csp build failed then continue to the next item
+ if [ $CSP_STATUS == 0 ]
+ then
+ unzip ${BOOKNAME}.zip
+
+ # The zip file will be extracted to a directory name that
+ # refelcts the name of the book. We don't know this name,
+ # but we can loop over the subdirectories and then break
+ # once we have processed the first directory.
+ for dir in ./*/
+ do
+
+ # Enter the extracted book directory
+ pushd ${dir}
+
+ # Clone the publican.cfg for the remark builds
+ cp publican.cfg publican-remarks.cfg
+
+ # Add the extra options for the html and remark builds
+ echo -e "\nchunk_first: 1" >> publican.cfg
+ echo -e "\nshow_remarks: 1" >> publican-remarks.cfg
+
+ # Do the original publican build
+ echo 'publican build --formats=html-single,html --langs=en-US &> publican.log'
+ publican build --formats=html-single,html --langs=en-US &> publican.log
+
+ PUBLICAN_STATUS=$?
+
+ cp -R tmp/en-US/html-single/* /var/www/html/${CSPID}
+ cp publican.log /var/www/html/${CSPID}
+
+ # Copy the html to its own directory
+ cleanHTMLDir ${CSPID}/html
+ mkdir /var/www/html/${CSPID}/html
+
+ cp -R tmp/en-US/html/* /var/www/html/${CSPID}/html
+ cp publican.log /var/www/html/${CSPID}/html
+
+ # don't bother with the remark if the html-single failed
+ if [ $PUBLICAN_STATUS == 0 ] && [ $CSP_STATUS == 0 ]
+ then
+
+ # Clean up
+ rm -rf tmp
+ rm publican.log
+
+ # Do the remarks build
+ echo 'publican build --formats=html-single --langs=en-US --config=publican-remarks.cfg &> publican.log'
+ publican build --formats=html-single --langs=en-US --config=publican-remarks.cfg &> publican.log
+
+ cleanHTMLDir ${CSPID}/remarks
+ mkdir -p /var/www/html/${CSPID}/remarks
+
+ cp -R tmp/en-US/html-single/* /var/www/html/${CSPID}/remarks
+ cp publican.log /var/www/html/${CSPID}/remarks
+
+ # Build the publican zip file without editor links
+ DATE_MARKER=$(date '+%Y-%m-%dT%k:%M:%S.000%z')
+ BOOK_FILE_NAME="${PUBLICAN_BOOK_ZIPS_COMPLETE}/${CSPID} ${DATE_MARKER}.zip"
+
+ if [ -f "${BOOK_FILE_NAME}" ]
+ then
+ rm -rf "${BOOK_FILE_NAME}"
+ fi
+
+ echo "csprocessor build --output "${BOOK_FILE_NAME}" ${CSPID} >> build.log"
+ csprocessor build --output "${BOOK_FILE_NAME}" ${CSPID} >> build.log
+
+ fi
+ popd
+
+ # we only want to process one directory
+ break
+
+ done
+
+ fi
+
+ popd
done
diff --git a/build_original_books.sh~ b/build_original_books.sh~
deleted file mode 100644
index 9489173..0000000
--- a/build_original_books.sh~
+++ /dev/null
@@ -1,183 +0,0 @@
-#!/bin/bash
-
-TMP_DIR=/tmp/buildbooks
-BOOKNAME=Book
-EXPECTED_ARGS=2
-# The Apache root html directory
-APACHE_HTML_DIR=/var/www/html
-# The directory that holds the Publican ZIP files
-PUBLICAN_BOOK_ZIPS=/books
-# The complete directory that holds the Publican ZIP files
-PUBLICAN_BOOK_ZIPS_COMPLETE=${APACHE_HTML_DIR}${PUBLICAN_BOOK_ZIPS}
-
-if [ "$#" -lt ${EXPECTED_ARGS} ]
-then
- echo ERROR! Expected more arguments.
- exit 1
-fi
-
-# Get the suffix on the directory
-DIR_SUFFIX=$1
-LOCK_FILE=${TMP_DIR}${DIR_SUFFIX}.lock
-
-# echo ${LOCK_FILE}
-
-shift
-
-# Check and create a lock file to make sure builds don't overlap
-if [ -f ${LOCK_FILE} ]
-then
- date >> build_original_books_error.log
- echo "ERROR! ${LOCK_FILE} exists, consider increasing the time between builds." >> build_original_books_error.log
- exit 1
-else
- touch ${LOCK_FILE}
-fi
-
-while (( "$#" ))
-do
- # Extract the language and CSP id from the
- # command line argument
- CSPID=$1
-
- # Shift the arguments down
- shift
-
- # Start with a clean temp dir for every build
- if [ -d ${TMP_DIR}${DIR_SUFFIX} ]
- then
- rm -rf ${TMP_DIR}${DIR_SUFFIX}
- fi
-
- mkdir ${TMP_DIR}${DIR_SUFFIX}
-
- # Enter the temp directory
- pushd ${TMP_DIR}${DIR_SUFFIX}
-
- # Build the book as HTML-SINGLE with no overrides
- date > build.log
-
- echo "csprocessor build --flatten --show-report --editor-links --output ${BOOKNAME}.zip ${CSPID} >> build.log"
- csprocessor build --flatten --editor-links --output ${BOOKNAME}.zip ${CSPID} >> build.log
-
- CSP_STATUS=$?
-
- # If the csp build failed then continue to the next item
- if [ $CSP_STATUS != 0 ]
- then
- if [ -d /var/www/html/${CSPID} ]
- then
- rm -rf /var/www/html/${CSPID}
- fi
-
- mkdir /var/www/html/${CSPID}
- cp build.log /var/www/html/${CSPID}
-
- else
- unzip ${BOOKNAME}.zip
-
- # The zip file will be extracted to a directory name that
- # refelcts the name of the book. We don't know this name,
- # but we can loop over the subdirectories and then break
- # once we have processed the first directory.
- for dir in ./*/
- do
-
- # Enter the extracted book directory
- pushd ${dir}
-
- # Clone the publican.cfg for the html and remark builds
- cp publican.cfg publican-html.cfg
- cp publican.cfg publican-remarks.cfg
-
- # Add the extra options for the html and remark builds
- echo -e "\nchunk_first: 1" >> publican-html.cfg
- echo -e "\nshow_remarks: 1" >> publican-remarks.cfg
-
- # Do the original publican build
- echo 'publican build --formats=html-single --langs=en-US &> publican.log'
-
- publican build --formats=html-single --langs=en-US &> publican.log
-
- PUBLICAN_STATUS=$?
-
- if [ -d /var/www/html/${CSPID} ] || [ -e /var/www/html/${CSPID} ]
- then
- rm -rf /var/www/html/${CSPID}
- fi
-
- mkdir /var/www/html/${CSPID}
- cp -R tmp/en-US/html-single/. /var/www/html/${CSPID}
-
- cp publican.log /var/www/html/${CSPID}
-
- # don't bother with the html or remark if the html-single failed
- if [ $PUBLICAN_STATUS == 0 ] && [ $CSP_STATUS == 0 ]
- then
- # Clean up
- rm -rf tmp
- rm publican.log
-
- # Do the html publican build
- echo 'publican build --formats=html --langs=en-US &> publican.log'
-
- publican build --formats=html --langs=en-US --config=publican-html.cfg &> publican.log
-
- if [ -d /var/www/html/${CSPID}/html ] || [ -e /var/www/html/${CSPID}/html ]
- then
- rm -rf /var/www/html/${CSPID}/html
- fi
-
- mkdir /var/www/html/${CSPID}/html
- cp -R tmp/en-US/html/. /var/www/html/${CSPID}/html
-
- cp publican.log /var/www/html/${CSPID}/html
-
- # Clean up
- rm -rf tmp
- rm publican.log
-
- # Do the remarks build
- echo 'publican build --formats=html-single --langs=en-US &> publican.log'
-
- publican build --formats=html-single --langs=en-US --config=publican-remarks.cfg &> publican.log
-
- if [ -d /var/www/html/${CSPID}/remarks ] || [ -e /var/www/html/${CSPID}/remarks ]
- then
- rm -rf /var/www/html/${CSPID}/remarks
- fi
-
- mkdir -p /var/www/html/${CSPID}/remarks
- cp -R tmp/en-US/html-single/. /var/www/html/${CSPID}/remarks
-
- cp publican.log /var/www/html/${CSPID}/remarks
-
- # Build the publican zip file without editor links
- DATE_MARKER=$(date '+%Y-%m-%dT%k:%M:%S.000%z')
- BOOK_FILE_NAME="${PUBLICAN_BOOK_ZIPS_COMPLETE}/${CSPID} ${DATE_MARKER}.zip"
-
- if [ -f "${BOOK_FILE_NAME}" ]
- then
- rm -rf "${BOOK_FILE_NAME}"
- fi
-
- echo "csprocessor build --output "${BOOK_FILE_NAME}" ${CSPID} >> build.log"
- csprocessor build --output "${BOOK_FILE_NAME}" ${CSPID} >> build.log
-
- fi
- popd
-
- # we only want to process one directory
- break
-
- done
-
- cp build.log /var/www/html/${CSPID}
- fi
-
- popd
-
-done
-
-# remove the lock file
-rm -f ${LOCK_FILE}
diff --git a/copy_js_files.sh~ b/copy_js_files.sh~
deleted file mode 100644
index 3b0686e..0000000
--- a/copy_js_files.sh~
+++ /dev/null
@@ -1,2 +0,0 @@
-cp -f javascript/overlay.js /var/www/html/javascript
-cp -f functions-1.1.js /var/www/html
\ No newline at end of file