File: postinst

package info (click to toggle)
grml-rescueboot 0.5.0
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 88 kB
  • sloc: sh: 272; xml: 73; makefile: 13
file content (51 lines) | stat: -rw-r--r-- 1,187 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
# postinst script for grml-rescueboot

set -e

update_grub_wrapper() {
  # default, unless configured otherwise:
  ISO_LOCATION=/boot/grml

  if [ -r /etc/default/grml-rescueboot ] ; then
    . /etc/default/grml-rescueboot
  fi

  if ! ls "${ISO_LOCATION}"/*iso >/dev/null 2>&1 ; then
    echo "INFO: No *.iso files found inside ${ISO_LOCATION}."
    echo "INFO: Execute 'update-grml-rescueboot' to download and integrate a Grml ISO."
    return 0
  fi

  if ! which update-grub >/dev/null 2>&1; then
    echo "WARN: ISOs found inside ${ISO_LOCATION} but update-grub not present (huh?)"
    return 0
  fi

  if ! [ -e /boot/grub/grub.cfg ] ; then
    echo "WARN: ISOs found inside ${ISO_LOCATION} but /boot/grub/grub.cfg does not exist."
    echo "WARN: Ignoring request to run update-grub to avoid possible boot loader problems."
    return 0
  fi

  echo "INFO: ISOs found inside ${ISO_LOCATION}, invoking update-grub:"
  update-grub
}

case "$1" in
    configure)
      update_grub_wrapper
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

#DEBHELPER#

exit 0