Deleted Added
full compact
script (256340) script (258421)
1#!/bin/sh
2#-
3# Copyright (c) 2013 Nathan Whitehorn
1#!/bin/sh
2#-
3# Copyright (c) 2013 Nathan Whitehorn
4# Copyright (c) 2013 Devin Teske
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
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

--- 7 unchanged lines hidden (view full) ---

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
25# SUCH DAMAGE.
26#
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions
9# are met:
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

--- 7 unchanged lines hidden (view full) ---

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
26# SUCH DAMAGE.
27#
27# $FreeBSD: stable/10/usr.sbin/bsdinstall/scripts/script 256340 2013-10-11 20:28:30Z des $
28# $FreeBSD: stable/10/usr.sbin/bsdinstall/scripts/script 258421 2013-11-21 03:40:52Z dteske $
29#
30############################################################ INCLUDES
28
31
32BSDCFG_SHARE="/usr/share/bsdconfig"
33. $BSDCFG_SHARE/common.subr || exit 1
34f_dprintf "%s: loading includes..." "$0"
35f_include $BSDCFG_SHARE/dialog.subr
36f_include $BSDCFG_SHARE/variable.subr
37
38############################################################ CONFIGURATION
39
29# VARIABLES:
30# PARTITIONS
31# DISTRIBUTIONS
32# BSDINSTALL_DISTDIR
33
40# VARIABLES:
41# PARTITIONS
42# DISTRIBUTIONS
43# BSDINSTALL_DISTDIR
44
34error() {
35 test -f $PATH_FSTAB && bsdinstall umount
36 echo "Installation Error!"
37 cat $BSDINSTALL_LOG
38 echo "Installation Error!"
45############################################################ GLOBALS
46
47#
48# Strings that should be moved to an i18n file and loaded with f_include_lang()
49#
50msg_installation_error="Installation Error!"
51
52############################################################ FUNCTIONS
53
54error()
55{
56 [ -f "$PATH_FSTAB" ] && bsdinstall umount
57
58 local file
59 f_getvar "$VAR_DEBUG_FILE#+" file
60 if [ "$file" ]; then
61 f_dialog_title "$msg_installation_error"
62 f_dialog_textbox "$file"
63 # No need to restore title, pining for the fjords
64 fi
65
39 exit 1
40}
41
66 exit 1
67}
68
69############################################################ MAIN
70
42set -e
43trap error EXIT
44
45SCRIPT="$1"
46shift
47
71set -e
72trap error EXIT
73
74SCRIPT="$1"
75shift
76
48echo "Begun Installation at $(date)" > $BSDINSTALL_LOG
77f_dprintf "Began Instalation at %s" "$( date )"
49rm -rf $BSDINSTALL_TMPETC
50mkdir $BSDINSTALL_TMPETC
51
52split -a 2 -p '^#!.*' "$SCRIPT" /tmp/bsdinstall-installscript-
53
54. /tmp/bsdinstall-installscript-aa
55: ${DISTRIBUTIONS="kernel.txz base.txz"}; export DISTRIBUTIONS
56export BSDINSTALL_DISTDIR
57
78rm -rf $BSDINSTALL_TMPETC
79mkdir $BSDINSTALL_TMPETC
80
81split -a 2 -p '^#!.*' "$SCRIPT" /tmp/bsdinstall-installscript-
82
83. /tmp/bsdinstall-installscript-aa
84: ${DISTRIBUTIONS="kernel.txz base.txz"}; export DISTRIBUTIONS
85export BSDINSTALL_DISTDIR
86
87# Re-initialize a new log if preamble changed BSDINSTALL_LOG
88if [ "$BSDINSTALL_LOG" != "${debugFile#+}" ]; then
89 export debugFile="$BSDINSTALL_LOG"
90 f_quietly f_debug_init
91 # NB: Being scripted, let debug go to terminal for invalid debugFile
92 f_dprintf "Began Instalation at %s" "$( date )"
93fi
94
58# Make partitions
59rm -f $PATH_FSTAB
60touch $PATH_FSTAB
61bsdinstall scriptedpart "$PARTITIONS"
62bsdinstall mount
63
64# Unpack distributions
65bsdinstall checksum

--- 15 unchanged lines hidden (view full) ---

81 chroot $BSDINSTALL_CHROOT /tmp/installscript $@ 2>&1
82 umount "$BSDINSTALL_CHROOT/dev"
83 rm $BSDINSTALL_CHROOT/tmp/installscript
84fi
85
86bsdinstall entropy
87bsdinstall umount
88
95# Make partitions
96rm -f $PATH_FSTAB
97touch $PATH_FSTAB
98bsdinstall scriptedpart "$PARTITIONS"
99bsdinstall mount
100
101# Unpack distributions
102bsdinstall checksum

--- 15 unchanged lines hidden (view full) ---

118 chroot $BSDINSTALL_CHROOT /tmp/installscript $@ 2>&1
119 umount "$BSDINSTALL_CHROOT/dev"
120 rm $BSDINSTALL_CHROOT/tmp/installscript
121fi
122
123bsdinstall entropy
124bsdinstall umount
125
89echo "Installation Completed at $(date)" >> $BSDINSTALL_LOG
126f_dprintf "Installation Completed at %s" "$( date )"
90
91trap true EXIT
127
128trap true EXIT
129
130################################################################################
131# END
132################################################################################