#!/bin/sh
BOOM_CONFIG="/etc/default/boom"
. $BOOM_CONFIG
BOOM_USE_SUBMENU="${BOOM_USE_SUBMENU:-yes}"
BOOM_SUBMENU_NAME="${BOOM_SUBMENU_NAME:-Snapshots}"
BOOM_ENABLE_GRUB="${BOOM_ENABLE_GRUB:-no}"
# Indentation for body of submenu commands
SUBMENU_PREFIX=" "
INSMOD_CMD="insmod blscfg"
IMPORT_CMD="bls_import"
# Test whether boom grub menu entries are enabled
if [ "$BOOM_ENABLE_GRUB" = "no" -o "$BOOM_ENABLE_GRUB" = "n" ]; then
exit
fi
# Do not generate grub configuration unless boom entries have
# been configured.
if [ -z "$(boom list --noheadings)" ]; then
exit
fi
# Optional submenu support
if [ "$BOOM_USE_SUBMENU" = "yes" -o "$BOOM_SUBMENU_NAME" = "y" ]; then
echo "submenu \"$BOOM_SUBMENU_NAME\" {"
echo "${SUBMENU_PREFIX}${INSMOD_CMD}"
echo "${SUBMENU_PREFIX}${IMPORT_CMD}"
echo "}"
else
echo ${INSMOD_CMD}
echo ${IMPORT_CMD}
fi