5c7c30e590a20d5c879d4f4424669e711e847fd7
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 94-update-smart-drivedb
1 #!/bin/bash
2 # Filename:      ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/94-update-smart-drivedb
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 94-update-smart-drivedb as NO_ONLINE is set."
11   exit 0
12 fi
13
14 set -u
15 set -e
16
17 [ -x $target/usr/bin/timeout ] && TIMEOUT="10" || TIMEOUT=""
18
19 if ! [ -x ${target}/usr/sbin/update-smart-drivedb ] ; then
20   echo "Warning: smartmontools not installed"
21   exit 0
22 fi
23
24 echo "Updating smartmontool drivedb"
25 if [ -n "$TIMEOUT" ] ; then
26    if ! $ROOTCMD timeout $TIMEOUT update-smart-drivedb ; then
27      echo "Warning: failed to update smartmontool drivedb, ignoring failure"
28    fi
29 else
30    if ! $ROOTCMD update-smart-drivedb ; then
31      echo "Warning: failed to update smartmontool drivedb, ignoring failure"
32    fi
33 fi
34
35 ## END OF FILE #################################################################
36 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2