[PATCH 12/14] Allow the location of anaconda_options.txt to be overridden

Martin Kolman mkolman at redhat.com
Thu Aug 21 20:10:33 UTC 2014


From: David Shea <dshea at redhat.com>

Check for an environment variable ANACONDA_DATADIR, and if not set fall
back to /usr/share/anaconda. Allow relative paths in HelpTextParser to
make using the environment variable easier. Anaconda doesn't chdir
anywhere so using relative paths should be ok.

(cherry picked from commit fd3541537a4e63174a6fc39b37365ca1e090157c)

Related: rhbz:#1088459
Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 anaconda                        | 4 +++-
 pyanaconda/anaconda_argparse.py | 2 --
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/anaconda b/anaconda
index 3a90690..959df78 100755
--- a/anaconda
+++ b/anaconda
@@ -217,13 +217,15 @@ def parseArguments(argv=None, boot_cmdline=None):
     from pyanaconda.anaconda_argparse import AnacondaArgumentParser
     from pyanaconda.anaconda_argparse import HelpTextParser
 
+    datadir = os.environ.get("ANACONDA_DATADIR", "/usr/share/anaconda")
+
     # NOTE: for each long option (like '--repo'), AnacondaOptionParser
     # checks the boot arguments for bootarg_prefix+option ('inst.repo').
     # If require_prefix is False, it also accepts the option without the
     # bootarg_prefix ('repo').
     # See anaconda_optparse.py and BootArgs (in flags.py) for details.
     ap = AnacondaArgumentParser(bootarg_prefix="inst.", require_prefix=False)
-    help_parser = HelpTextParser("/usr/share/anaconda/anaconda_options.txt")
+    help_parser = HelpTextParser(os.path.join(datadir, "anaconda_options.txt"))
 
     # NOTE: store_false options will *not* get negated when the user does
     # "option=0" on the boot commandline (store_true options do, though).
diff --git a/pyanaconda/anaconda_argparse.py b/pyanaconda/anaconda_argparse.py
index b6ffa92..c5dc78d 100644
--- a/pyanaconda/anaconda_argparse.py
+++ b/pyanaconda/anaconda_argparse.py
@@ -295,8 +295,6 @@ class HelpTextParser(object):
         """ Initializer
             :param path: The absolute path to the help text file
         """
-        if not os.path.isabs(path):
-            raise ValueError("path %s is not an absolute path" % path)
         self._path = path
 
         self._help_text = None
-- 
1.9.3



More information about the anaconda-patches mailing list