Skip to content
Ben Cambourne edited this page Jul 11, 2020 · 1 revision

These helpers are documented in the template docker image build.sh. The template build.sh also has instructions on examples of installing packages manually, or removing packages, which haven’t been replicated here. This wiki page is focused on the kubler specific helpers.

Update a Gentoo package use flag (update_use)

update_use 'dev-libs/some-lib' '+feature' '-some_other_feature'

Update a Gentoo package keyword (update_keywords)

update_keywords 'dev-lang/some-package' '+~amd64'

Add a package to Portage’s package.provided file, effectively skipping it during installation (provide_package)

provide_package 'dev-lang/some-package'

Remove a package from Portage’s package.provided file (unprovide_package)::

This can be useful to install a package from a parent image again, it may be needed at build time

unprovide_package 'dev-lang/some-package'

Initialise Kubler image PACKAGES.md (init_docs)

Only needed when ${_packages} is empty, initializes PACKAGES.md

init_docs "${_tmpl_namespace}/${_tmpl_image_name}"

sed_or_die

Thin wrapper for sed that fails the build if no match was found, default sed delimiter is %

sed-or-die '^foo' 'replaceval' "${_EMERGE_ROOT}"/etc/foo.conf

download_file

Download file at url to /distfiles if it doesn’t exist yet, file name is derived from last url fragment

download_file "$url"`
echo "${__download_file}"
# Same as above but set a custom file name
download_file "$url" my_file_v1.tar.gz
# Same as above but pass arbitrary additional args to curl
download_file "$url" my_file_v1.tar.gz '-v' '--cookie' 'foo'

Install su-exec at ${_EMERGE_ROOT} (`install_suexec)

install_suexec

Copy C++ libs

This may be needed if you see errors regarding missing libstdc++

copy_gcc_libs

Manually Log an Installed Package (log_as_installed)

After installing packages manually you might want to add an entry to PACKAGES.md

log_as_installed "manual install" "${_tmpl_image_name}-${_${_tmpl_image_name}_version}" "https://${_tmpl_image_name}.org/"