#! /bin/sh
### BEGIN INIT INFO
# Provides:          read-only 
# Required-Start:    mountall
# Required-Stop:
# Default-Start:     S
# Default-Stop:
# X-Start-Before:    mountall-bootclean
# Short-Description: prepare for read only root
# Description:       prepare for read only root
### END INIT INFO



case "$1" in
  start|"")
	mount -t tmpfs tmpfs /rw 
	
	
	mkdir -p /rw/var/run
	cp -a /var/run/* /rw/var/run
	mount -o bind /rw/var/run /var/run
	
	mkdir /rw/tmp
	chmod a+rwxt /tmp
	mount -o bind /rw/tmp /tmp

	mkdir -p /rw/var/tmp
	chmod a+rwxt /var/tmp
	mount -o bind /rw/var/tmp /var/tmp

	mount -o remount,ro /

	


	exit $?
	;;
  restart|reload|force-reload)
	echo "Error: argument '$1' not supported" >&2
	exit 3
	;;
  stop)
	# No-op
	;;
  *)
	echo "Usage: read-only [start|stop]" >&2
	exit 3
	;;
esac

:
