[lxc-devel] [PATCH] Add 'config' option to lxc-archlinux template and fix getopt string

Stéphane Graber stgraber at ubuntu.com
Fri Jan 11 17:34:08 UTC 2013


On 01/11/2013 05:36 AM, Alexander Vladimirov wrote:
> This option allows user to control installation repository and options
> using alternative pacman configuration file.
> Also remove unnecessary sed invocation during container configuration.

What did you base this diff on?

patching file templates/lxc-archlinux.in
Hunk #1 FAILED at 31.
Hunk #2 FAILED at 113.
Hunk #3 FAILED at 165.
Hunk #4 FAILED at 183.
Hunk #5 FAILED at 190.
Hunk #6 FAILED at 204.
6 out of 6 hunks FAILED -- saving rejects to file
templates/lxc-archlinux.in.rej


Also, can you sign-off you changes please?

> ---
>  templates/lxc-archlinux.in | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/templates/lxc-archlinux.in b/templates/lxc-archlinux.in
> index 53e8e22..546369b 100644
> --- a/templates/lxc-archlinux.in
> +++ b/templates/lxc-archlinux.in
> @@ -31,7 +31,7 @@ lxc_network_link="br0"
>  default_path="@LXCPATH@"
>  default_locale="en-US.UTF-8"
>  default_timezone="UTC"
> -#host_mirror="http://mirrors.kernel.org/archlinux/\$repo/os/$arch"
> +pacman_config="/etc/pacman.conf"
>  
>  # sort of minimal package set
>  base_packages=(
> @@ -113,8 +113,8 @@ ln -s /dev/null /etc/systemd/system/systemd-udevd.service
>  ln -s /dev/null /etc/systemd/system/systemd-udevd-control.socket
>  ln -s /dev/null /etc/systemd/system/systemd-udevd-kernel.socket
>  ln -s /dev/null /etc/systemd/system/proc-sys-fs-binfmt_misc.automount
> +# set default systemd target
>  ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
> -sed -i 's/After=dev-%i.device/After=/' "/lib/systemd/system/getty at .service"
>  EOF
>      return 0
>  }
> @@ -165,7 +165,7 @@ EOF
>  
>  # install packages within container chroot
>  function install_arch {
> -    if ! pacstrap -cd "${rootfs_path}" ${base_packages[@]}; then
> +    if ! pacstrap -dcC "${pacman_config}" "${rootfs_path}" ${base_packages[@]}; then
>          echo "Failed to install container packages"
>          return 1
>      fi
> @@ -183,6 +183,7 @@ Mandatory args:
>  Optional args:
>    -p,--path         path to where the container rootfs will be created, defaults to ${default_path}/rootfs. The container config will go under ${default_path} in that case
>    -P,--packages     preinstall additional packages, comma-separated list
> +  -c,--config       use specified pacman config when installing container packages
>    -t,--network_type set container network interface type (${lxc_network_type})
>    -l,--network_link set network link device (${lxc_network_link})
>    -h,--help         print this help
> @@ -190,7 +191,7 @@ EOF
>      return 0
>  }
>  
> -options=$(getopt -o hp:P:n:cl:t: -l help,path:,packages:,name:,clean,network_type:,network_link: -- "${@}")
> +options=$(getopt -o hp:P:n:c:l:t: -l help,path:,packages:,name:,config:,network_type:,network_link: -- "${@}")
>  if [ ${?} -ne 0 ]; then
>      usage $(basename ${0})
>      exit 1
> @@ -204,6 +205,7 @@ do
>      -p|--path)          path=${2}; shift 2;;
>      -n|--name)          name=${2}; shift 2;;
>      -P|--packages)      additional_packages=${2}; shift 2;;
> +    -c|--config)        pacman_config=${2}; shift 2;;
>      -t|--network_type)  lxc_network_type=${2}; shift 2;;
>      -l|--network_link)  lxc_network_link=${2}; shift 2;;
>      --)             shift 1; break ;;
> 


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130111/418ac73a/attachment.pgp>


More information about the lxc-devel mailing list