minix/drivers/ramdisk/rc
Ben Gras 59ff5cbd87 mfs: clean flag
. also implement now-possible fsck -p option
    	. allows unconditional fsck -p invocation at startup,
    	  only checking each filesystem if not marked clean
    	. mounting unclean is allowed but is forced readonly
    	. updating the superblock while mounted is now not
    	  allowed by mfs - must be done (e.g. by fsck.mfs)
    	  on an unmounted fs
	. clean flag is unset by mfs on mounting, and set by
	  mfs on clean unmounting (if clean flag was set at
	  mount time)

Signed-off-by: Ben Gras <ben@minix3.org>
2011-12-22 16:53:32 +01:00

67 lines
1.8 KiB
Bash

#!/bin/sh
set -e
exec >/dev/log
exec 2>/dev/log
exec </dev/null
FSCK=/bin/fsck.mfs
ACPI=/sbin/acpi
if [ -e $ACPI -a -n "`sysenv acpi`" ]
then
/bin/service -c up $ACPI
fi
/bin/service -c up /sbin/pci
/bin/service -cn up /sbin/floppy -dev /dev/fd0
if [ X`/bin/sysenv bios_wini` = Xyes ]
then
echo Using bios_wini.
/bin/service -c up /sbin/bios_wini -dev /dev/c0d0
elif [ X`/bin/sysenv ahci` = Xyes ]
then
# this is here temporarily, for testing purposes
/bin/service -c up /sbin/ahci -dev /dev/c0d0 -label ahci_0 -args instance=0
else
/bin/service -c up /sbin/at_wini -dev /dev/c0d0 -label at_wini_0
/bin/service -cr up /sbin/at_wini -dev /dev/c1d0 -label at_wini_1 -args instance=1
fi
/bin/service -c edit /sbin/mfs -label fs_imgrd
/bin/service up /sbin/procfs || echo "WARNING: couldn't start procfs"
rootdev=`sysenv rootdev` || echo 'No rootdev?'
rootdevname=`/bin/dev2name "$rootdev"` ||
{ echo 'No device name for root device'; exit 1; }
if [ "`sysenv bin_img`" = 1 ]
then
bin_img="-i "
fi
if sysenv cdproberoot >/dev/null
then
echo
echo 'Looking for boot CD. This may take a minute.'
echo 'Please ignore any error messages.'
echo
cddev=`cdprobe` || { echo 'No CD found'; exit 1; }
export cddev
echo "Loading ramdisk from ${cddev}p1"
loadramdisk "$cddev"p1
elif [ "$rootdevname" = "/dev/ram" ]
then
ramimagedev=`sysenv ramimagedev` ||
{ echo 'ramimagedev not found'; exit 1; }
ramimagename=`/bin/dev2name "$ramimagedev"` ||
{ echo 'No device name for ramimagedev'; exit 1; }
echo "Loading ramdisk from $ramimagename"
loadramdisk "$ramimagename"
fi
echo "Root device name is $rootdevname"
if [ -e $FSCK ]
then $FSCK -p $rootdevname
fi
/bin/newroot $bin_img"$rootdevname"
/bin/mount -e -t procfs none /proc || echo "WARNING: couldn't mount procfs"
exec /bin/sh /etc/rc "$@"