From d85925f405834731db179efc2353b3725dcf5199 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Tue, 18 Jun 2013 16:10:42 +0100 Subject: Support upgrades in older running versions. Verify if are using and older extlinux configuration and upgrade it if the case, by checking if the "default" symbolic link exists on the target. Note that with the symbolic link we don't need to update extlinux configuration after an upgrade --- morphlib/exts/ssh-rsync.write | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/morphlib/exts/ssh-rsync.write b/morphlib/exts/ssh-rsync.write index 4348714c..1a921996 100755 --- a/morphlib/exts/ssh-rsync.write +++ b/morphlib/exts/ssh-rsync.write @@ -73,6 +73,17 @@ class SshRsyncWriteExtension(morphlib.writeexts.WriteExtension): self.install_remote_kernel(location, version_root, temp_root) default_path = os.path.join(remote_mnt, 'systems', 'default') + if self.bootloader_is_wanted(): + output = ssh_runcmd(location, ['sh', '-c', + 'test -e "$1" && stat -c %F "$1"' + ' || ' + 'echo missing file', + '-', default_path]) + if output != "symbolic link": + # we are upgrading and old system that does + # not have an updated extlinux config file + self.update_remote_extlinux(location, remote_mnt, + version_label) cliapp.ssh_runcmd(location, ['ln', '-s', '-f', version_label, default_path]) @@ -87,9 +98,6 @@ class SshRsyncWriteExtension(morphlib.writeexts.WriteExtension): pass raise e - if self.bootloader_is_wanted(): - self.update_remote_extlinux(location, remote_mnt, - version_label) except: raise else: -- cgit v1.2.1