3 # SPDX-License-Identifier: BSD-2-Clause-FreeBSD
5 # Copyright (c) 2010 iXsystems, Inc. All rights reserved.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
16 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 # Main install configuration parsing script
33 # Source our functions scripts
34 . ${BACKEND}/functions.sh
35 . ${BACKEND}/functions-bsdlabel.sh
36 . ${BACKEND}/functions-cleanup.sh
37 . ${BACKEND}/functions-disk.sh
38 . ${BACKEND}/functions-extractimage.sh
39 . ${BACKEND}/functions-installcomponents.sh
40 . ${BACKEND}/functions-installpackages.sh
41 . ${BACKEND}/functions-localize.sh
42 . ${BACKEND}/functions-mountdisk.sh
43 . ${BACKEND}/functions-networking.sh
44 . ${BACKEND}/functions-newfs.sh
45 . ${BACKEND}/functions-packages.sh
46 . ${BACKEND}/functions-parse.sh
47 . ${BACKEND}/functions-runcommands.sh
48 . ${BACKEND}/functions-ftp.sh
49 . ${BACKEND}/functions-unmount.sh
50 . ${BACKEND}/functions-upgrade.sh
51 . ${BACKEND}/functions-users.sh
53 # Check that the config file exists
56 echo "ERROR: Install configuration $1 does not exist!"
60 # Set our config file variable
63 # Resolve any relative pathing
64 CFGF="`realpath ${CFGF}`"
67 # Start by doing a sanity check, which will catch any obvious mistakes in the config
68 file_sanity_check "installMode installType installMedium packageType"
70 # We passed the Sanity check, lets grab some of the universal config settings and store them
71 check_value installMode "fresh upgrade extract"
72 check_value installType "PCBSD FreeBSD"
73 check_value installMedium "dvd usb ftp rsync image local"
74 check_value packageType "uzip tar rsync split dist"
75 if_check_value_exists mirrorbal "load prefer round-robin split"
77 # We passed all sanity checks! Yay, lets start the install
78 echo "File Sanity Check -> OK"
80 # Lets load the various universal settings now
81 get_value_from_cfg installMode
82 export INSTALLMODE="${VAL}"
84 get_value_from_cfg installType
85 export INSTALLTYPE="${VAL}"
87 get_value_from_cfg installMedium
88 export INSTALLMEDIUM="${VAL}"
90 get_value_from_cfg packageType
91 export PACKAGETYPE="${VAL}"
93 # Check if we are doing any networking setup
96 # If we are not doing an upgrade, lets go ahead and setup the disk
97 case "${INSTALLMODE}" in
99 if [ "${INSTALLMEDIUM}" = "image" ]
108 # Extracting only, make sure we have a valid target directory
109 get_value_from_cfg installLocation
110 export FSMNT="${VAL}"
111 if [ -z "$FSMNT" ] ; then exit_err "Missing installLocation=" ; fi
112 if [ ! -d "$FSMNT" ] ; then exit_err "No such directory: $FSMNT" ; fi