2021-06-20 09:31:58 +00:00
# Kickstart to RootFS Builder
This project provides the ability build `rootfs` file from `kickstart` input file in a docker/podman container environment. Output rootfs files can be used create base images for different OSs (AlmaLinux, Cent OS, Rocky Linux) etc.
2021-06-21 11:02:47 +00:00
2021-09-11 18:40:46 +00:00
## Building local
2021-06-21 11:02:47 +00:00
2021-09-11 18:40:46 +00:00
Two different variants of the image `almalinux/ks2rootfs` are avilable.
2021-06-23 16:56:33 +00:00
2021-09-11 18:40:46 +00:00
* [**`latest`** ](https://hub.docker.com/r/almalinux/ks2rootfs/tags?page=1&ordering=last_updated&name=latest )
* [**`livecd-tools`** ](https://hub.docker.com/r/almalinux/ks2rootfs/tags?page=1&ordering=last_updated&name=livecd-tools )
### Building `almalinux/ks2rootfs:latest` image tag
Use follwing command `latest` tag image to create `rootfs` files for `docker` and `WSL` images.
```sh
docker build -t almalinux/ks2rootfs -f Dockerfile .
```
### Building `almalinux/ks2rootfs:livecd-tools` image tag
Use follwing command `livecd-tools` tag image to create `SIG/LiveMedia ISO` images, check GitHub [repo ](https://github.com/AlmaLinux/sig-livemedia ).
2021-06-23 16:56:33 +00:00
```sh
2021-09-11 18:40:46 +00:00
docker build -t almalinux/ks2rootfs:livecd-tools -f Dockerfile.livecd .
2021-06-21 11:02:47 +00:00
```
2021-09-11 18:40:46 +00:00
## Using `almalinux/ks2rootfs:latest` image tag
Use `latest` tag image to create `rootfs` files for `docker` and `WSL` images.
### Using `lastet` Image tag
2021-06-21 11:02:47 +00:00
2021-09-11 18:40:46 +00:00
Run following command under `tests` folder. Test script kickstart files are available at `kickstarts` . **NOTE** : These scripts test use only. Official docker image kickstart files are avaialble in GitHub [docker-images ](https://github.com/AlmaLinux/docker-images ) repository.
2021-06-21 11:02:47 +00:00
2021-06-24 16:06:32 +00:00
Use command below to create `default` docker files
2021-06-23 16:56:33 +00:00
```sh
2021-06-21 11:02:47 +00:00
docker run --rm --privileged -v "$PWD:/build:z" \
2021-09-09 16:31:05 +00:00
-e KICKSTART_FILE=kickstarts/almalinux-8-default.x86_64.ks \
-e IMAGE_NAME=almalinux-8-docker-default.x86_64.tar.gz \
-e OUTPUT_DIR=default \
2021-09-11 17:08:32 +00:00
-e BUILD_TYPE=default \
2021-06-24 19:14:05 +00:00
almalinux/ks2rootfs
2021-06-24 04:00:10 +00:00
```
2021-09-11 17:08:32 +00:00
Use command below to create `base` docker files
2021-06-24 16:06:32 +00:00
2021-06-24 04:00:10 +00:00
```sh
docker run --rm --privileged -v "$PWD:/build:z" \
2021-09-11 17:08:32 +00:00
-e KICKSTART_FILE=kickstarts/almalinux-8-base.x86_64.ks \
-e IMAGE_NAME=almalinux-8-docker-base.x86_64.tar.gz \
-e OUTPUT_DIR=base \
-e BUILD_TYPE=base \
almalinux/ks2rootfs
```
Use command below to create `init` docker files
```sh
docker run --rm --privileged -v "$PWD:/build:z" \
-e KICKSTART_FILE=kickstarts/almalinux-8-init.x86_64.ks \
-e IMAGE_NAME=almalinux-8-docker-init.x86_64.tar.gz \
-e OUTPUT_DIR=init \
-e BUILD_TYPE=init \
2021-06-24 19:14:05 +00:00
almalinux/ks2rootfs
2021-06-21 11:02:47 +00:00
```
2021-06-23 16:56:33 +00:00
### Environment variables
Container startup script `ks2rootfs` supports multiple environment varible to customize the output. The environment variables and their use as follows
```sh
ENVIRONMENT VARIABLES:
======================
2021-09-09 16:31:05 +00:00
KICKSTART_FILE : Reuired - Input kickstart source file (.ks)
IMAGE_NAME : Required - Rootfs output file name
2021-06-24 04:00:10 +00:00
BUILD_WORK_DIR : Optional - Working dir for kickstart source and image destination. Defaults to current directory.
2021-09-09 16:31:05 +00:00
OUTPUT_DIR : Optional - Output directory name in working directory. Ddefault value is 'result'.
2021-09-11 17:08:32 +00:00
FLAG_OUTOUT_IN_PWD : Optional - Set this flag to true to write output files in current working directory. Default value is 'false'. When value is set to 'true', any value passed to 'OUTPUT_DIR' will be ignored.
FLAG_WRITE_META : Optional - Generate meta data about the kickstart build system. Default value is 'true'.
FLAG_RETAIN_LOG : Optional - When enabled, generated logs files retained under 'logs' output directory. Default value is 'false'.
BUILD_COMPTYPE : Optional - Build compression type default 'xz', 'gzip' and 'lzma'.
BUILD_TYPE : Optional - Build type 'base', 'default', 'init', 'micro', 'minimal' and 'wsl', Default value is 'default'.
2021-06-23 16:56:33 +00:00
USAGE:
ks2rootfs KICKSTART_FILE_NAME ROOTFS_FILE_NAME
EXAMPLES:
2021-09-11 18:40:46 +00:00
ks2rootfs os-minimal.ks os-minimal.tar.gz
2021-06-23 16:56:33 +00:00
```
2021-09-11 18:40:46 +00:00
## Using `almalinux/ks2rootfs:livecd-tools` Image
`livecd-tools` tag image to create `SIG/LiveMedia ISO` images, check GitHub [repo ](https://github.com/AlmaLinux/sig-livemedia ) for more detailed use.