chrootStep - ODEX-TOS/tos-installer-backend GitHub Wiki

A chroot is an execution step. It will execute a series of execution steps in a chrooted environment under a certain user. Lets take a look at the yaml

models:
  - chroots:
      - chroot:
          name: "alpha" # name of the user to chroot
          mount: "/media" # alternative mountpoint to chroot to
      - chroot:
          name: "root"
execution:
 - chroot:
     user: "root" # execute the next steps in the chrooted environment as a root user
     steps:
        - systemsetup: # perform the systemsetup step as a chrooted user
        - bootloader: "/dev/sda" # install the bootloader on a chrooted system as the root user
  - chroot:
      user: "alpha" # chroot as a different user than root
      steps:
        - packages: "userpackages" # execute the packages step as a non root user
        - script: "script1" # execute a script as a non root user

you need to add your execution steps under a chrooted environment if you want to execute command onto that environment.

Generally you do the following when preparing a system

  • build partitiontable
  • format and mount parititions
  • bootstrap base system and add fstab
  • chroot into mounted system
  • execute your changes inside a chrooted environment

In other words do everything in a chroot step except for preparations of a disk and installing a base copy of your linux environment