xref: /minix3/distrib/common/cgdroot.rc (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc#	$NetBSD: cgdroot.rc,v 1.1 2013/07/15 00:25:38 khorben Exp $
2*84d9c625SLionel Sambuc#
3*84d9c625SLionel Sambuc# Copyright (c) 2013 Pierre Pronchery <khorben@defora.org>
4*84d9c625SLionel Sambuc# All rights reserved.
5*84d9c625SLionel Sambuc#
6*84d9c625SLionel Sambuc# Redistribution and use in source and binary forms, with or without
7*84d9c625SLionel Sambuc# modification, are permitted provided that the following conditions
8*84d9c625SLionel Sambuc# are met:
9*84d9c625SLionel Sambuc# 1. Redistributions of source code must retain the above copyright
10*84d9c625SLionel Sambuc#    notice, this list of conditions and the following disclaimer.
11*84d9c625SLionel Sambuc# 2. Redistributions in binary form must reproduce the above copyright
12*84d9c625SLionel Sambuc#    notice, this list of conditions and the following disclaimer in the
13*84d9c625SLionel Sambuc#    documentation and/or other materials provided with the distribution.
14*84d9c625SLionel Sambuc#
15*84d9c625SLionel Sambuc# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16*84d9c625SLionel Sambuc# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17*84d9c625SLionel Sambuc# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18*84d9c625SLionel Sambuc# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19*84d9c625SLionel Sambuc# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20*84d9c625SLionel Sambuc# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21*84d9c625SLionel Sambuc# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22*84d9c625SLionel Sambuc# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23*84d9c625SLionel Sambuc# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24*84d9c625SLionel Sambuc# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*84d9c625SLionel Sambuc
26*84d9c625SLionel SambucPATH=/sbin:/usr/sbin:/bin:/usr/bin
27*84d9c625SLionel Sambucexport PATH
28*84d9c625SLionel SambucTERM=wsvt25
29*84d9c625SLionel Sambucexport TERM
30*84d9c625SLionel SambucHOME=/
31*84d9c625SLionel Sambucexport HOME
32*84d9c625SLionel SambucBLOCKSIZE=1k
33*84d9c625SLionel Sambucexport BLOCKSIZE
34*84d9c625SLionel SambucEDITOR=ed
35*84d9c625SLionel Sambucexport EDITOR
36*84d9c625SLionel Sambuc
37*84d9c625SLionel Sambucumask 022
38*84d9c625SLionel Sambuc
39*84d9c625SLionel Sambucmount -o ro /dev/wd0a /etc/cgd
40*84d9c625SLionel Sambucif [ $? -ne 0 ]; then
41*84d9c625SLionel Sambuc	echo "Could not mount the boot partition" 1>&2
42*84d9c625SLionel Sambuc	exit 2
43*84d9c625SLionel Sambucfi
44*84d9c625SLionel Sambuc/sbin/wsconsctl -d -w splash.enable=0 > /dev/null 2>&1
45*84d9c625SLionel Sambuccgdconfig -C
46*84d9c625SLionel Sambucif [ $? -ne 0 ]; then
47*84d9c625SLionel Sambuc	echo "Could not decrypt the encrypted volume" 1>&2
48*84d9c625SLionel Sambuc	umount /etc/cgd
49*84d9c625SLionel Sambuc	exit 2
50*84d9c625SLionel Sambucfi
51*84d9c625SLionel Sambucmount -o ro /dev/cgd0a /altroot
52*84d9c625SLionel Sambucif [ $? -ne 0 ]; then
53*84d9c625SLionel Sambuc	echo "Could not mount the root partition" 1>&2
54*84d9c625SLionel Sambuc	cgdconfig -U
55*84d9c625SLionel Sambuc	umount /etc/cgd
56*84d9c625SLionel Sambuc	exit 2
57*84d9c625SLionel Sambucfi
58*84d9c625SLionel Sambucumount /etc/cgd
59*84d9c625SLionel Sambuc/sbin/wsconsctl -d -w splash.enable=1 > /dev/null 2>&1
60*84d9c625SLionel Sambucsysctl -w init.root=/altroot
61