diff --git a/elements/fedora/element-deps b/elements/fedora/element-deps index 386e1730..d04ce43d 100644 --- a/elements/fedora/element-deps +++ b/elements/fedora/element-deps @@ -2,3 +2,4 @@ dib-run-parts dracut-network cache-url dkms +yum diff --git a/elements/yum/README.md b/elements/yum/README.md new file mode 100644 index 00000000..b38a94fe --- /dev/null +++ b/elements/yum/README.md @@ -0,0 +1,10 @@ +Provide yum specific image building glue. + +RHEL/Fedora/CentOS and other yum based distributions need specific yum +customizations. + +Customizations include caching of downloaded yum packages outside of the build +chroot so that they can be reused by subsequent image builds. The cache +increases image building speed when building multiple images, especially on +slow connections. This is more effective than using an HTTP proxy as a yum +cache since the same rpm from different mirrors is often requested. diff --git a/elements/yum/pre-install.d/01-yum-keepcache b/elements/yum/pre-install.d/01-yum-keepcache new file mode 100755 index 00000000..2ada3e0b --- /dev/null +++ b/elements/yum/pre-install.d/01-yum-keepcache @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +[ -n "TARGET_ROOT" ] + +sudo sed -i 's/keepcache=0/keepcache=1/' $TARGET_ROOT/etc/yum.conf +sudo sed -i 's/cachedir=\/var\/cache\/yum/cachedir=\/tmp\/yum/' $TARGET_ROOT/etc/yum.conf diff --git a/elements/yum/root.d/50-yum-cache b/elements/yum/root.d/50-yum-cache new file mode 100755 index 00000000..f7dd9247 --- /dev/null +++ b/elements/yum/root.d/50-yum-cache @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +[ -n "TARGET_ROOT" ] + +YUM_CACHE_DIR=~/.cache/image-create/yum +mkdir -p $YUM_CACHE_DIR + +sudo mkdir -p $TMP_MOUNT_PATH/tmp/yum +sudo mount --bind $YUM_CACHE_DIR $TMP_MOUNT_PATH/tmp/yum