From 7e9fc9e90b9f766cdd0bf7dbd142088dd604c1a5 Mon Sep 17 00:00:00 2001 From: James Thomas Date: Thu, 20 Nov 2014 12:22:18 +0000 Subject: Check multiple locations for extlinux.conf 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 --- system-version-manager/system-version-manager | 15 +++++++++++++-- 1 file 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(): -- cgit v1.2.1