#!/bin/bash

. ${TOOLKIT}-functions.sh

input=$(filepath fstab.basic)
out="fstab.tmp"
msgfile="$RUNDIR/msg.tmp"

cp /dev/null $msgfile
cp $input $out

swap=`jtconf apu.swap_device 2>/dev/null` && {
	echo "  fstab: adding swap partition ($swap)" >>$msgfile
	echo "# swap partition" >>$out
	echo "LABEL=::apu.swap_label::	none	swap sw 0 0" >>$out
}

datalabel=`jtconf apu.data_label 2>/dev/null` && {
	[ -e /dev/disk/by-label/$datalabel ] && {
		echo "  fstab: adding data partition LABEL=$datalabel to /etc/fstab" >>$msgfile
		echo "# data partition" >>$out
		echo "LABEL=::apu.data_label:: ::path.datadir:: ::apu.data_type:: ::apu.data_parms:: 0 2" >>$out
	}
}

exit 0
