diff options
-rw-r--r-- | plugins/grub/grub.py | 7 | ||||
-rw-r--r-- | plugins/grub/grubUtils.py | 17 |
2 files changed, 21 insertions, 3 deletions
diff --git a/plugins/grub/grub.py b/plugins/grub/grub.py index ab200a0..63df699 100644 --- a/plugins/grub/grub.py +++ b/plugins/grub/grub.py @@ -158,7 +158,7 @@ class Grub(Plugin): for part in parts: self.install_grub_parts.append(Dname(part)) - else: + elif self.args.install_auto: # Skip devices with other bootloader (default). for (dev, parts) in self.devices.iteritems(): @@ -177,6 +177,11 @@ class Grub(Plugin): "in %s partition." % Dname.asPath(part), \ origin = self) self.install_grub_parts.append(Dname(part)) + else: + # If not arguments where specified the right thing to do is to + # leave everything alone:) + self.install_grub_parts = [] + self.install_grub_devs = [] self._result = ReturnSuccess except Exception, e: diff --git a/plugins/grub/grubUtils.py b/plugins/grub/grubUtils.py index bbc68b3..61be4c5 100644 --- a/plugins/grub/grubUtils.py +++ b/plugins/grub/grubUtils.py @@ -355,6 +355,8 @@ def get_grub_opts(args): this option, we will prefer the list described in install-to. + --install-auto : This will try to avoid overwriting other bootloaders. + We will return a object with all de relative information. """ @@ -362,6 +364,7 @@ def get_grub_opts(args): class grub_args: install_all = False install_to = [] + install_auto = False retval = grub_args() # Parse the args string @@ -379,11 +382,21 @@ def get_grub_opts(args): for (opt, val) in opts: if opt == "--install-all" and len(retval.install_to) == 0: - retval.install_all = True + if len(retval.install_to) == 0 + retval.install_all = True + retval.install_auto = False if opt == "--install-to": - retval.install_all = False retval.install_to = val.split(',') + retval.install_all = False + retval.install_auto = False + + + if opt == "--install-auto": + if len(retval.args.install_to) == 0 and \ + not retval.args.install_all: + retval.args.install_auto = True + return retval |