diff options
author | James Thomas <james.thomas@codethink.co.uk> | 2014-11-20 12:22:18 +0000 |
---|---|---|
committer | James Thomas <james.thomas@codethink.co.uk> | 2014-11-20 12:22:18 +0000 |
commit | 7e9fc9e90b9f766cdd0bf7dbd142088dd604c1a5 (patch) | |
tree | 39642fa9f109e1ba32cca5fe567bf95da0a25c5a | |
parent | 61f116bc5367e8ba26e8fd0f48aa71e644cb9b1e (diff) | |
download | tbdiff-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-x | system-version-manager/system-version-manager | 15 |
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(): |