3 # Copyright (c) 2011 Nathan Whitehorn
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 echo "Begun Installation at $(date)" > $BSDINSTALL_LOG
30 export BSDINSTALL_CHROOT=$1
33 dialog --backtitle "FreeBSD Installer" --title "Abort" \
34 --no-label "Exit" --yes-label "Restart" --yesno \
35 "An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0
39 exec $0 $BSDINSTALL_CHROOT
44 rm -rf $BSDINSTALL_TMPETC
45 mkdir $BSDINSTALL_TMPETC
48 test ! -d $BSDINSTALL_DISTDIR && mkdir -p $BSDINSTALL_DISTDIR
50 if [ ! -f $BSDINSTALL_DISTDIR/MANIFEST -a -z "$BSDINSTALL_DISTSITE" ]; then
52 BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&3)
55 test $MIRROR_BUTTON -eq 0 || error
56 export BSDINSTALL_DISTSITE
57 fetch -o $BSDINSTALL_DISTDIR/MANIFEST $BSDINSTALL_DISTSITE/MANIFEST || error
60 export DISTRIBUTIONS="base.txz"
61 if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then
62 DISTMENU=`cut -f 4,5,6 $BSDINSTALL_DISTDIR/MANIFEST | grep -v -e ^kernel -e ^base`
65 EXTRA_DISTS=$(echo $DISTMENU | xargs dialog \
66 --backtitle "FreeBSD Installer" \
67 --title "Distribution Select" --nocancel --separate-output \
68 --checklist "Choose optional system components to install:" \
71 for dist in $EXTRA_DISTS; do
72 export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz"
76 FETCH_DISTRIBUTIONS=""
77 for dist in $DISTRIBUTIONS; do
78 if [ ! -f $BSDINSTALL_DISTDIR/$dist ]; then
79 FETCH_DISTRIBUTIONS="$FETCH_DISTRIBUTIONS $dist"
82 FETCH_DISTRIBUTIONS=`echo $FETCH_DISTRIBUTIONS` # Trim white space
84 if [ -n "$FETCH_DISTRIBUTIONS" -a -z "$BSDINSTALL_DISTSITE" ]; then
86 BSDINSTALL_DISTSITE=`bsdinstall mirrorselect 2>&1 1>&3`
89 test $MIRROR_BUTTON -eq 0 || error
90 export BSDINSTALL_DISTSITE
93 if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
94 bsdinstall distfetch || error
97 bsdinstall checksum || error
98 bsdinstall distextract || error
99 bsdinstall rootpass || error
101 trap true SIGINT # This section is optional
104 dialog --backtitle "FreeBSD Installer" --title "Add User Accounts" --yesno \
105 "Would you like to add users to the installed system now?" 0 0 && \
108 trap error SIGINT # SIGINT is bad again
109 bsdinstall config || error
110 cp /etc/resolv.conf $1/etc
111 cp /etc/localtime $1/etc
113 echo "Installation Completed at $(date)" >> $BSDINSTALL_LOG