mount revision 218799
1218799Snwhitehorn#!/bin/sh 2218799Snwhitehorn#- 3218799Snwhitehorn# Copyright (c) 2011 Nathan Whitehorn 4218799Snwhitehorn# All rights reserved. 5218799Snwhitehorn# 6218799Snwhitehorn# Redistribution and use in source and binary forms, with or without 7218799Snwhitehorn# modification, are permitted provided that the following conditions 8218799Snwhitehorn# are met: 9218799Snwhitehorn# 1. Redistributions of source code must retain the above copyright 10218799Snwhitehorn# notice, this list of conditions and the following disclaimer. 11218799Snwhitehorn# 2. Redistributions in binary form must reproduce the above copyright 12218799Snwhitehorn# notice, this list of conditions and the following disclaimer in the 13218799Snwhitehorn# documentation and/or other materials provided with the distribution. 14218799Snwhitehorn# 15218799Snwhitehorn# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16218799Snwhitehorn# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17218799Snwhitehorn# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18218799Snwhitehorn# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19218799Snwhitehorn# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20218799Snwhitehorn# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21218799Snwhitehorn# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22218799Snwhitehorn# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23218799Snwhitehorn# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24218799Snwhitehorn# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25218799Snwhitehorn# SUCH DAMAGE. 26218799Snwhitehorn# 27218799Snwhitehorn# $FreeBSD: head/usr.sbin/bsdinstall/scripts/mount 218799 2011-02-18 14:54:34Z nwhitehorn $ 28218799Snwhitehorn 29218799SnwhitehornTMP_FSTAB=/tmp/bsdinstall-tmp-fstab 30218799Snwhitehorn 31218799Snwhitehorncat $PATH_FSTAB | awk -v BSDINSTALL_CHROOT=$BSDINSTALL_CHROOT '{ 32218799Snwhitehorn if ($2 ~ "^/.*") { 33218799Snwhitehorn fsname = $2; 34218799Snwhitehorn if (fsname == "/") 35218799Snwhitehorn fsname = "" 36218799Snwhitehorn printf("%s\t%s%s\t%s\t%s\t%s\t%s\n", $1, BSDINSTALL_CHROOT, 37218799Snwhitehorn fsname, $3, $4, $5, $6); 38218799Snwhitehorn } 39218799Snwhitehorn}' > $TMP_FSTAB 40218799Snwhitehorn 41218799SnwhitehornFILESYSTEMS=`cat $TMP_FSTAB | awk '/^[^#].*/ {if ($2 ~ "^/.*") printf("%s\n", $2);}' | sort -t /` 42218799Snwhitehorn 43218799Snwhitehornfor i in $FILESYSTEMS; do 44218799Snwhitehorn mkdir -p $i 2>/dev/null 45218799Snwhitehorn MNTERROR=`mount -F $TMP_FSTAB $i 2>&1` 46218799Snwhitehorn if [ $? -ne 0 ]; then 47218799Snwhitehorn dialog --backtitle "FreeBSD Installer" --title "Error" \ 48218799Snwhitehorn --msgbox "Error mounting partition $i:\n$MNTERROR" 0 0 49218799Snwhitehorn exit 1 50218799Snwhitehorn fi 51218799Snwhitehorndone 52218799Snwhitehorn 53218799Snwhitehorn# User might want a shell and require devfs, so mount it 54218799Snwhitehornmkdir $BSDINSTALL_CHROOT/dev 2>/dev/null 55218799Snwhitehornmount -t devfs devfs $BSDINSTALL_CHROOT/dev 56