1
0
mirror of https://github.com/AlmaLinux/ks2rootfs.git synced 2024-12-22 20:23:07 +00:00

minior fixes

Signed-off-by: Bala Raman <srbala@gmail.com>
This commit is contained in:
Bala Raman 2021-06-24 00:00:10 -04:00
parent 08e451d07a
commit 85a8b336bc
No known key found for this signature in database
GPG Key ID: 23A07BF21B5D6625
2 changed files with 31 additions and 18 deletions

View File

@ -9,7 +9,7 @@ Image yet ot published in `hub.docker.com`, until then use local build.
### Building local ### Building local
```sh ```sh
docker build -t srbala/ks2rootfs . docker build -t srbala/ks2rootfs:alma .
``` ```
### Using Image ### Using Image
@ -20,7 +20,16 @@ Following command under `tests` folder. Run command uses the `kickstarts/almalin
docker run --rm --privileged -v "$PWD:/build:z" \ docker run --rm --privileged -v "$PWD:/build:z" \
-e BUILD_KICKSTART=kickstarts/almalinux-8-default.x86_64.ks \ -e BUILD_KICKSTART=kickstarts/almalinux-8-default.x86_64.ks \
-e BUILD_ROOTFS=almalinux-8-default-docker.x86_64.tar.gz \ -e BUILD_ROOTFS=almalinux-8-default-docker.x86_64.tar.gz \
srbala/ks2rootfs -e BUILD_OUTDIR=default \
srbala/ks2rootfs:alma
```
```sh
docker run --rm --privileged -v "$PWD:/build:z" \
-e BUILD_KICKSTART=kickstarts/almalinux-8-minimal.x86_64.ks \
-e BUILD_ROOTFS=almalinux-8-minimal-docker.x86_64.tar.gz \
-e BUILD_OUTDIR=minimal \
srbala/ks2rootfs:alma
``` ```
### Environment variables ### Environment variables
@ -31,14 +40,15 @@ Container startup script `ks2rootfs` supports multiple environment varible to cu
ENVIRONMENT VARIABLES: ENVIRONMENT VARIABLES:
====================== ======================
BUILD_KICKSTART : Input kickstart source file (.ks) - Required BUILD_KICKSTART : Reuired - Input kickstart source file (.ks)
BUILD_ROOTFS : Rootfs output file name - Required BUILD_ROOTFS : Required - Rootfs output file name
BUILD_WORK_DIR : Optional - Working dir for kickstart source and image destination. Defaults to current directory.
BUILD_OUTDIR : Optional - Output directory name in working dir (default - 'result') - Optional
BUILD_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 `BUILD_OUTDIR` will be ignored.
BUILD_FLAG_WRITE_META : Optional - Generate meta data about the kickstart build system. Default value is true.
BUILD_FLAG_RETAIN_LOG : Optional - Retain generated output log files under 'logs' output directory. Default value is false.
BUILD_WORK_DIR : Working dir for kickstart source and image destination (default current directory) - Optional
BUILD_OUTDIR : Output directory name in working dir - Optional
BUILD_FLAG_OUTOUT_IN_PWD : 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 'BUILD_OUTDIR' will be ignored.
BUILD_FLAG_WRITE_META : Generate meta data about the kickstart build system - Optional
BUILD_FLAG_RETAIN_LOG : Retain generated output log files under 'logs' output directory - Optional
USAGE: USAGE:
ks2rootfs KICKSTART_FILE_NAME ROOTFS_FILE_NAME ks2rootfs KICKSTART_FILE_NAME ROOTFS_FILE_NAME

View File

@ -10,14 +10,14 @@ Script to create roofs file from a kickstart file using livemedia-creator
ENVIRONMENT VARIABLES: ENVIRONMENT VARIABLES:
====================== ======================
BUILD_KICKSTART : Input kickstart source file (.ks) - Required BUILD_KICKSTART : Reuired - Input kickstart source file (.ks)
BUILD_ROOTFS : Rootfs output file name - Required BUILD_ROOTFS : Required - Rootfs output file name
BUILD_WORK_DIR : Working dir for kickstart source and image destination (default current directory) - Optional BUILD_WORK_DIR : Optional - Working dir for kickstart source and image destination. Defaults to current directory.
BUILD_OUTDIR : Output directory name in working dir - Optional BUILD_OUTDIR : Optional - Output directory name in working dir (default - 'result') - Optional
BUILD_FLAG_OUTOUT_IN_PWD : 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 `BUILD_OUTDIR` will be ignored. BUILD_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 `BUILD_OUTDIR` will be ignored.
BUILD_FLAG_WRITE_META : Generate meta data about the kickstart build system - Optional BUILD_FLAG_WRITE_META : Optional - Generate meta data about the kickstart build system. Default value is true.
BUILD_FLAG_RETAIN_LOG : Retain generated output log files under 'logs' output directory - Optional BUILD_FLAG_RETAIN_LOG : Optional - Retain generated output log files under 'logs' output directory. Default value is false.
USAGE: USAGE:
ks2rootfs KICKSTART_FILE_NAME ROOTFS_FILE_NAME ks2rootfs KICKSTART_FILE_NAME ROOTFS_FILE_NAME
@ -118,6 +118,7 @@ livemedia-creator --logfile="/tmp/ks2rootfs.log" \
# copy rootfs to working dir # copy rootfs to working dir
cp -rp /var/tmp/${BUILD_ROOTFS} ${BUILD_OUTDIR}/${BUILD_ROOTFS} cp -rp /var/tmp/${BUILD_ROOTFS} ${BUILD_OUTDIR}/${BUILD_ROOTFS}
echo 'Copied disk image from /var/tmp/${BUILD_ROOTFS} to ${BUILD_OUTDIR}/${BUILD_ROOTFS}'
if [ ${BUILD_FLAG_WRITE_META} == 'true' ]; then if [ ${BUILD_FLAG_WRITE_META} == 'true' ]; then
# extract os-release info # extract os-release info
@ -133,6 +134,7 @@ if [ ${BUILD_FLAG_WRITE_META} == 'true' ]; then
fi fi
# save list of packages installed # save list of packages installed
jq .[] -r /tmp/dnf.cache/tempfiles.json | awk -F '/' '{print $5}' | sort > ${BUILD_OUTDIR}/pkgs-list jq .[] -r /tmp/dnf.cache/tempfiles.json | awk -F '/' '{print $5}' | sort > ${BUILD_OUTDIR}/pkgs-list
echo 'Writting meta data completed.'
else else
echo 'Skip writing meta data based on configuration.' echo 'Skip writing meta data based on configuration.'
fi fi
@ -140,9 +142,10 @@ fi
if [ ${BUILD_FLAG_RETAIN_LOG} == 'true' ]; then if [ ${BUILD_FLAG_RETAIN_LOG} == 'true' ]; then
rm -rf ${BUILD_LOGDIR} rm -rf ${BUILD_LOGDIR}
mkdir -p ${BUILD_LOGDIR} ${BUILD_LOGDIR}/anaconda mkdir -p ${BUILD_LOGDIR} ${BUILD_LOGDIR}/anaconda
echo "Copying logs to '${BUILD_LOGDIR}'" echo "Copying logs to '${BUILD_LOGDIR}' ..."
cp /tmp/ks2rootfs.log rm -rf ${BUILD_LOGDIR}/ks2rootfs.log cp /tmp/ks2rootfs.log rm -rf ${BUILD_LOGDIR}/ks2rootfs.log
cp -rp /tmp/anaconda/* ${BUILD_LOGDIR}/anaconda cp -rp /tmp/anaconda/* ${BUILD_LOGDIR}/anaconda
echo 'Copying logs completed.'
else else
echo 'Skip writing logs data based on configuration (default). ' echo 'Skip copying logs data based on configuration (default). '
fi fi