c85bc4ab407aa1d277f85b63978a42dca4c37656
[rrq/maintain_lilo.git] / hooks / kernel / postrm.d / zz-runlilo
1 #!/bin/sh
2 #
3 #  zz-runlilo - postrm script for modern kernel management
4 #
5 #  Copyright 2010-2014 Joachim Wiedorn
6 #  All rights reserved.
7 #
8 #  Licensed under the terms contained in the file 'COPYING'
9 #  in the source directory.
10 #
11
12 set -e
13 PAR=ever
14
15 # check for maintainer param
16 if [ -n "${DEB_MAINT_PARAMS}" ]; then
17         PAR=none
18         if [ `echo "${DEB_MAINT_PARAMS}" | grep -v abort | grep -c remove` -eq 1 ]
19         then PAR=remove; fi
20 fi
21
22 # check for configure|upgrade|remove|purge
23 case "$PAR" in
24
25   ever|remove)
26     # Run the boot loader installer
27     # and ignore error on degraded mdadm RAID1
28     if [ -f /sbin/lilo ]; then
29       if [ -f /etc/lilo.conf ]; then
30         # Do not abort kernel removal in case of error
31         lilo -H  </dev/null  >&2  || true
32       fi
33     fi
34     ;;
35
36 esac
37
38 # end of file