Skip to content

Commit

Permalink
add discussed options for scripting support
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jan 24, 2024
1 parent 6a99bea commit 099a972
Showing 1 changed file with 125 additions and 0 deletions.
125 changes: 125 additions & 0 deletions autoinstallation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,131 @@ set -ex
You might want to have a look to [Agama's default script for inspiration](./scripts/auto.sh). Such a
script comes into action when you provide a profile.

### Custom Scripts Support

The goal of this section is to document examples and use cases for additional scripting support in agama autoinstall.

#### Changes Before Installation

##### Activation of Hardware

In some cases it is necessary to manually activate tricky devices before the installation starts. Examples are two network cards, one for external and one for internal network.

```sh
set -ex

/usr/bin/agama profile download ftp://my.server/tricky_hardware_setup.sh
sh tricky_hardware_setup.sh
/usr/bin/agama config set software.product=Tumbleweed
/usr/bin/agama config set user.userName=joe user.password=doe
/usr/bin/agama install
```

##### Modify the installation profile


For various reasons, jsonnet may not be able to handle all of the profile changes that users may wish to make.


```
set -ex
/usr/bin/agama profile download ftp://my.server/profile.json
# modify profile.json here
/usr/bin/agama profile validate profile.json
/usr/bin/agama config load profile.json
/usr/bin/agama install
```

#### After Partitioning

Note: not supported now ( params to install is not implemented yet )

##### Partitioning Changes

Sometimes there is a tricky partitioning that needs to be modified after partitioning and before installing RPMs, such as changing fstab and mounting an additional partition.


```sh
set -ex

/usr/bin/agama config set software.product=Tumbleweed

/usr/bin/agama config set user.userName=joe user.password=doe

/usr/bin/agama install --until partitioning # install till the partitioning step

# Place for specific modifications of /dev

/usr/bin/agama install # do the rest of the installation
```

#### After Deployment

Note: not supported now ( params to install is not implemented yet )

##### Setup Security


If there is a need to modify the system before rebooting, e.g. to install mandatory security software for internal network, then it must be modified before umount.


``` sh

set -ex

/usr/bin/agama profile download ftp://my.server/velociraptor.config

/usr/bin/agama config set software.product=Tumbleweed

/usr/bin/agama config set user.userName=joe user.password=doe

/usr/bin/agama install --until deploy # do partitioning, rpm installation and configuration step

# Example enablement of velociraptor

zypper --root /mnt install velociraptor-client

mkdir -p /mnt/etc/velociraptor
cp velociraptor.config /mnt/etc/velociraptor/client.config

systemctl --root /mnt enable velociraptor-client

/usr/bin/agama install # do the rest of the installation - basically unmount and copy logs

```

##### Tune Kernel

Another type of changes are changes that are mandatory for successful reboot like some kernel tuning or adding some remote storage that have to be mounted during boot.

``` sh

set -ex


/usr/bin/agama config set software.product=Tumbleweed

/usr/bin/agama config set user.userName=joe user.password=doe

/usr/bin/agama install --until deploy # do partitioning, rpm installation and configuration step

# Do custom modification to /mnt including call to dracut

/usr/bin/agama install # do the rest of the installation - basically unmount and copy logs

```

#### After Reboot

Users are just to do a lot of stuff using post install scripts in autoyast e.g. to call zypper with various modifications, modify configuration files or manipulate with systemd services. It is done after initial reboot.
If that is the case then agama will just delegate it to any other tool user prefers for initial configuration like ignition/combustion.

## Starting the auto-installation

The auto-installation is started by passing `agama.auto=<url>` on the kernel's command line. If you
Expand Down

0 comments on commit 099a972

Please sign in to comment.