View | Details | Raw Unified | Return to bug 266987
Collapse All | Expand All

(-)b/usr.sbin/bsdinstall/scripts/auto (+17 lines)
Lines 1-404 Link Here
1
#!/bin/sh
1
#!/bin/sh
2
#-
2
#-
3
# Copyright (c) 2011 Nathan Whitehorn
3
# Copyright (c) 2011 Nathan Whitehorn
4
# Copyright (c) 2013-2018 Devin Teske
4
# Copyright (c) 2013-2018 Devin Teske
5
# All rights reserved.
5
# All rights reserved.
6
#
6
#
7
# Redistribution and use in source and binary forms, with or without
7
# Redistribution and use in source and binary forms, with or without
8
# modification, are permitted provided that the following conditions
8
# modification, are permitted provided that the following conditions
9
# are met:
9
# are met:
10
# 1. Redistributions of source code must retain the above copyright
10
# 1. Redistributions of source code must retain the above copyright
11
#    notice, this list of conditions and the following disclaimer.
11
#    notice, this list of conditions and the following disclaimer.
12
# 2. Redistributions in binary form must reproduce the above copyright
12
# 2. Redistributions in binary form must reproduce the above copyright
13
#    notice, this list of conditions and the following disclaimer in the
13
#    notice, this list of conditions and the following disclaimer in the
14
#    documentation and/or other materials provided with the distribution.
14
#    documentation and/or other materials provided with the distribution.
15
#
15
#
16
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
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
17
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
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
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
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
25
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26
# SUCH DAMAGE.
26
# SUCH DAMAGE.
27
#
27
#
28
#
28
#
29
############################################################ INCLUDES
29
############################################################ INCLUDES
30
30
31
BSDCFG_SHARE="/usr/share/bsdconfig"
31
BSDCFG_SHARE="/usr/share/bsdconfig"
32
. $BSDCFG_SHARE/common.subr || exit 1
32
. $BSDCFG_SHARE/common.subr || exit 1
33
f_include $BSDCFG_SHARE/dialog.subr
33
f_include $BSDCFG_SHARE/dialog.subr
34
34
35
############################################################ GLOBALS
35
############################################################ GLOBALS
36
36
37
#
37
#
38
# Strings that should be moved to an i18n file and loaded with f_include_lang()
38
# Strings that should be moved to an i18n file and loaded with f_include_lang()
39
#
39
#
40
hline_arrows_tab_enter="Press arrows, TAB or ENTER"
40
hline_arrows_tab_enter="Press arrows, TAB or ENTER"
41
hline_arrows_tab_space_enter="Press arrows, TAB, SPACE or ENTER"
41
hline_arrows_tab_space_enter="Press arrows, TAB, SPACE or ENTER"
42
msg_abort="Abort"
42
msg_abort="Abort"
43
msg_an_installation_step_has_been_aborted="An installation step has been aborted. Would you like\nto restart the installation or exit the installer?"
43
msg_an_installation_step_has_been_aborted="An installation step has been aborted. Would you like\nto restart the installation or exit the installer?"
44
msg_auto_ufs="Auto (UFS)"
44
msg_auto_ufs="Auto (UFS)"
45
msg_auto_ufs_desc="Guided UFS Disk Setup"
45
msg_auto_ufs_desc="Guided UFS Disk Setup"
46
msg_auto_ufs_help="Menu options help choose which disk to setup using UFS and standard partitions"
46
msg_auto_ufs_help="Menu options help choose which disk to setup using UFS and standard partitions"
47
msg_auto_zfs="Auto (ZFS)"
47
msg_auto_zfs="Auto (ZFS)"
48
msg_auto_zfs_desc="Guided Root-on-ZFS"
48
msg_auto_zfs_desc="Guided Root-on-ZFS"
49
msg_auto_zfs_help="To use ZFS with less than 8GB RAM, see https://wiki.freebsd.org/ZFSTuningGuide"
49
msg_auto_zfs_help="To use ZFS with less than 8GB RAM, see https://wiki.freebsd.org/ZFSTuningGuide"
50
msg_exit="Exit"
50
msg_exit="Exit"
51
msg_freebsd_installer="$OSNAME Installer"
51
msg_freebsd_installer="$OSNAME Installer"
52
msg_gpt_active_fix="Your hardware is known to have issues booting in CSM/Legacy/BIOS mode from GPT partitions that are not set active. Would you like the installer to apply this workaround for you?"
52
msg_gpt_active_fix="Your hardware is known to have issues booting in CSM/Legacy/BIOS mode from GPT partitions that are not set active. Would you like the installer to apply this workaround for you?"
53
msg_lenovo_fix="Your model of Lenovo is known to have a BIOS bug that prevents it booting from GPT partitions without UEFI. Would you like the installer to apply a workaround for you?"
53
msg_lenovo_fix="Your model of Lenovo is known to have a BIOS bug that prevents it booting from GPT partitions without UEFI. Would you like the installer to apply a workaround for you?"
54
msg_manual="Manual"
54
msg_manual="Manual"
55
msg_manual_desc="Manual Disk Setup (experts)"
55
msg_manual_desc="Manual Disk Setup (experts)"
56
msg_manual_help="Create customized partitions from menu options"
56
msg_manual_help="Create customized partitions from menu options"
57
msg_no="NO"
57
msg_no="NO"
58
msg_restart="Restart"
58
msg_restart="Restart"
59
msg_shell="Shell"
59
msg_shell="Shell"
60
msg_shell_desc="Open a shell and partition by hand"
60
msg_shell_desc="Open a shell and partition by hand"
61
msg_shell_help="Create customized partitions using command-line utilities"
61
msg_shell_help="Create customized partitions using command-line utilities"
62
msg_yes="YES"
62
msg_yes="YES"
63
63
64
############################################################ FUNCTIONS
64
############################################################ FUNCTIONS
65
65
66
# error [$msg]
66
# error [$msg]
67
#
67
#
68
# Display generic error message when a script fails. An optional message
68
# Display generic error message when a script fails. An optional message
69
# argument can preceed the generic message. User is given the choice of
69
# argument can preceed the generic message. User is given the choice of
70
# restarting the installer or exiting.
70
# restarting the installer or exiting.
71
#
71
#
72
error()
72
error()
73
{
73
{
74
	local title="$msg_abort"
74
	local title="$msg_abort"
75
	local btitle="$msg_freebsd_installer"
75
	local btitle="$msg_freebsd_installer"
76
	local prompt="${1:+$1\n\n}$msg_an_installation_step_has_been_aborted"
76
	local prompt="${1:+$1\n\n}$msg_an_installation_step_has_been_aborted"
77
	local hline="$hline_arrows_tab_space_enter"
77
	local hline="$hline_arrows_tab_space_enter"
78
78
79
	[ -f "$PATH_FSTAB" ] && bsdinstall umount
79
	[ -f "$PATH_FSTAB" ] && bsdinstall umount
80
80
81
	local height width
81
	local height width
82
	f_dialog_buttonbox_size height width \
82
	f_dialog_buttonbox_size height width \
83
		"$title" "$btitle" "$prompt" "$hline"
83
		"$title" "$btitle" "$prompt" "$hline"
84
84
85
	if $DIALOG \
85
	if $DIALOG \
86
		--title "$title"           \
86
		--title "$title"           \
87
		--backtitle "$btitle"      \
87
		--backtitle "$btitle"      \
88
		--hline "$hline"           \
88
		--hline "$hline"           \
89
		--no-label "$msg_exit"     \
89
		--no-label "$msg_exit"     \
90
		--yes-label "$msg_restart" \
90
		--yes-label "$msg_restart" \
91
		--yesno "$prompt" $height $width
91
		--yesno "$prompt" $height $width
92
	then
92
	then
93
		environment_restore
93
		exec $0
94
		exec $0
94
		# NOTREACHED
95
		# NOTREACHED
95
	fi
96
	fi
96
	exit 1
97
	exit 1
97
}
98
}
98
99
99
# dialog_workaround
100
# dialog_workaround
100
#
101
#
101
# Ask the user if they wish to apply a workaround
102
# Ask the user if they wish to apply a workaround
102
#
103
#
103
dialog_workaround()
104
dialog_workaround()
104
{
105
{
105
	local passed_msg="$1"
106
	local passed_msg="$1"
106
	local title="$DIALOG_TITLE"
107
	local title="$DIALOG_TITLE"
107
	local btitle="$DIALOG_BACKTITLE"
108
	local btitle="$DIALOG_BACKTITLE"
108
	local prompt # Calculated below
109
	local prompt # Calculated below
109
	local hline="$hline_arrows_tab_enter"
110
	local hline="$hline_arrows_tab_enter"
110
111
111
	local height=8 width=50 prefix="   "
112
	local height=8 width=50 prefix="   "
112
	local plen=${#prefix} list= line=
113
	local plen=${#prefix} list= line=
113
	local max_width=$(( $width - 3 - $plen ))
114
	local max_width=$(( $width - 3 - $plen ))
114
115
115
	local yes no defaultno extra_args format
116
	local yes no defaultno extra_args format
116
	if [ "$USE_XDIALOG" ]; then
117
	if [ "$USE_XDIALOG" ]; then
117
		yes=ok no=cancel defaultno=default-no
118
		yes=ok no=cancel defaultno=default-no
118
		extra_args="--wrap --left"
119
		extra_args="--wrap --left"
119
		format="$passed_msg"
120
		format="$passed_msg"
120
	else
121
	else
121
		yes=yes no=no defaultno=defaultno
122
		yes=yes no=no defaultno=defaultno
122
		extra_args="--cr-wrap"
123
		extra_args="--cr-wrap"
123
		format="$passed_msg"
124
		format="$passed_msg"
124
	fi
125
	fi
125
126
126
	# Add height for Xdialog(1)
127
	# Add height for Xdialog(1)
127
	[ "$USE_XDIALOG" ] && height=$(( $height + $height / 5 + 3 ))
128
	[ "$USE_XDIALOG" ] && height=$(( $height + $height / 5 + 3 ))
128
129
129
	prompt=$( printf "$format" )
130
	prompt=$( printf "$format" )
130
	f_dprintf "%s: Workaround prompt" "$0"
131
	f_dprintf "%s: Workaround prompt" "$0"
131
	$DIALOG \
132
	$DIALOG \
132
		--title "$title"        \
133
		--title "$title"        \
133
		--backtitle "$btitle"   \
134
		--backtitle "$btitle"   \
134
		--hline "$hline"        \
135
		--hline "$hline"        \
135
		--$yes-label "$msg_yes" \
136
		--$yes-label "$msg_yes" \
136
		--$no-label "$msg_no"   \
137
		--$no-label "$msg_no"   \
137
		$extra_args             \
138
		$extra_args             \
138
		--yesno "$prompt" $height $width
139
		--yesno "$prompt" $height $width
139
}
140
}
140
141
142
environment_restore()
143
{
144
	BSDINSTALL_DISTSITE="$ORIG_BSDINSTALL_DISTSITE"
145
	DISTRIBUTIONS="$ORIG_DISTRIBUTIONS"
146
	unset WORKAROUND_GPTACTIVE WORKAROUND_LENOVO
147
	unset ZFSBOOT_PARTITION_SCHEME
148
}
149
150
environment_save()
151
{
152
	ORIG_BSDINSTALL_DISTSITE="$BSDINSTALL_DISTSITE"
153
	ORIG_DISTRIBUTIONS="$DISTRIBUTIONS"
154
}
155
141
############################################################ MAIN
156
############################################################ MAIN
142
157
143
f_dprintf "Began Installation at %s" "$( date )"
158
f_dprintf "Began Installation at %s" "$( date )"
144
159
160
environment_save
161
145
rm -rf $BSDINSTALL_TMPETC
162
rm -rf $BSDINSTALL_TMPETC
146
mkdir $BSDINSTALL_TMPETC
163
mkdir $BSDINSTALL_TMPETC
147
164
148
[ -f /usr/libexec/bsdinstall/local.pre-everything ] && f_dprintf "Running local.pre-everything" && sh /usr/libexec/bsdinstall/local.pre-everything "$BSDINSTALL_CHROOT"
165
[ -f /usr/libexec/bsdinstall/local.pre-everything ] && f_dprintf "Running local.pre-everything" && sh /usr/libexec/bsdinstall/local.pre-everything "$BSDINSTALL_CHROOT"
149
166
150
trap true SIGINT	# This section is optional
167
trap true SIGINT	# This section is optional
151
[ -z "$BSDINSTALL_SKIP_KEYMAP" ] && bsdinstall keymap
168
[ -z "$BSDINSTALL_SKIP_KEYMAP" ] && bsdinstall keymap
152
169
153
trap error SIGINT	# Catch cntrl-C here
170
trap error SIGINT	# Catch cntrl-C here
154
if [ -z "$BSDINSTALL_SKIP_HOSTNAME" ]; then bsdinstall hostname || error "Set hostname failed"; fi
171
if [ -z "$BSDINSTALL_SKIP_HOSTNAME" ]; then bsdinstall hostname || error "Set hostname failed"; fi
155
172
156
export DISTRIBUTIONS="${DISTRIBUTIONS:-base.txz kernel.txz}"
173
export DISTRIBUTIONS="${DISTRIBUTIONS:-base.txz kernel.txz}"
157
if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then
174
if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then
158
	DISTMENU=`awk -F'\t' '!/^(kernel\.txz|base\.txz)/{print $1,$5,$6}' $BSDINSTALL_DISTDIR/MANIFEST`
175
	DISTMENU=`awk -F'\t' '!/^(kernel\.txz|base\.txz)/{print $1,$5,$6}' $BSDINSTALL_DISTDIR/MANIFEST`
159
	DISTMENU="$(echo ${DISTMENU} | sed -E 's/\.txz//g')"
176
	DISTMENU="$(echo ${DISTMENU} | sed -E 's/\.txz//g')"
160
177
161
	if [ -n "$DISTMENU" ]; then
178
	if [ -n "$DISTMENU" ]; then
162
		exec 5>&1
179
		exec 5>&1
163
		EXTRA_DISTS=$( eval bsddialog \
180
		EXTRA_DISTS=$( eval bsddialog \
164
		    --backtitle \"$OSNAME Installer\" \
181
		    --backtitle \"$OSNAME Installer\" \
165
		    --title \"Distribution Select\" --nocancel --separate-output \
182
		    --title \"Distribution Select\" --nocancel --separate-output \
166
		    --checklist \"Choose optional system components to install:\" \
183
		    --checklist \"Choose optional system components to install:\" \
167
		    0 0 0 $DISTMENU \
184
		    0 0 0 $DISTMENU \
168
		2>&1 1>&5 )
185
		2>&1 1>&5 )
169
		for dist in $EXTRA_DISTS; do
186
		for dist in $EXTRA_DISTS; do
170
			export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz"
187
			export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz"
171
		done
188
		done
172
	fi
189
	fi
173
fi
190
fi
174
191
175
FETCH_DISTRIBUTIONS=""
192
FETCH_DISTRIBUTIONS=""
176
for dist in $DISTRIBUTIONS; do
193
for dist in $DISTRIBUTIONS; do
177
	if [ ! -f $BSDINSTALL_DISTDIR/$dist ]; then
194
	if [ ! -f $BSDINSTALL_DISTDIR/$dist ]; then
178
		FETCH_DISTRIBUTIONS="$FETCH_DISTRIBUTIONS $dist"
195
		FETCH_DISTRIBUTIONS="$FETCH_DISTRIBUTIONS $dist"
179
	fi
196
	fi
180
done
197
done
181
198
182
if [ -n "$FETCH_DISTRIBUTIONS" -a -n "$BSDINSTALL_CONFIGCURRENT" ]; then
199
if [ -n "$FETCH_DISTRIBUTIONS" -a -n "$BSDINSTALL_CONFIGCURRENT" ]; then
183
	bsddialog --backtitle "$OSNAME Installer" --title "Network Installation" --msgbox "Some installation files were not found on the boot volume. The next few screens will allow you to configure networking so that they can be downloaded from the Internet." 0 0
200
	bsddialog --backtitle "$OSNAME Installer" --title "Network Installation" --msgbox "Some installation files were not found on the boot volume. The next few screens will allow you to configure networking so that they can be downloaded from the Internet." 0 0
184
	bsdinstall netconfig || error
201
	bsdinstall netconfig || error
185
	NETCONFIG_DONE=yes
202
	NETCONFIG_DONE=yes
186
fi
203
fi
187
204
188
rm -f $PATH_FSTAB
205
rm -f $PATH_FSTAB
189
touch $PATH_FSTAB
206
touch $PATH_FSTAB
190
207
191
[ -f /usr/libexec/bsdinstall/local.pre-partition ] && f_dprintf "Running local.pre-partition" && sh /usr/libexec/bsdinstall/local.pre-partition "$BSDINSTALL_CHROOT"
208
[ -f /usr/libexec/bsdinstall/local.pre-partition ] && f_dprintf "Running local.pre-partition" && sh /usr/libexec/bsdinstall/local.pre-partition "$BSDINSTALL_CHROOT"
192
209
193
#
210
#
194
# Try to detect known broken platforms and apply their workarounds
211
# Try to detect known broken platforms and apply their workarounds
195
#
212
#
196
213
197
if f_interactive; then
214
if f_interactive; then
198
	sys_maker=$( kenv -q smbios.system.maker )
215
	sys_maker=$( kenv -q smbios.system.maker )
199
	f_dprintf "smbios.system.maker=[%s]" "$sys_maker"
216
	f_dprintf "smbios.system.maker=[%s]" "$sys_maker"
200
	sys_model=$( kenv -q smbios.system.product )
217
	sys_model=$( kenv -q smbios.system.product )
201
	f_dprintf "smbios.system.product=[%s]" "$sys_model"
218
	f_dprintf "smbios.system.product=[%s]" "$sys_model"
202
	sys_version=$( kenv -q smbios.system.version )
219
	sys_version=$( kenv -q smbios.system.version )
203
	f_dprintf "smbios.system.version=[%s]" "$sys_version"
220
	f_dprintf "smbios.system.version=[%s]" "$sys_version"
204
	sys_mb_maker=$( kenv -q smbios.planar.maker )
221
	sys_mb_maker=$( kenv -q smbios.planar.maker )
205
	f_dprintf "smbios.planar.maker=[%s]" "$sys_mb_maker"
222
	f_dprintf "smbios.planar.maker=[%s]" "$sys_mb_maker"
206
	sys_mb_product=$( kenv -q smbios.planar.product )
223
	sys_mb_product=$( kenv -q smbios.planar.product )
207
	f_dprintf "smbios.planar.product=[%s]" "$sys_mb_product"
224
	f_dprintf "smbios.planar.product=[%s]" "$sys_mb_product"
208
225
209
	#
226
	#
210
	# Laptop Models
227
	# Laptop Models
211
	#
228
	#
212
	case "$sys_maker" in
229
	case "$sys_maker" in
213
	"LENOVO")
230
	"LENOVO")
214
		case "$sys_version" in
231
		case "$sys_version" in
215
		"ThinkPad X220"|"ThinkPad T420"|"ThinkPad T520"|"ThinkPad W520"|"ThinkPad X1")
232
		"ThinkPad X220"|"ThinkPad T420"|"ThinkPad T520"|"ThinkPad W520"|"ThinkPad X1")
216
			dialog_workaround "$msg_lenovo_fix"
233
			dialog_workaround "$msg_lenovo_fix"
217
			retval=$?
234
			retval=$?
218
			f_dprintf "lenovofix_prompt=[%s]" "$retval"
235
			f_dprintf "lenovofix_prompt=[%s]" "$retval"
219
			if [ $retval -eq $DIALOG_OK ]; then
236
			if [ $retval -eq $DIALOG_OK ]; then
220
				export ZFSBOOT_PARTITION_SCHEME="GPT + Lenovo Fix"
237
				export ZFSBOOT_PARTITION_SCHEME="GPT + Lenovo Fix"
221
				export WORKAROUND_LENOVO=1
238
				export WORKAROUND_LENOVO=1
222
			fi
239
			fi
223
			;;
240
			;;
224
		esac
241
		esac
225
		;;
242
		;;
226
	"Dell Inc.")
243
	"Dell Inc.")
227
		case "$sys_model" in
244
		case "$sys_model" in
228
		"Latitude E6330"|"Latitude E7440"|"Latitude E7240"|"Precision Tower 5810")
245
		"Latitude E6330"|"Latitude E7440"|"Latitude E7240"|"Precision Tower 5810")
229
			dialog_workaround "$msg_gpt_active_fix"
246
			dialog_workaround "$msg_gpt_active_fix"
230
			retval=$?
247
			retval=$?
231
			f_dprintf "gpt_active_fix_prompt=[%s]" "$retval"
248
			f_dprintf "gpt_active_fix_prompt=[%s]" "$retval"
232
			if [ $retval -eq $DIALOG_OK ]; then
249
			if [ $retval -eq $DIALOG_OK ]; then
233
				export ZFSBOOT_PARTITION_SCHEME="GPT + Active"
250
				export ZFSBOOT_PARTITION_SCHEME="GPT + Active"
234
				export WORKAROUND_GPTACTIVE=1
251
				export WORKAROUND_GPTACTIVE=1
235
			fi
252
			fi
236
			;;
253
			;;
237
		esac
254
		esac
238
		;;
255
		;;
239
	"Hewlett-Packard")
256
	"Hewlett-Packard")
240
		case "$sys_model" in
257
		case "$sys_model" in
241
		"HP ProBook 4330s")
258
		"HP ProBook 4330s")
242
			dialog_workaround "$msg_gpt_active_fix"
259
			dialog_workaround "$msg_gpt_active_fix"
243
			retval=$?
260
			retval=$?
244
			f_dprintf "gpt_active_fix_prompt=[%s]" "$retval"
261
			f_dprintf "gpt_active_fix_prompt=[%s]" "$retval"
245
			if [ $retval -eq $DIALOG_OK ]; then
262
			if [ $retval -eq $DIALOG_OK ]; then
246
				export ZFSBOOT_PARTITION_SCHEME="GPT + Active"
263
				export ZFSBOOT_PARTITION_SCHEME="GPT + Active"
247
				export WORKAROUND_GPTACTIVE=1
264
				export WORKAROUND_GPTACTIVE=1
248
			fi
265
			fi
249
			;;
266
			;;
250
		esac
267
		esac
251
		;;
268
		;;
252
	esac
269
	esac
253
	#
270
	#
254
	# Motherboard Models
271
	# Motherboard Models
255
	#
272
	#
256
	case "$sys_mb_maker" in
273
	case "$sys_mb_maker" in
257
	"Intel Corporation")
274
	"Intel Corporation")
258
		case "$sys_mb_product" in
275
		case "$sys_mb_product" in
259
		"DP965LT"|"D510MO")
276
		"DP965LT"|"D510MO")
260
			dialog_workaround "$msg_gpt_active_fix"
277
			dialog_workaround "$msg_gpt_active_fix"
261
			retval=$?
278
			retval=$?
262
			f_dprintf "gpt_active_fix_prompt=[%s]" "$retval"
279
			f_dprintf "gpt_active_fix_prompt=[%s]" "$retval"
263
			if [ $retval -eq $DIALOG_OK ]; then
280
			if [ $retval -eq $DIALOG_OK ]; then
264
				export ZFSBOOT_PARTITION_SCHEME="GPT + Active"
281
				export ZFSBOOT_PARTITION_SCHEME="GPT + Active"
265
				export WORKAROUND_GPTACTIVE=1
282
				export WORKAROUND_GPTACTIVE=1
266
			fi
283
			fi
267
			;;
284
			;;
268
		esac
285
		esac
269
		;;
286
		;;
270
	"Acer")
287
	"Acer")
271
		case "$sys_mb_product" in
288
		case "$sys_mb_product" in
272
		"Veriton M6630G")
289
		"Veriton M6630G")
273
			dialog_workaround "$msg_gpt_active_fix"
290
			dialog_workaround "$msg_gpt_active_fix"
274
			retval=$?
291
			retval=$?
275
			f_dprintf "gpt_active_fix_prompt=[%s]" "$retval"
292
			f_dprintf "gpt_active_fix_prompt=[%s]" "$retval"
276
			if [ $retval -eq $DIALOG_OK ]; then
293
			if [ $retval -eq $DIALOG_OK ]; then
277
				export ZFSBOOT_PARTITION_SCHEME="GPT + Active"
294
				export ZFSBOOT_PARTITION_SCHEME="GPT + Active"
278
				export WORKAROUND_GPTACTIVE=1
295
				export WORKAROUND_GPTACTIVE=1
279
			fi
296
			fi
280
			;;
297
			;;
281
		esac
298
		esac
282
		;;
299
		;;
283
	esac
300
	esac
284
fi
301
fi
285
302
286
PMODES="
303
PMODES="
287
	'$msg_auto_ufs' '$msg_auto_ufs_desc' '$msg_auto_ufs_help'
304
	'$msg_auto_ufs' '$msg_auto_ufs_desc' '$msg_auto_ufs_help'
288
	'$msg_manual' '$msg_manual_desc' '$msg_manual_help'
305
	'$msg_manual' '$msg_manual_desc' '$msg_manual_help'
289
	'$msg_shell' '$msg_shell_desc' '$msg_shell_help'
306
	'$msg_shell' '$msg_shell_desc' '$msg_shell_help'
290
" # END-QUOTE
307
" # END-QUOTE
291
308
292
CURARCH=$( uname -m )
309
CURARCH=$( uname -m )
293
case $CURARCH in
310
case $CURARCH in
294
	amd64|arm64|i386|riscv)	# Booting ZFS Supported
311
	amd64|arm64|i386|riscv)	# Booting ZFS Supported
295
		PMODES="
312
		PMODES="
296
			'$msg_auto_zfs' '$msg_auto_zfs_desc' '$msg_auto_zfs_help'
313
			'$msg_auto_zfs' '$msg_auto_zfs_desc' '$msg_auto_zfs_help'
297
			$PMODES
314
			$PMODES
298
		" # END-QUOTE
315
		" # END-QUOTE
299
		;;
316
		;;
300
	*)			# Booting ZFS Unsupported
317
	*)			# Booting ZFS Unsupported
301
		;;
318
		;;
302
esac
319
esac
303
320
304
exec 5>&1
321
exec 5>&1
305
PARTMODE=`echo $PMODES | xargs -o bsddialog --backtitle "$OSNAME Installer" \
322
PARTMODE=`echo $PMODES | xargs -o bsddialog --backtitle "$OSNAME Installer" \
306
	--title "Partitioning" \
323
	--title "Partitioning" \
307
	--item-help \
324
	--item-help \
308
	--menu "How would you like to partition your disk?" \
325
	--menu "How would you like to partition your disk?" \
309
	0 0 0 2>&1 1>&5` || exit 1
326
	0 0 0 2>&1 1>&5` || exit 1
310
exec 5>&-
327
exec 5>&-
311
328
312
case "$PARTMODE" in
329
case "$PARTMODE" in
313
"$msg_auto_zfs")	# ZFS
330
"$msg_auto_zfs")	# ZFS
314
	bsdinstall zfsboot || error "ZFS setup failed"
331
	bsdinstall zfsboot || error "ZFS setup failed"
315
	bsdinstall mount || error "Failed to mount filesystem"
332
	bsdinstall mount || error "Failed to mount filesystem"
316
	;;
333
	;;
317
"$msg_auto_ufs")	# Guided UFS
334
"$msg_auto_ufs")	# Guided UFS
318
	bsdinstall autopart || error "Partitioning error"
335
	bsdinstall autopart || error "Partitioning error"
319
	bsdinstall mount || error "Failed to mount filesystem"
336
	bsdinstall mount || error "Failed to mount filesystem"
320
	;;
337
	;;
321
"$msg_shell")		# Shell
338
"$msg_shell")		# Shell
322
	clear
339
	clear
323
	echo "Use this shell to set up partitions for the new system. When finished, mount the system at $BSDINSTALL_CHROOT and place an fstab file for the new system at $PATH_FSTAB. Then type 'exit'. You can also enter the partition editor at any time by entering 'bsdinstall partedit'."
340
	echo "Use this shell to set up partitions for the new system. When finished, mount the system at $BSDINSTALL_CHROOT and place an fstab file for the new system at $PATH_FSTAB. Then type 'exit'. You can also enter the partition editor at any time by entering 'bsdinstall partedit'."
324
	sh 2>&1
341
	sh 2>&1
325
	;;
342
	;;
326
"$msg_manual")		# Manual
343
"$msg_manual")		# Manual
327
	if f_isset debugFile; then
344
	if f_isset debugFile; then
328
		# Give partedit the path to our logfile so it can append
345
		# Give partedit the path to our logfile so it can append
329
		BSDINSTALL_LOG="${debugFile#+}" bsdinstall partedit || error "Partitioning error"
346
		BSDINSTALL_LOG="${debugFile#+}" bsdinstall partedit || error "Partitioning error"
330
	else
347
	else
331
		bsdinstall partedit || error "Partitioning error"
348
		bsdinstall partedit || error "Partitioning error"
332
	fi
349
	fi
333
	bsdinstall mount || error "Failed to mount filesystem"
350
	bsdinstall mount || error "Failed to mount filesystem"
334
	;;
351
	;;
335
*)
352
*)
336
	error "Unknown partitioning mode"
353
	error "Unknown partitioning mode"
337
	;;
354
	;;
338
esac
355
esac
339
356
340
[ -f /usr/libexec/bsdinstall/local.pre-fetch ] && f_dprintf "Running local.pre-fetch" && sh /usr/libexec/bsdinstall/local.pre-fetch "$BSDINSTALL_CHROOT"
357
[ -f /usr/libexec/bsdinstall/local.pre-fetch ] && f_dprintf "Running local.pre-fetch" && sh /usr/libexec/bsdinstall/local.pre-fetch "$BSDINSTALL_CHROOT"
341
358
342
if [ -n "$FETCH_DISTRIBUTIONS" ]; then
359
if [ -n "$FETCH_DISTRIBUTIONS" ]; then
343
	exec 5>&1
360
	exec 5>&1
344
	export BSDINSTALL_DISTDIR=$(`dirname $0`/fetchmissingdists 2>&1 1>&5)
361
	export BSDINSTALL_DISTDIR=$(`dirname $0`/fetchmissingdists 2>&1 1>&5)
345
	FETCH_RESULT=$?
362
	FETCH_RESULT=$?
346
	exec 5>&-
363
	exec 5>&-
347
364
348
	[ $FETCH_RESULT -ne 0 ] && error "Could not fetch remote distributions"
365
	[ $FETCH_RESULT -ne 0 ] && error "Could not fetch remote distributions"
349
fi
366
fi
350
bsdinstall checksum || error "Distribution checksum failed"
367
bsdinstall checksum || error "Distribution checksum failed"
351
bsdinstall distextract || error "Distribution extract failed"
368
bsdinstall distextract || error "Distribution extract failed"
352
369
353
# Set up boot loader
370
# Set up boot loader
354
bsdinstall bootconfig || error "Failed to configure bootloader"
371
bsdinstall bootconfig || error "Failed to configure bootloader"
355
372
356
[ -f /usr/libexec/bsdinstall/local.pre-configure ] && f_dprintf "Running local.pre-configure" && sh /usr/libexec/bsdinstall/local.pre-configure "$BSDINSTALL_CHROOT"
373
[ -f /usr/libexec/bsdinstall/local.pre-configure ] && f_dprintf "Running local.pre-configure" && sh /usr/libexec/bsdinstall/local.pre-configure "$BSDINSTALL_CHROOT"
357
374
358
bsdinstall rootpass || error "Could not set root password"
375
bsdinstall rootpass || error "Could not set root password"
359
376
360
trap true SIGINT	# This section is optional
377
trap true SIGINT	# This section is optional
361
if [ "$NETCONFIG_DONE" != yes ]; then
378
if [ "$NETCONFIG_DONE" != yes ]; then
362
	bsdinstall netconfig	# Don't check for errors -- the user may cancel
379
	bsdinstall netconfig	# Don't check for errors -- the user may cancel
363
fi
380
fi
364
[ -z "$BSDINSTALL_SKIP_TIME" ] && bsdinstall time
381
[ -z "$BSDINSTALL_SKIP_TIME" ] && bsdinstall time
365
[ -z "$BSDINSTALL_SKIP_SERVICES" ] && bsdinstall services
382
[ -z "$BSDINSTALL_SKIP_SERVICES" ] && bsdinstall services
366
[ -z "$BSDINSTALL_SKIP_HARDENING" ] && bsdinstall hardening
383
[ -z "$BSDINSTALL_SKIP_HARDENING" ] && bsdinstall hardening
367
384
368
[ -z "$BSDINSTALL_SKIP_USERS" ] && bsddialog --backtitle "$OSNAME Installer" \
385
[ -z "$BSDINSTALL_SKIP_USERS" ] && bsddialog --backtitle "$OSNAME Installer" \
369
	--title "Add User Accounts" --yesno \
386
	--title "Add User Accounts" --yesno \
370
    "Would you like to add users to the installed system now?" 0 0 && \
387
    "Would you like to add users to the installed system now?" 0 0 && \
371
    bsdinstall adduser
388
    bsdinstall adduser
372
389
373
# Allow user to change his mind
390
# Allow user to change his mind
374
[ -z "$BSDINSTALL_SKIP_FINALCONFIG" ] && bsdinstall finalconfig
391
[ -z "$BSDINSTALL_SKIP_FINALCONFIG" ] && bsdinstall finalconfig
375
392
376
trap error SIGINT	# SIGINT is bad again
393
trap error SIGINT	# SIGINT is bad again
377
bsdinstall config  || error "Failed to save config"
394
bsdinstall config  || error "Failed to save config"
378
395
379
if [ ! -z "$BSDINSTALL_FETCHDEST" ]; then
396
if [ ! -z "$BSDINSTALL_FETCHDEST" ]; then
380
	rm -rf "$BSDINSTALL_FETCHDEST"
397
	rm -rf "$BSDINSTALL_FETCHDEST"
381
fi
398
fi
382
399
383
[ -f /usr/libexec/bsdinstall/local.post-configure ] && f_dprintf "Running local.post-configure" && sh /usr/libexec/bsdinstall/local.post-configure "$BSDINSTALL_CHROOT"
400
[ -f /usr/libexec/bsdinstall/local.post-configure ] && f_dprintf "Running local.post-configure" && sh /usr/libexec/bsdinstall/local.post-configure "$BSDINSTALL_CHROOT"
384
401
385
if [ -z "$BSDINSTALL_SKIP_MANUAL" ]; then
402
if [ -z "$BSDINSTALL_SKIP_MANUAL" ]; then
386
	bsddialog --backtitle "$OSNAME Installer" --title "Manual Configuration" \
403
	bsddialog --backtitle "$OSNAME Installer" --title "Manual Configuration" \
387
		--default-no --yesno \
404
		--default-no --yesno \
388
		"The installation is now finished. Before exiting the installer, would you like to open a shell in the new system to make any final manual modifications?" 0 0
405
		"The installation is now finished. Before exiting the installer, would you like to open a shell in the new system to make any final manual modifications?" 0 0
389
	if [ $? -eq 0 ]; then
406
	if [ $? -eq 0 ]; then
390
		clear
407
		clear
391
		echo This shell is operating in a chroot in the new system. \
408
		echo This shell is operating in a chroot in the new system. \
392
		    When finished making configuration changes, type \"exit\".
409
		    When finished making configuration changes, type \"exit\".
393
		chroot "$BSDINSTALL_CHROOT" /bin/sh 2>&1
410
		chroot "$BSDINSTALL_CHROOT" /bin/sh 2>&1
394
	fi
411
	fi
395
fi
412
fi
396
413
397
bsdinstall entropy
414
bsdinstall entropy
398
bsdinstall umount
415
bsdinstall umount
399
416
400
f_dprintf "Installation Completed at %s" "$( date )"
417
f_dprintf "Installation Completed at %s" "$( date )"
401
418
402
################################################################################
419
################################################################################
403
# END
420
# END
404
################################################################################
421
################################################################################
(-)b/usr.sbin/bsdinstall/scripts/jail (-2 / +15 lines)
Lines 1-165 Link Here
1
#!/bin/sh
1
#!/bin/sh
2
#-
2
#-
3
# Copyright (c) 2011 Nathan Whitehorn
3
# Copyright (c) 2011 Nathan Whitehorn
4
# Copyright (c) 2013-2015 Devin Teske
4
# Copyright (c) 2013-2015 Devin Teske
5
# All rights reserved.
5
# All rights reserved.
6
#
6
#
7
# Redistribution and use in source and binary forms, with or without
7
# Redistribution and use in source and binary forms, with or without
8
# modification, are permitted provided that the following conditions
8
# modification, are permitted provided that the following conditions
9
# are met:
9
# are met:
10
# 1. Redistributions of source code must retain the above copyright
10
# 1. Redistributions of source code must retain the above copyright
11
#    notice, this list of conditions and the following disclaimer.
11
#    notice, this list of conditions and the following disclaimer.
12
# 2. Redistributions in binary form must reproduce the above copyright
12
# 2. Redistributions in binary form must reproduce the above copyright
13
#    notice, this list of conditions and the following disclaimer in the
13
#    notice, this list of conditions and the following disclaimer in the
14
#    documentation and/or other materials provided with the distribution.
14
#    documentation and/or other materials provided with the distribution.
15
#
15
#
16
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
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
17
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
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
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
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
25
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26
# SUCH DAMAGE.
26
# SUCH DAMAGE.
27
#
27
#
28
#
28
#
29
############################################################ INCLUDES
29
############################################################ INCLUDES
30
30
31
BSDCFG_SHARE="/usr/share/bsdconfig"
31
BSDCFG_SHARE="/usr/share/bsdconfig"
32
. $BSDCFG_SHARE/common.subr || exit 1
32
. $BSDCFG_SHARE/common.subr || exit 1
33
33
34
############################################################ MAIN
34
############################################################ MAIN
35
35
36
: ${BSDDIALOG_OK=0}
36
: ${BSDDIALOG_OK=0}
37
37
38
f_dprintf "Began Installation at %s" "$( date )"
38
f_dprintf "Began Installation at %s" "$( date )"
39
39
40
error() {
40
error() {
41
	local msg
41
	local msg
42
	if [ -n "$1" ]; then
42
	if [ -n "$1" ]; then
43
		msg="$1\n\n"
43
		msg="$1\n\n"
44
	fi
44
	fi
45
	bsddialog --backtitle "$OSNAME Installer" --title "Abort" \
45
	bsddialog --backtitle "$OSNAME Installer" --title "Abort" \
46
	    --no-label "Exit" --yes-label "Restart" --yesno \
46
	    --no-label "Exit" --yes-label "Restart" --yesno \
47
	    "${msg}An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0
47
	    "${msg}An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0
48
	if [ $? -ne $BSDDIALOG_OK ]; then
48
	if [ $? -ne $BSDDIALOG_OK ]; then
49
		exit
49
		exit
50
	else
50
	else
51
		[ -z "$MIRROR_BUTTON" ] || unset BSDINSTALL_DISTSITE
51
		environment_restore
52
		exec $0 $BSDINSTALL_CHROOT
52
		exec $0 $BSDINSTALL_CHROOT
53
	fi
53
	fi
54
}
54
}
55
55
56
environment_restore()
57
{
58
	BSDINSTALL_DISTSITE="$ORIG_BSDINSTALL_DISTSITE"
59
	DISTRIBUTIONS="$ORIG_DISTRIBUTIONS"
60
}
61
62
environment_save()
63
{
64
	ORIG_BSDINSTALL_DISTSITE="$BSDINSTALL_DISTSITE"
65
	ORIG_DISTRIBUTIONS="$DISTRIBUTIONS"
66
}
67
56
if [ -z "$1" ]; then
68
if [ -z "$1" ]; then
57
	error "Directory can not be empty\n\nUsage:\nbsdinstall jail directory"
69
	error "Directory can not be empty\n\nUsage:\nbsdinstall jail directory"
58
fi
70
fi
59
export BSDINSTALL_CHROOT=$1
71
export BSDINSTALL_CHROOT=$1
60
72
73
environment_save
74
61
rm -rf $BSDINSTALL_TMPETC
75
rm -rf $BSDINSTALL_TMPETC
62
mkdir $BSDINSTALL_TMPETC
76
mkdir $BSDINSTALL_TMPETC
63
mkdir -p $1 || error "mkdir failed for $1"
77
mkdir -p $1 || error "mkdir failed for $1"
64
78
65
if [ -n "$SCRIPT" ]
79
if [ -n "$SCRIPT" ]
66
then
80
then
67
        split -a 2 -p '^#!.*' "$SCRIPT" $TMPDIR/bsdinstall-installscript-
81
        split -a 2 -p '^#!.*' "$SCRIPT" $TMPDIR/bsdinstall-installscript-
68
        . $TMPDIR/bsdinstall-installscript-aa
82
        . $TMPDIR/bsdinstall-installscript-aa
69
fi
83
fi
70
84
71
test ! -d $BSDINSTALL_DISTDIR && mkdir -p $BSDINSTALL_DISTDIR
85
test ! -d $BSDINSTALL_DISTDIR && mkdir -p $BSDINSTALL_DISTDIR
72
86
73
if [ ! -f $BSDINSTALL_DISTDIR/MANIFEST -a -z "$BSDINSTALL_DISTSITE" ]; then
87
if [ ! -f $BSDINSTALL_DISTDIR/MANIFEST -a -z "$BSDINSTALL_DISTSITE" ]; then
74
	exec 5>&1
88
	exec 5>&1
75
	BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&5)
89
	BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&5)
76
	MIRROR_BUTTON=$?
90
	MIRROR_BUTTON=$?
77
	exec 5>&-
91
	exec 5>&-
78
	test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
92
	test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
79
	export BSDINSTALL_DISTSITE
93
	export BSDINSTALL_DISTSITE
80
	fetch -o $BSDINSTALL_DISTDIR/MANIFEST $BSDINSTALL_DISTSITE/MANIFEST || error "Could not download $BSDINSTALL_DISTSITE/MANIFEST"
94
	fetch -o $BSDINSTALL_DISTDIR/MANIFEST $BSDINSTALL_DISTSITE/MANIFEST || error "Could not download $BSDINSTALL_DISTSITE/MANIFEST"
81
fi
95
fi
82
96
83
: ${DISTRIBUTIONS="base.txz"}; export DISTRIBUTIONS
97
: ${DISTRIBUTIONS="base.txz"}; export DISTRIBUTIONS
84
if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then
98
if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then
85
	DISTMENU=`cut -f 4,5,6 $BSDINSTALL_DISTDIR/MANIFEST | grep -v -e ^kernel -e ^base`
99
	DISTMENU=`cut -f 4,5,6 $BSDINSTALL_DISTDIR/MANIFEST | grep -v -e ^kernel -e ^base`
86
100
87
    if [ ! "$nonInteractive" == "YES" ]
101
    if [ ! "$nonInteractive" == "YES" ]
88
    then
102
    then
89
	    exec 5>&1
103
	    exec 5>&1
90
	    EXTRA_DISTS=$(echo $DISTMENU | xargs -o bsddialog \
104
	    EXTRA_DISTS=$(echo $DISTMENU | xargs -o bsddialog \
91
	        --backtitle "$OSNAME Installer" \
105
	        --backtitle "$OSNAME Installer" \
92
	        --title "Distribution Select" --no-cancel --separate-output \
106
	        --title "Distribution Select" --no-cancel --separate-output \
93
	        --checklist "Choose optional system components to install:" \
107
	        --checklist "Choose optional system components to install:" \
94
	        0 0 0 \
108
	        0 0 0 \
95
	    2>&1 1>&5)
109
	    2>&1 1>&5)
96
	    for dist in $EXTRA_DISTS; do
110
	    for dist in $EXTRA_DISTS; do
97
	    	export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz"
111
	    	export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz"
98
	    done
112
	    done
99
    fi
113
    fi
100
fi
114
fi
101
115
102
FETCH_DISTRIBUTIONS=""
116
FETCH_DISTRIBUTIONS=""
103
for dist in $DISTRIBUTIONS; do
117
for dist in $DISTRIBUTIONS; do
104
	if [ ! -f $BSDINSTALL_DISTDIR/$dist ]; then
118
	if [ ! -f $BSDINSTALL_DISTDIR/$dist ]; then
105
		FETCH_DISTRIBUTIONS="$FETCH_DISTRIBUTIONS $dist"
119
		FETCH_DISTRIBUTIONS="$FETCH_DISTRIBUTIONS $dist"
106
	fi
120
	fi
107
done
121
done
108
FETCH_DISTRIBUTIONS=`echo $FETCH_DISTRIBUTIONS`	# Trim white space
122
FETCH_DISTRIBUTIONS=`echo $FETCH_DISTRIBUTIONS`	# Trim white space
109
123
110
if [ -n "$FETCH_DISTRIBUTIONS" -a -z "$BSDINSTALL_DISTSITE" ]; then
124
if [ -n "$FETCH_DISTRIBUTIONS" -a -z "$BSDINSTALL_DISTSITE" ]; then
111
	exec 5>&1
125
	exec 5>&1
112
	BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&5)
126
	BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&5)
113
	MIRROR_BUTTON=$?
127
	MIRROR_BUTTON=$?
114
	exec 5>&-
128
	exec 5>&-
115
	test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
129
	test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
116
	export BSDINSTALL_DISTSITE
130
	export BSDINSTALL_DISTSITE
117
fi
131
fi
118
132
119
if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
133
if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
120
	bsdinstall distfetch || error "Failed to fetch distribution"
134
	bsdinstall distfetch || error "Failed to fetch distribution"
121
fi
135
fi
122
136
123
bsdinstall checksum || error "Distribution checksum failed"
137
bsdinstall checksum || error "Distribution checksum failed"
124
bsdinstall distextract || error "Distribution extract failed"
138
bsdinstall distextract || error "Distribution extract failed"
125
139
126
if [ ! "$nonInteractive" == "YES" ]
140
if [ ! "$nonInteractive" == "YES" ]
127
then
141
then
128
    bsdinstall rootpass || error "Could not set root password"
142
    bsdinstall rootpass || error "Could not set root password"
129
fi
143
fi
130
144
131
trap true SIGINT	# This section is optional
145
trap true SIGINT	# This section is optional
132
146
133
if [ ! "$nonInteractive" == "YES" ]
147
if [ ! "$nonInteractive" == "YES" ]
134
then
148
then
135
bsdinstall services
149
bsdinstall services
136
150
137
    bsddialog --backtitle "$OSNAME Installer" --title "Add User Accounts" --yesno \
151
    bsddialog --backtitle "$OSNAME Installer" --title "Add User Accounts" --yesno \
138
        "Would you like to add users to the installed system now?" 0 0 && \
152
        "Would you like to add users to the installed system now?" 0 0 && \
139
        bsdinstall adduser
153
        bsdinstall adduser
140
fi
154
fi
141
155
142
trap error SIGINT	# SIGINT is bad again
156
trap error SIGINT	# SIGINT is bad again
143
bsdinstall config  || error "Failed to save config"
157
bsdinstall config  || error "Failed to save config"
144
cp /etc/resolv.conf $1/etc
158
cp /etc/resolv.conf $1/etc
145
cp /etc/localtime $1/etc
159
cp /etc/localtime $1/etc
146
cp /var/db/zoneinfo $1/var/db
160
cp /var/db/zoneinfo $1/var/db
147
161
148
# Run post-install script
162
# Run post-install script
149
if [ -f $TMPDIR/bsdinstall-installscript-ab ]; then
163
if [ -f $TMPDIR/bsdinstall-installscript-ab ]; then
150
	cp $TMPDIR/bsdinstall-installscript-ab $BSDINSTALL_CHROOT/tmp/installscript
164
	cp $TMPDIR/bsdinstall-installscript-ab $BSDINSTALL_CHROOT/tmp/installscript
151
	chmod a+x $BSDINSTALL_CHROOT/tmp/installscript
165
	chmod a+x $BSDINSTALL_CHROOT/tmp/installscript
152
	mount -t devfs devfs "$BSDINSTALL_CHROOT/dev"
166
	mount -t devfs devfs "$BSDINSTALL_CHROOT/dev"
153
	chroot $BSDINSTALL_CHROOT /tmp/installscript $@ 2>&1
167
	chroot $BSDINSTALL_CHROOT /tmp/installscript $@ 2>&1
154
	umount "$BSDINSTALL_CHROOT/dev"
168
	umount "$BSDINSTALL_CHROOT/dev"
155
	rm $BSDINSTALL_CHROOT/tmp/installscript
169
	rm $BSDINSTALL_CHROOT/tmp/installscript
156
fi
170
fi
157
171
158
bsdinstall entropy
172
bsdinstall entropy
159
173
160
f_dprintf "Installation Completed at %s" "$(date)"
174
f_dprintf "Installation Completed at %s" "$(date)"
161
exit $SUCCESS
175
exit $SUCCESS
162
176
163
################################################################################
177
################################################################################
164
# END
178
# END
165
################################################################################
179
################################################################################
166
- 

Return to bug 266987