[elbe-devel] [PATCH] debianize: add pre/post inst/rm scripts for kernel

Manuel Traut manuel.traut at linutronix.de
Thu Jul 28 10:21:38 CEST 2016


merged! Thx a lot! :))

On 08:59 Thu 28 Jul     , John Ogness wrote:
> Basic scripts to call the /etc/kernel/* hooks are added. This
> allows automatic initrd and grub updates during install and
> remove.
> 
> Signed-off-by: John Ogness <john.ogness at linutronix.de>
> ---
>  debian/elbe-debianize.install                     |  4 ++++
>  elbepack/debianize/kernel.py                      |  2 +-
>  elbepack/makofiles/debianize/kernel/postinst.mako | 12 ++++++++++++
>  elbepack/makofiles/debianize/kernel/postrm.mako   | 12 ++++++++++++
>  elbepack/makofiles/debianize/kernel/preinst.mako  | 12 ++++++++++++
>  elbepack/makofiles/debianize/kernel/prerm.mako    | 12 ++++++++++++
>  6 files changed, 53 insertions(+), 1 deletion(-)
>  create mode 100755 elbepack/makofiles/debianize/kernel/postinst.mako
>  create mode 100755 elbepack/makofiles/debianize/kernel/postrm.mako
>  create mode 100755 elbepack/makofiles/debianize/kernel/preinst.mako
>  create mode 100755 elbepack/makofiles/debianize/kernel/prerm.mako
> 
> diff --git a/debian/elbe-debianize.install b/debian/elbe-debianize.install
> index 5caeb66..45b9ee7 100644
> --- a/debian/elbe-debianize.install
> +++ b/debian/elbe-debianize.install
> @@ -11,3 +11,7 @@
>  ./usr/lib/python2.*/*-packages/elbepack/makofiles/debianize/kernel/control.mako
>  ./usr/lib/python2.*/*-packages/elbepack/makofiles/debianize/kernel/format.mako
>  ./usr/lib/python2.*/*-packages/elbepack/makofiles/debianize/kernel/linux-headers.install
> +./usr/lib/python2.*/*-packages/elbepack/makofiles/debianize/kernel/preinst.mako
> +./usr/lib/python2.*/*-packages/elbepack/makofiles/debianize/kernel/postinst.mako
> +./usr/lib/python2.*/*-packages/elbepack/makofiles/debianize/kernel/prerm.mako
> +./usr/lib/python2.*/*-packages/elbepack/makofiles/debianize/kernel/postrm.mako
> diff --git a/elbepack/debianize/kernel.py b/elbepack/debianize/kernel.py
> index 77b49dc..f3916f8 100644
> --- a/elbepack/debianize/kernel.py
> +++ b/elbepack/debianize/kernel.py
> @@ -68,7 +68,7 @@ class Kernel (DebianizeBase):
>          self.tmpl_dir = os.path.join(mako_template_dir, 'debianize/kernel')
>          pkg_name = self.deb['p_name']+'-'+self.deb['k_version']
>  
> -        for tmpl in ['control', 'rules']:
> +        for tmpl in ['control', 'rules', 'preinst', 'postinst', 'prerm', 'postrm']:
>              with open (os.path.join('debian/', tmpl), 'w') as f:
>                  mako = os.path.join(self.tmpl_dir, tmpl+'.mako')
>                  f.write (template(self.deb, mako))
> diff --git a/elbepack/makofiles/debianize/kernel/postinst.mako b/elbepack/makofiles/debianize/kernel/postinst.mako
> new file mode 100755
> index 0000000..c2b43b7
> --- /dev/null
> +++ b/elbepack/makofiles/debianize/kernel/postinst.mako
> @@ -0,0 +1,12 @@
> +#!/bin/sh
> +
> +set -e
> +
> +# Pass maintainer script parameters to hook scripts
> +export DEB_MAINT_PARAMS="$*"
> +
> +# Tell initramfs builder whether it's wanted
> +export INITRD=Yes
> +
> +test -d /etc/kernel/postinst.d && run-parts --arg="${k_version}-${p_name}" --arg="/boot/vmlinuz-${k_version}-${p_name}" /etc/kernel/postinst.d
> +exit 0
> diff --git a/elbepack/makofiles/debianize/kernel/postrm.mako b/elbepack/makofiles/debianize/kernel/postrm.mako
> new file mode 100755
> index 0000000..252fc3c
> --- /dev/null
> +++ b/elbepack/makofiles/debianize/kernel/postrm.mako
> @@ -0,0 +1,12 @@
> +#!/bin/sh
> +
> +set -e
> +
> +# Pass maintainer script parameters to hook scripts
> +export DEB_MAINT_PARAMS="$*"
> +
> +# Tell initramfs builder whether it's wanted
> +export INITRD=Yes
> +
> +test -d /etc/kernel/postrm.d && run-parts --arg="${k_version}-${p_name}" --arg="/boot/vmlinuz-${k_version}-${p_name}" /etc/kernel/postrm.d
> +exit 0
> diff --git a/elbepack/makofiles/debianize/kernel/preinst.mako b/elbepack/makofiles/debianize/kernel/preinst.mako
> new file mode 100755
> index 0000000..bff9cd2
> --- /dev/null
> +++ b/elbepack/makofiles/debianize/kernel/preinst.mako
> @@ -0,0 +1,12 @@
> +#!/bin/sh
> +
> +set -e
> +
> +# Pass maintainer script parameters to hook scripts
> +export DEB_MAINT_PARAMS="$*"
> +
> +# Tell initramfs builder whether it's wanted
> +export INITRD=Yes
> +
> +test -d /etc/kernel/preinst.d && run-parts --arg="${k_version}-${p_name}" --arg="/boot/vmlinuz-${k_version}-${p_name}" /etc/kernel/preinst.d
> +exit 0
> diff --git a/elbepack/makofiles/debianize/kernel/prerm.mako b/elbepack/makofiles/debianize/kernel/prerm.mako
> new file mode 100755
> index 0000000..a5edf4b
> --- /dev/null
> +++ b/elbepack/makofiles/debianize/kernel/prerm.mako
> @@ -0,0 +1,12 @@
> +#!/bin/sh
> +
> +set -e
> +
> +# Pass maintainer script parameters to hook scripts
> +export DEB_MAINT_PARAMS="$*"
> +
> +# Tell initramfs builder whether it's wanted
> +export INITRD=Yes
> +
> +test -d /etc/kernel/prerm.d && run-parts --arg="${k_version}-${p_name}" --arg="/boot/vmlinuz-${k_version}-${p_name}" /etc/kernel/prerm.d
> +exit 0
> -- 
> 2.8.1
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://linutronix.de/mailman/listinfo/elbe-devel

-- 
   Manuel Traut

------------------------------------------------
Linutronix GmbH

fon +49 7556 919 891

Firmensitz: D-88690 Uhldingen, Bahnhofstraße 3
Registergericht: Freiburg i. Br., HRB 700 806;
Geschäftsführer: Heinz Egger, Thomas Gleixner




More information about the elbe-devel mailing list