#!/bin/bash

. ${TOOLKIT}-functions.sh

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

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

getconfirm alix_logs.tmpfs && {
	echo "  fstab: adding tmpfs /var/log partition" >>$msgfile
	echo "tmpfs		/var/log	tmpfs defaults,noatime 0 0" >>$out
}

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

datalabel=`jtconf alix.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=::alix.data_label:: ::path.datadir:: ::alix.data_type:: ::alix.data_parms:: 0 2" >>$out
	}
}

exit 0
