[PATCH] deb to snap: use apt-pinning to install just the kernel from -proposed

Kleber Souza kleber.souza at canonical.com
Thu Oct 5 17:04:31 UTC 2017


On 09/27/2017 08:49 PM, Paolo Pisati wrote:
> In the target kernel branch (e.g. pc-kernel), enable the proposed
> repository and point the kernel version to the one present
> in proposed:
>
> --- a/snapcraft.yaml
> +++ b/snapcraft.yaml
> @@ -1,5 +1,5 @@
>  name: pc-kernel
> -version: 4.4.0.96.101
> +version: 4.4.0.97.102
>  summary: generic linux kernel
>  description: The generic Ubuntu kernel package as a snap
>  type: kernel
> @@ -13,6 +13,7 @@ parts:
>      plugin: make
>      make-parameters:
>        - KERNEL=linux-pc-image
> +      - PROPOSED=true
>      build-packages:
>        - debootstrap
>        - lsb-release
>
> Signed-off-by: Paolo Pisati <paolo.pisati at canonical.com>
> ---
>  Makefile | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 98c5a48..308d48c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -25,6 +25,24 @@ $(error linux-pc-image is a meta package only used in i386 or amd64, abort)
>  endif
>  endif
>
> +define APTPREF
> +Package: *
> +Pin: release a=$(RELEASE);
> +Pin-Priority: 700
> +
> +Package: *
> +Pin: release a=$(RELEASE)-updates
> +Pin-Priority: 700
> +
> +Package: *
> +Pin: release a=$(RELEASE)-security
> +Pin-Priority: 700
> +
> +Package: *
> +Pin: release a=$(RELEASE)-proposed
> +Pin-Priority: 650
> +endef
> +export APTPREF
>
>  install : KVERS = $(shell ls -1 chroot/boot/vmlinuz-*| tail -1 |sed 's/^.*vmlinuz-//;s/.efi.signed$$//')
>
> @@ -35,6 +53,7 @@ all:
>  	if [ "$(PROPOSED)" = "true" ]; then \
>  	  echo "deb http://$(MIRROR) $(RELEASE)-proposed main restricted" >> chroot/etc/apt/sources.list; \
>  	  echo "deb http://$(MIRROR) $(RELEASE)-proposed universe" >> chroot/etc/apt/sources.list; \
> +	  echo "$${APTPREF}" > chroot/etc/apt/preferences; \

It seems that writing to /etc/apt/preferences has become deprecated and 
it's recommended to create fragments under /etc/apt/preferences.d/ instead.

Apart from that the patch looks good to me.

>  	fi
>  	mkdir -p chroot/etc/initramfs-tools/conf.d
>  	echo "COMPRESS=lzma" >chroot/etc/initramfs-tools/conf.d/ubuntu-core.conf
>




More information about the kernel-team mailing list