diff --git a/elements/gentoo/README.rst b/elements/gentoo/README.rst index ba4a2699..14b97b10 100644 --- a/elements/gentoo/README.rst +++ b/elements/gentoo/README.rst @@ -30,3 +30,7 @@ Notes: default/linux/amd64/13.0/no-multilib hardened/linux/amd64 hardened/linux/amd64/no-multilib + +* You can set the GENTOO_PORTAGE_CLEANUP environment variable to true (or + anything other than False) to clean up portage from the system and get the + image size smaller. diff --git a/elements/gentoo/environment.d/00-gentoo-distro-name.bash b/elements/gentoo/environment.d/00-gentoo-envars.bash similarity index 59% rename from elements/gentoo/environment.d/00-gentoo-distro-name.bash rename to elements/gentoo/environment.d/00-gentoo-envars.bash index ebfb67a2..65cf93d2 100755 --- a/elements/gentoo/environment.d/00-gentoo-distro-name.bash +++ b/elements/gentoo/environment.d/00-gentoo-envars.bash @@ -1,2 +1,3 @@ export DISTRO_NAME=gentoo export GENTOO_PROFILE=${GENTOO_PROFILE:-'default/linux/amd64/13.0'} +export GENTOO_PORTAGE_CLEANUP=${GENTOO_PORTAGE_CLEANUP:-'False'} diff --git a/elements/gentoo/gentoo-releng.gpg b/elements/gentoo/extra-data.d/gentoo-releng.gpg similarity index 100% rename from elements/gentoo/gentoo-releng.gpg rename to elements/gentoo/extra-data.d/gentoo-releng.gpg diff --git a/elements/gentoo/post-install.d/99-cleanup b/elements/gentoo/post-install.d/99-cleanup index c8614a0b..656b0a10 100755 --- a/elements/gentoo/post-install.d/99-cleanup +++ b/elements/gentoo/post-install.d/99-cleanup @@ -23,8 +23,11 @@ shopt -s extglob rm -Rf /tmp/!(ccache|in_target*|profiledir*) shopt -u extglob -rm -Rf /root/.ccache/* /usr/portage/* /usr/src/* /var/cache/edb/dep/* /var/cache/genkernel/* /var/empty/* /var/run/* /var/state/* /var/tmp/* /var/cache/portage/distfiles +rm -Rf /root/.ccache/* /usr/src/* /var/cache/edb/dep/* /var/cache/genkernel/* /var/empty/* /var/run/* /var/state/* /var/tmp/* rm -Rf /etc/*- /etc/*.old /etc/ssh/ssh_host_* /root/.*history /root/.lesshst /root/.ssh/known_hosts /root/.viminfo /usr/share/genkernel /usr/lib64/python*/site-packages/gentoolkit/test/eclean/testdistfiles.tar.gz +if [[ "${GENTOO_PORTAGE_CLEANUP}" != "False" ]]; then + rm -Rf /usr/portage/* /var/cache/portage/distfiles +fi # shrink a bit for i in $(find /var/log -type f); do echo > $i; done diff --git a/elements/gentoo/root.d/10-gentoo-image b/elements/gentoo/root.d/10-gentoo-image index 6b221824..66c18818 100755 --- a/elements/gentoo/root.d/10-gentoo-image +++ b/elements/gentoo/root.d/10-gentoo-image @@ -33,8 +33,6 @@ if ! [ 'x86_64' = "${ARCH}" ] ; then exit 1 fi -# get the element location so we can refrence things relative to it -ELEMENT_DIR=${ELEMENT_DIR:-"${ELEMENTS_PATH##*:}/gentoo"} # valid gentoo profiles are as follows # default/linux/amd64/13.0 # default/linux/amd64/13.0/no-multilib @@ -81,7 +79,7 @@ else # https://dev.gentoo.org/~dolsen/releases/keyrings/gentoo-keys-*.tar.xz # http://distfiles.gentoo.org/distfiles/gentoo-keys-*.tar.xz GPGDIR=$(mktemp -d -t) - gpg --no-default-keyring --keyring "${GPGDIR}"/gentookeys.gpg --import "${ELEMENT_DIR}"/gentoo-releng.gpg + gpg --no-default-keyring --keyring "${GPGDIR}"/gentookeys.gpg --import "${TMP_HOOKS_PATH}"/extra-data.d/gentoo-releng.gpg # check the sig file gpgv --keyring "${GPGDIR}"/gentookeys.gpg "${CACHED_SIGNATURE_FILE}" if [[ "${?}" != 0 ]]; then