| 1 |
#!/bin/sh |
| 2 |
# postinst script for grml-rescueboot |
| 3 |
|
| 4 |
set -e |
| 5 |
|
| 6 |
update_grub_wrapper() { |
| 7 |
# default, unless configured otherwise: |
| 8 |
ISO_LOCATION=/boot/grml |
| 9 |
|
| 10 |
if [ -r /etc/default/grml-rescueboot ] ; then |
| 11 |
. /etc/default/grml-rescueboot |
| 12 |
fi |
| 13 |
|
| 14 |
if ! ls "${ISO_LOCATION}"/*iso >/dev/null 2>&1 ; then |
| 15 |
echo "INFO: No *.iso files found inside ${ISO_LOCATION}." |
| 16 |
echo "INFO: Execute 'update-grml-rescueboot' to download and integrate a Grml ISO." |
| 17 |
return 0 |
| 18 |
fi |
| 19 |
|
| 20 |
if ! which update-grub >/dev/null 2>&1; then |
| 21 |
echo "WARN: ISOs found inside ${ISO_LOCATION} but update-grub not present (huh?)" |
| 22 |
return 0 |
| 23 |
fi |
| 24 |
|
| 25 |
if ! [ -e /boot/grub/grub.cfg ] ; then |
| 26 |
echo "WARN: ISOs found inside ${ISO_LOCATION} but /boot/grub/grub.cfg does not exist." |
| 27 |
echo "WARN: Ignoring request to run update-grub to avoid possible boot loader problems." |
| 28 |
return 0 |
| 29 |
fi |
| 30 |
|
| 31 |
echo "INFO: ISOs found inside ${ISO_LOCATION}, invoking update-grub:" |
| 32 |
update-grub |
| 33 |
} |
| 34 |
|
| 35 |
case "$1" in |
| 36 |
configure) |
| 37 |
update_grub_wrapper |
| 38 |
;; |
| 39 |
|
| 40 |
abort-upgrade|abort-remove|abort-deconfigure) |
| 41 |
;; |
| 42 |
|
| 43 |
*) |
| 44 |
echo "postinst called with unknown argument \`$1'" >&2 |
| 45 |
exit 1 |
| 46 |
;; |
| 47 |
esac |
| 48 |
|
| 49 |
#DEBHELPER# |
| 50 |
|
| 51 |
exit 0 |