#! /bin/sh
set -e

Arch=`dpkg --print-installation-architecture`

#
# make symlink /sbin/fdisk point to the native fdisk
#

# This is also true if /sbin/fdisk is a dangling symlink; in that case we
# want to update the link, too.
if [ ! -e /sbin/fdisk ]; then
	machine=""
	if [ "$Arch" == "m68k" ]; then
		case `awk '$1 == "Model:" { print $2 }' /proc/hardware` in
			Atari)
				machine=atari
				;;
			Amiga)
				machine=amiga
				;;
			Macintosh)
				machine=mac
				;;
			Motorola) # MVME
				;;
		esac
	elif [ "$Arch" == "powerpc" ]; then
		case `awk '$1 == "motherboard" { print $6 }' /proc/cpuinfo` in
			Macintosh)
				machine=mac
				;;
			*)
				machine=pmac
				;;
		esac

	fi
	if [ -n "$machine" -a -f /sbin/$machine-fdisk ]; then
		ln -sf $machine-fdisk /sbin/fdisk
	else
		echo "No native fdisk for this machine type!"
	fi
fi

# Automatically added by dh_installdocs
if [ "$1" = "configure" ]; then
	if [ -d /usr/doc -a ! -e /usr/doc/mac-fdisk -a -d /usr/share/doc/mac-fdisk ]; then
		ln -sf ../share/doc/mac-fdisk /usr/doc/mac-fdisk
	fi
fi
# End automatically added section


exit 0
