44 lines
1.6 KiB
Text
Executable file
44 lines
1.6 KiB
Text
Executable file
|
|
IMAGE_NAME=$1
|
|
RELEASEVER=$2
|
|
BASE_IMAGE="localhost/centos-micro:stream${RELEASEVER}"
|
|
|
|
if [[ "${RELEASEVER}" == "9" ]]; then
|
|
CENTOS_RELEASE_REPOS="http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-9.0-18.el9.noarch.rpm"
|
|
CENTOS_RELEASE="http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-stream-release-9.0-18.el9.noarch.rpm"
|
|
CENTOS_GPG="http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-9.0-18.el9.noarch.rpm"
|
|
elif [[ "${RELEASEVER}" == "8" ]]; then
|
|
CENTOS_RELEASE_REPOS="http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-8-6.el8.noarch.rpm"
|
|
CENTOS_RELEASE="http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-stream-release-8.6-1.el8.noarch.rpm"
|
|
CENTOS_GPG="http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-6.el8.noarch.rpm"
|
|
else
|
|
echo "Stream ${RELEASEVER} is not supported"
|
|
exit 1
|
|
fi
|
|
|
|
function add_port {
|
|
buildah config --port $1 $CONTAINER
|
|
}
|
|
|
|
function add_cmd {
|
|
buildah config --cmd "$1" $CONTAINER
|
|
}
|
|
|
|
function bootstrap_env {
|
|
# Create a container
|
|
CONTAINER=$(buildah from $1)
|
|
# Mount the container filesystem
|
|
MOUNTPOINT=$(buildah mount $CONTAINER)
|
|
}
|
|
|
|
function clean {
|
|
dnf clean all -y --installroot $MOUNTPOINT --releasever $RELEASEVER
|
|
rm -rf ${MOUNTPOINT}/usr/share/locale
|
|
rm -rf ${MOUNTPOINT}/usr/share/misc
|
|
rm -rf ${MOUNTPOINT}/usr/share/man
|
|
rm -rf ${MOUNTPOINT}/usr/share/zoneinfo
|
|
rm -rf ${MOUNTPOINT}/usr/share/X11/locale
|
|
rm -rf ${MOUNTPOINT}/usr/share/doc
|
|
rm -rf ${MOUNTPOINT}/usr/share/fonts
|
|
}
|
|
|