GRMLBASE/52-mdadm: fix path for 64-md-raid-assembly.rules
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 91-update-pciids
1 #!/bin/bash
2 # Filename:      ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/91-update-pciids
3 # Purpose:       update pciids
4 # Authors:       (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2.
7 ################################################################################
8
9 if ifclass NO_ONLINE ; then
10   echo "Ignoring script 91-update-pciids as NO_ONLINE is set."
11   exit 0
12 fi
13
14 set -u
15
16 bailout() {
17   if [ "${1:-}" = "4" ] ; then
18     echo "Warning: update-pciids returned with exit code 4." >&2
19
20     # be verbose in logs
21     echo "Warning: update-pciids returned with exit code 4."
22     echo "-> This indicates that networking inside the chroot did not work"
23     echo "   while GRMLBASE/91-update-pciids was running."
24     echo "   To address this issue you can either configure /etc/resolv.conf"
25     echo "   accordingly or just run dnsmasq on your host."
26
27     exit 0
28   fi
29
30   exit "${1:-0}"
31 }
32
33
34 [ -x $target/usr/bin/timeout ] && TIMEOUT="10" || TIMEOUT=""
35
36 if ! [ -x $target/usr/bin/update-pciids ] ; then
37   echo "Warning: update-pciids not installed"
38   exit 0
39 fi
40
41 echo "Updating PCI-IDs"
42 if [ -n "$TIMEOUT" ] ; then
43    $ROOTCMD timeout $TIMEOUT update-pciids
44    bailout $?
45 else
46    $ROOTCMD update-pciids
47    bailout $?
48 fi
49
50 ## END OF FILE #################################################################
51 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2