summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Thomas <james.thomas@codethink.co.uk>2014-11-20 12:22:18 (GMT)
committerJames Thomas <james.thomas@codethink.co.uk>2014-11-20 12:22:18 (GMT)
commit7e9fc9e90b9f766cdd0bf7dbd142088dd604c1a5 (patch)
tree39642fa9f109e1ba32cca5fe567bf95da0a25c5a
parent61f116bc5367e8ba26e8fd0f48aa71e644cb9b1e (diff)
downloadtbdiff-7e9fc9e90b9f766cdd0bf7dbd142088dd604c1a5.tar.gz
Check multiple locations for extlinux.confbaserock/james/add_boot_device
U-boot wants the extlinux.conf to be in /extlinux/extlinux.conf, rather than /, so if we don't find it there, search in /extlinux
-rwxr-xr-xsystem-version-manager/system-version-manager15
1 files changed, 13 insertions, 2 deletions
diff --git a/system-version-manager/system-version-manager b/system-version-manager/system-version-manager
index 2f46dfc..554e459 100755
--- a/system-version-manager/system-version-manager
+++ b/system-version-manager/system-version-manager
@@ -100,11 +100,22 @@ class SystemVersionManager(object):
if os.path.isdir(os.path.join(systems, filename))
and not os.path.islink(os.path.join(systems, filename))]
+ # U-boot expects extlinux.conf to be in an extlinux subfolder, so also
+ # check for this if /extlinux.conf isn't found
+ def _get_extlinux_path(self):
+ file_paths = ['extlinux.conf','extlinux/extlinux.conf']
+ for path in file_paths:
+ extlinux_path = os.path.join(self.boot_dir, path)
+ if os.path.isfile(extlinux_path):
+ return extlinux_path
+ raise AppException(
+ "No extlinux.conf file found")
+
# To check which system is the default one, it checks the 'ontimeout'
# value in the extlinux.conf file. If it's not present, then pick
# the first of the present systems.
def _get_default(self):
- extlinux = os.path.join(self.boot_dir, 'extlinux.conf')
+ extlinux = os.path.join(self.boot_dir, self._get_extlinux_path())
with open(extlinux, 'r') as f:
for line in f:
line = line.rstrip('\n')
@@ -146,7 +157,7 @@ class SystemVersionManager(object):
# Logic copied from morphlib.SaveFile to not create
# a morphlib dependency.
fd, temp_config = tempfile.mkstemp(dir=self.boot_dir)
- config = os.path.join(self.boot_dir, 'extlinux.conf')
+ config = os.path.join(self.boot_dir, self._get_extlinux_path())
with os.fdopen(fd, 'w') as f:
# If theres no menu.c32 file, add a menu to the extlinux.conf file
if self._check_system_syslinux():