cgdroot.rc revision 1.1
11.1Skhorben#	$NetBSD: cgdroot.rc,v 1.1 2013/07/15 00:25:38 khorben Exp $
21.1Skhorben#
31.1Skhorben# Copyright (c) 2013 Pierre Pronchery <khorben@defora.org>
41.1Skhorben# All rights reserved.
51.1Skhorben# 
61.1Skhorben# Redistribution and use in source and binary forms, with or without
71.1Skhorben# modification, are permitted provided that the following conditions
81.1Skhorben# are met:
91.1Skhorben# 1. Redistributions of source code must retain the above copyright
101.1Skhorben#    notice, this list of conditions and the following disclaimer.
111.1Skhorben# 2. Redistributions in binary form must reproduce the above copyright
121.1Skhorben#    notice, this list of conditions and the following disclaimer in the
131.1Skhorben#    documentation and/or other materials provided with the distribution.
141.1Skhorben# 
151.1Skhorben# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
161.1Skhorben# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
171.1Skhorben# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
181.1Skhorben# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
191.1Skhorben# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
201.1Skhorben# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
211.1Skhorben# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
221.1Skhorben# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
231.1Skhorben# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
241.1Skhorben# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
251.1Skhorben
261.1SkhorbenPATH=/sbin:/usr/sbin:/bin:/usr/bin
271.1Skhorbenexport PATH
281.1SkhorbenTERM=wsvt25
291.1Skhorbenexport TERM
301.1SkhorbenHOME=/
311.1Skhorbenexport HOME
321.1SkhorbenBLOCKSIZE=1k
331.1Skhorbenexport BLOCKSIZE
341.1SkhorbenEDITOR=ed
351.1Skhorbenexport EDITOR
361.1Skhorben
371.1Skhorbenumask 022
381.1Skhorben
391.1Skhorbenmount -o ro /dev/wd0a /etc/cgd
401.1Skhorbenif [ $? -ne 0 ]; then
411.1Skhorben	echo "Could not mount the boot partition" 1>&2
421.1Skhorben	exit 2
431.1Skhorbenfi
441.1Skhorben/sbin/wsconsctl -d -w splash.enable=0 > /dev/null 2>&1
451.1Skhorbencgdconfig -C
461.1Skhorbenif [ $? -ne 0 ]; then
471.1Skhorben	echo "Could not decrypt the encrypted volume" 1>&2
481.1Skhorben	umount /etc/cgd
491.1Skhorben	exit 2
501.1Skhorbenfi
511.1Skhorbenmount -o ro /dev/cgd0a /altroot
521.1Skhorbenif [ $? -ne 0 ]; then
531.1Skhorben	echo "Could not mount the root partition" 1>&2
541.1Skhorben	cgdconfig -U
551.1Skhorben	umount /etc/cgd
561.1Skhorben	exit 2
571.1Skhorbenfi
581.1Skhorbenumount /etc/cgd
591.1Skhorben/sbin/wsconsctl -d -w splash.enable=1 > /dev/null 2>&1
601.1Skhorbensysctl -w init.root=/altroot
61