[3/4 anaconda] Modify --dirinstall to take a path

Vratislav Podzimek vpodzime at redhat.com
Thu Jun 26 05:35:55 UTC 2014


On Wed, 2014-06-25 at 11:32 -0700, Brian C. Lane wrote:
> This modifies --dirinstall so that the target path can be passed
> directly. It retains the environmental variable support for backwards
> compatibility.
> 
> --dirinstall with no arguments will install to /mnt/sysimage/
> --dirinstall with ANACONDA_ROOT_PATH environmental variable set will
> install to the specified directory.
> --dirinstall=<path> will install to the <path>
> ---
>  anaconda | 25 ++++++++++++++++---------
>  1 file changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/anaconda b/anaconda
> index a725e09..243ee2b 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -338,7 +338,7 @@ def parseArguments(argv=None, boot_cmdline=None):
>                      metavar="UPDATES_URL", help=help_parser.help_text("updates"))
>      ap.add_argument("--image", action="append", dest="images", default=[],
>                      metavar="IMAGE_SPEC", help=help_parser.help_text("image"))
> -    ap.add_argument("--dirinstall", action="store_true", default=False,
> +    ap.add_argument("--dirinstall", nargs="?", const=True, default=False,
>                      help=help_parser.help_text("dirinstall"))
>      ap.add_argument("--memcheck", action="store_true", default=True,
>                      help=help_parser.help_text("memcheck"))
> @@ -790,14 +790,6 @@ if __name__ == "__main__":
>          stdoutLog.error("anaconda must be run as root.")
>          sys.exit(0)
>  
> -    if opts.images and opts.dirinstall:
> -        stdoutLog.error("--images and --dirinstall cannot be used at the same time")
> -        sys.exit(0)
> -    elif opts.images:
> -        flags.imageInstall = True
> -    elif opts.dirinstall:
> -        flags.dirInstall = True
> -
>      # see if we're on s390x and if we've got an ssh connection
>      uname = os.uname()
>      if uname[4] == 's390x':
> @@ -825,6 +817,21 @@ if __name__ == "__main__":
>      import signal, string
>  
>      from pyanaconda import iutil
> +
> +    if opts.images and opts.dirinstall:
> +        stdoutLog.error("--images and --dirinstall cannot be used at the same time")
> +        sys.exit(0)
While moving this, could you please change it to sys.exit(1) so that we
don't return the OK exit code when it actually was not OK?

-- 
Vratislav Podzimek

Anaconda Rider | RHCE | Red Hat, Inc. | Brno - Czech Republic




More information about the anaconda-patches mailing list