[lxc-devel] patch lxc-archlinux so base_packages is built using the pacman.conf given with -c option

Serge Hallyn serge.hallyn at ubuntu.com
Fri Jun 26 13:07:37 UTC 2015


Quoting Peter Maloney (peter.maloney at yahoo.ca):
> Hi,
> 
> Here is a simple patch that makes sure the "base" is resolved for the
> given ${pacman_conf}, so it won't have nonexistent packages, like when
> building a 32 bit lxc, you don't want 32 bit support packages that are
> for 64 bit only.
> 
> To do that, I just added "${pacman_config"} in the options for when
> generating base_packages, and I also moved the generation to after the
> -c option is handled, so the pacman_config is known.
> 
> I needed to do this to build a 32 bit LXC container. Without it, some
> packages found in the base_package array do not exist in the
> repositories actually used to download ( Konsole output lib32-glibc and
> Konsole output lib32-tcp_wrappers are 2 examples) . I used the
> "/opt/arch32/pacman.conf" file created by "pacman -S devtools
> arch-install-scripts", (which I modified also to have no "multilib"
> section, which also doesn't belong on a 32 bit system, and makes the
> script fail when refreshing repositories... not sure whether or not to
> report that somewhere)
> 
> I tested the following 2 cases:
> 
> 
>     # ./lxc-archlinux -n arch32 -a i686 -c /opt/arch32/pacman.conf
> 
>     # ./lxc-archlinux -n arch32
> Konsole output

Hi - The lxc-archlinux file is a generated one, lxc-archlinux.in is
the one which needs to be patched.

Is there a way for the template to automatically determine the file
to use when building for 32-bit, so the user doesn't need to know where
it is?

> *I am not on the list, so be sure to CC me when replying.
> 
> *
> Peter*
> *

> --- /usr/share/lxc/templates/lxc-archlinux.orig	2015-06-20 09:51:02.778719562 +0200
> +++ /usr/share/lxc/templates/lxc-archlinux	2015-06-20 09:57:09.849332795 +0200
> @@ -50,9 +50,6 @@
>  # by default, install 'base' except the kernel
>  pkg_blacklist="linux"
>  base_packages=()
> -for pkg in $(pacman -Sqg base); do
> -   [ "${pkg_blacklist#*$pkg}" = "$pkg_blacklist" ] && base_packages+=($pkg)
> -done
>  declare -a additional_packages
>  
>  # split comma-separated string into an array
> @@ -231,6 +228,11 @@
>      esac
>  done
>  
> +# generate base_packages only after the -c option is handled
> +for pkg in $(pacman --config "${pacman_config}" -Sqg base); do
> +   [ "${pkg_blacklist#*$pkg}" = "$pkg_blacklist" ] && base_packages+=($pkg)
> +done
> +
>  if [ -z "${name}" ]; then
>      echo "missing required 'name' parameter"
>      exit 1

> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel



More information about the lxc-devel mailing list