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
commit251d6a684eda959057810e736184eac316e80c75 (patch)
treedbf61b65892c94933dd4aa79fb7fe9a67c030a8c
parent64b72cdc4ae7a0d376239f31d1e607bae9d8d602 (diff)
downloaddefinitions-251d6a684eda959057810e736184eac316e80c75.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-xssh-rsync.write14
1 files changed, 11 insertions, 3 deletions
diff --git a/ssh-rsync.write b/ssh-rsync.write
index 4348714c..1a921996 100755
--- a/ssh-rsync.write
+++ b/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: