1#!/bin/sh
2# A really simple script to create a swap-backed msdosfs filesystem, then
3# test to see if msdosfs_conv.c rev 1.45[1] works properly.
4
5mkdir /tmp/msdosfstest
6mdconfig -a -t swap -s 128m -u 10
7bsdlabel -w md10 auto
8newfs_msdos -F 16 -b 8192 /dev/md10a
9mount_msdosfs -L uk_UA.KOI8-U -D CP866 -l /dev/md10a /tmp/msdosfstest
10# The comment is UTF-8, the actual command uses the KOI8-U representation.
11# mkdir /tmp/msdosfstest/і (CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I)
12mkdir /tmp/msdosfstest/$'\246'
13if [ $? -eq 0 ]; then
14	echo "ok 4 (pass stage 1/3)"
15	cd /tmp/msdosfstest/$'\246'
16	if [ $? -eq 0 ]; then
17		echo "ok 4 (pass stage 2/3)"
18		cd /tmp
19		umount /tmp/msdosfstest
20		mount_msdosfs -L uk_UA.KOI8-U -D CP866 -s /dev/md10a /tmp/msdosfstest
21		cd /tmp/msdosfstest/_~1
22		if [ $? -eq 0 ]; then
23			echo "ok 4 (pass stage 3/3)"
24		else
25			echo "not ok 4"
26		fi
27	else
28		echo "not ok 4"
29	fi
30else
31	echo "not ok 4"
32fi
33cd /tmp
34umount /tmp/msdosfstest
35mdconfig -d -u 10
36rmdir /tmp/msdosfstest
37