summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Gomes <tiago.gomes@codethink.co.uk>2013-06-18 16:10:42 +0100
committerTiago Gomes <tiago.gomes@codethink.co.uk>2013-06-14 22:31:22 +0000
commitd85925f405834731db179efc2353b3725dcf5199 (patch)
tree2a51605784e2a8213d4f571d7500d954c096fe02
parent301f27f3b709914729655ac269f014a3137cb035 (diff)
downloadmorph-d85925f405834731db179efc2353b3725dcf5199.tar.gz
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
-rwxr-xr-xmorphlib/exts/ssh-rsync.write14
1 files 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: