Skip to content

Commit

Permalink
scripts: assume timeout is always available
Browse files Browse the repository at this point in the history
Debian buster has timeout in coreutils, which is Essential: yes.
  • Loading branch information
zeha committed Nov 26, 2024
1 parent 02129af commit 14d0405
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 27 deletions.
10 changes: 2 additions & 8 deletions etc/grml/fai/config/scripts/GRMLBASE/91-update-pciids
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,15 @@ bailout() {
}


[ -x $target/usr/bin/timeout ] && TIMEOUT="10" || TIMEOUT=""

if ! [ -x "${target}/usr/sbin/update-pciids" ] && ! [ -x "${target}/usr/bin/update-pciids" ] ; then
echo "Warning: update-pciids not installed (neither /usr/sbin/update-pciids nor /usr/bin/update-pciids exists"
exit 0
fi

echo "Updating PCI-IDs"
if [ -n "$TIMEOUT" ] ; then
$ROOTCMD timeout $TIMEOUT update-pciids
bailout $?
else
$ROOTCMD update-pciids
bailout $?
fi
$ROOTCMD timeout 10 update-pciids
bailout $?

## END OF FILE #################################################################
# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2
11 changes: 2 additions & 9 deletions etc/grml/fai/config/scripts/GRMLBASE/92-update-freshclam
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,14 @@ bailout() {
exit "${1:-0}"
}

[ -x $target/usr/bin/timeout ] && TIMEOUT="10" || TIMEOUT=""

if ! [ -x $target/usr/bin/freshclam ] ; then
echo "freshclam not installed"
exit 0
fi

echo "Updating clamav database via running freshclam"
if [ -n "$TIMEOUT" ] ; then
$ROOTCMD timeout $TIMEOUT /usr/bin/freshclam
bailout $?
else
$ROOTCMD /usr/bin/freshclam
bailout $?
fi
$ROOTCMD timeout 10 /usr/bin/freshclam
bailout $?

## END OF FILE #################################################################
# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2
12 changes: 2 additions & 10 deletions etc/grml/fai/config/scripts/GRMLBASE/94-update-smart-drivedb
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,14 @@ fi
set -u
set -e

[ -x $target/usr/bin/timeout ] && TIMEOUT="10" || TIMEOUT=""

if ! [ -x ${target}/usr/sbin/update-smart-drivedb ] ; then
echo "NOTE: update-smart-drivedb not present (possibly smartmontools >=6.4+svn4214-1 present)"
exit 0
fi

echo "Updating smartmontool drivedb"
if [ -n "$TIMEOUT" ] ; then
if ! $ROOTCMD timeout $TIMEOUT update-smart-drivedb ; then
echo "Warning: failed to update smartmontool drivedb, ignoring failure"
fi
else
if ! $ROOTCMD update-smart-drivedb ; then
echo "Warning: failed to update smartmontool drivedb, ignoring failure"
fi
if ! $ROOTCMD timeout 10 update-smart-drivedb ; then
echo "Warning: failed to update smartmontool drivedb, ignoring failure"
fi

## END OF FILE #################################################################
Expand Down

0 comments on commit 14d0405

Please sign in to comment.