#!/bin/sh

mkdir -p /var/lib/partman

case `udpkg --print-os` in
  linux)
	cat /proc/modules |
	while read module_name x; do
		if [ "$module_name" = hfs ]; then
			>/var/lib/partman/hfs
		fi
		if [ "$module_name" = hfsplus ]; then
			>/var/lib/partman/hfsplus
		fi
	done

	if ! [ -f /var/lib/partman/hfs ] && \
	   modprobe hfs >/dev/null 2>/dev/null; then
		>/var/lib/partman/hfs
	fi

	if ! [ -f /var/lib/partman/hfsplus ] && \
	   modprobe hfsplus >/dev/null 2>/dev/null; then
		>/var/lib/partman/hfsplus
	fi

	if ! [ -f /var/lib/partman/hfs ] && \
	   grep -q hfs /proc/filesystems; then
		>/var/lib/partman/hfs
	fi

	if ! [ -f /var/lib/partman/hfsplus ] && \
	   grep -q hfsplus /proc/filesystems; then
		>/var/lib/partman/hfsplus
	fi
	;;
esac
