[gnome-continuous] libqa: Fix bootloader modification



commit fefb9def9be87cc63c73fa66d91e74eef7225555
Author: Colin Walters <walters verbum org>
Date:   Tue Oct 22 11:47:48 2013 -0400

    libqa: Fix bootloader modification
    
    There was an extra trailing / in the regexp for some reason.  Fix this
    code so we throw an error if we don't actually find anything to
    modify.

 src/js/libqa.js |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/js/libqa.js b/src/js/libqa.js
index faef912..ff6ce4e 100644
--- a/src/js/libqa.js
+++ b/src/js/libqa.js
@@ -172,16 +172,21 @@ function modifyBootloaderAppendKernelArgs(mntdir, kernelArgs, cancellable) {
     let lines = conf.split('\n');
     let modifiedLines = [];
     
+    let didModify = false;
     let kernelArg = kernelArgs.join(' ');
-    let kernelLineRe = /APPEND \//;
+    let kernelLineRe = /\tAPPEND /;
     for (let i = 0; i < lines.length; i++) {
        let line = lines[i];
        let match = kernelLineRe.exec(line);
-       if (!match)
+       if (!match) {
            modifiedLines.push(line);
-       else
+       } else {
            modifiedLines.push(line + ' ' + kernelArg);
+           didModify = true;
+       }
     }
+    if (!didModify)
+       throw new Error("Failed to find APPEND option in syslinux.cfg");
     let modifiedConf = modifiedLines.join('\n');
     confPath.replace_contents(modifiedConf, null, false,
                              Gio.FileCreateFlags.NONE,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]