#!/bin/sh
# VIVER run script
# Copyright (C) 2005-2006 Furuhashi Sadayuki
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#


# load VIVER functions
. /viver

# load VIVER error messages
. /errormsg

# load console color code
set_fb_param


echo "${CLEAR}${WHITE}Booting ${RED}VIVER ${WHITE}0.2${NORMAL}"
echo "${NORMAL}"


mount_proc_sys			;catch mount_proc_sys
parse_command_line		;catch parse_command_line
set_params			;catch set_params
disable_verbose


mount_module			;catch mount_module
load_drivers			;catch load_drivers
mknoah				;catch mknoah
do_hwsetup			;catch do_hwsetup
if [ "$rootserver" -o "$wakenet" ];then
	wake_network		;catch wake_network
fi


if [ "$cowkey" ];then
	mount_cow		;catch mount_cow
else
	mount_tmp		;catch mount_tmp
fi


if [ ! "$rootserver" ];then
	mount_disk		;catch mount_disk
else
	connect_rootserver	;catch connect_rootserver
fi
map_crypt			;catch map_crypt
if [ "$toram" ];then
	toram			;catch toram
fi
mount_squash			;catch mount_squash
linearize_root			;catch linearize_root
map_cow				;catch map_cow
mount_root			;catch mount_root


find_swap			;catch find_swap
edit_fs				;catch edit_fs
move_mtpoint			;catch move_mtpoint
umount_module			;catch umount_module
do_pivot_root			;catch do_pivot_root


bootrc				;catch bootrc
enable_verbose
umount_proc_sys			;catch umount_proc_sys


echo "${OK}End VIVER.${NORMAL}"

