Re: OSTree <3 Anaconda

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 20, 2014 at 08:03:10PM +0000, Colin Walters wrote:
>      turnOnFilesystems(storage, mountOnly=flags.flags.dirInstall)
> -    if not flags.flags.livecdInstall and not flags.flags.dirInstall:
> +    write_storage_late = flags.flags.livecdInstall or ksdata.ostreesetup.osname
> +    if not write_storage_late and not flags.flags.dirInstall:
>          storage.write()
>  
>      # Do packaging.
> @@ -169,15 +179,30 @@ def doInstall(storage, payload, ksdata, instClass):
>      payload.preInstall(packages=packages, groups=payload.languageGroups())
>      payload.install()
>  
> -    if flags.flags.livecdInstall:
> -        storage.write()
> -
> -    with progress_report(_("Performing post-installation setup tasks")):
> -        payload.postInstall()
> -
> +    if write_storage_late:
> +        if iutil.getSysroot() != ROOT_PATH:
> +            blivet.targetSysroot = iutil.getSysroot()
> +            storage.write()
> +            # Now that we have the FS layout in the target,
> +            # umount things that were in the legacy sysroot,
> +            # and put them in the target root, except for the
> +            # physical /
> +            storage.umountFilesystems()
> +            rootmnt = storage.mountpoints.get('/')
> +            rootmnt.setup()
> +            # Explicitly mount the root on the physical sysroot
> +            rootmnt.format.setup(rootmnt.format.options, chroot=ROOT_PATH)
> +            # But everything else goes in the target root
> +            storage.mountFilesystems(skipRoot=True)
> +        else:
> +            storage.write()

You need to skip this if flags.flags.dirInstall is True, directory
install disables the storage code and probably also won't work with
OSTree.

> +    
>      # Do bootloader.
>      if not flags.flags.dirInstall:
>          with progress_report(_("Installing bootloader")):
>              writeBootLoader(storage, payload, instClass, ksdata)
>  
> +    with progress_report(_("Performing post-installation setup tasks")):
> +        payload.postInstall()

Why move this here instead of leaving it above writeBootLoader?

> +    def _safeExecWithRedirect(self, cmd, argv, **kwargs):
> +        """Like iutil.execWithRedirect, but treat errors as fatal"""
> +        rc = iutil.execWithRedirect(cmd, argv, **kwargs)
> +        if rc != 0:
> +            exn = PayloadInstallError("%s %s exited with code %d" % (cmd, argv, rc))
> +            if errorHandler.cb(exn) == ERROR_RAISE:
> +                raise exn

You may as well add this to iutil as another variation on ExecWith

> diff --git a/pyanaconda/users.py b/pyanaconda/users.py
> index d43ad29..e00460e 100644
> --- a/pyanaconda/users.py
> +++ b/pyanaconda/users.py
> @@ -192,7 +192,7 @@ class Users:
>          """
>  
>          childpid = os.fork()
> -        root = kwargs.get("root", "/mnt/sysimage")
> +        root = kwargs.get("root", iutil.getSysroot())
>  
>          if not childpid:
>              if not root in ["","/"]:
> @@ -258,7 +258,7 @@ class Users:
>                          available one is used.
>          """
>          childpid = os.fork()
> -        root = kwargs.get("root", "/mnt/sysimage")
> +        root = kwargs.get("root", iutil.getSysroot())
>  
>          if not childpid:
>              if not root in ["","/"]:
> @@ -358,12 +358,16 @@ class Users:
>          else:
>              return False
>  
> -    def checkUserExists(self, username, root="/mnt/sysimage"):
> +    def checkUserExists(self, username, root=None):
>          childpid = os.fork()
> +        if root is not None:
> +            rootval = root
> +        else:
> +            rootval = iutil.getSysroot()
>  
>          if not childpid:
> -            if not root in ["","/"]:
> -                os.chroot(root)
> +            if not rootval in ["","/"]:
> +                os.chroot(rootval)
>                  os.chdir("/")
>                  del(os.environ["LIBUSER_CONF"])

Looks like we have some duplicate code, it might be time to clean up
users.py a bit.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list




[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux