#! /bin/sh
#
# Hide the recovery partition from the file manager

set -e

. /usr/share/debconf/confmodule

FDI_DIR="/target/usr/share/hal/fdi/preprobe/10osvendor/"
FDI_FILE=30-hide-recovery-partition.fdi

db_get recovery-installer/target_partition
TARGET_PARTITION="${RET}"

mkdir -p "${FDI_DIR}"
if [ ! -e "${FDI_DIR}/${FDI_FILE}" ]; then
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>

<deviceinfo version=\"0.2\">

  <device>
    <!-- Hide recovery partition -->
    <match key=\"block.device\" string=\"/dev/sda${TARGET_PARTITION}\">
      <merge key=\"info.ignore\" type=\"bool\">true</merge>
    </match>
  </device>
</deviceinfo>" >> "${FDI_DIR}/${FDI_FILE}"
    sync
fi
