Deleted Added
full compact
functions.sh (211730) functions.sh (212337)
1#!/bin/sh
2#-
3# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright

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

18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24# SUCH DAMAGE.
25#
1#!/bin/sh
2#-
3# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright

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

18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24# SUCH DAMAGE.
25#
26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions.sh 211730 2010-08-24 06:11:46Z imp $
26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions.sh 212337 2010-09-08 20:10:24Z imp $
27
28# functions.sh
29# Library of functions which pc-sysinstall may call upon
30
31# Function which displays the help-index file
32display_help()
33{
34 if [ -e "${PROGDIR}/doc/help-index" ]

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

278 # Need to generate a zpool name for this device
279 NUM=`ls ${TMPDIR}/.zpools/ | wc -l | sed 's| ||g'`
280 NEWNAME="${BASENAME}${NUM}"
281 echo "$NEWNAME" >${TMPDIR}/.zpools/${DEVICE}
282 echo "${NEWNAME}"
283 return
284 fi
285};
27
28# functions.sh
29# Library of functions which pc-sysinstall may call upon
30
31# Function which displays the help-index file
32display_help()
33{
34 if [ -e "${PROGDIR}/doc/help-index" ]

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

278 # Need to generate a zpool name for this device
279 NUM=`ls ${TMPDIR}/.zpools/ | wc -l | sed 's| ||g'`
280 NEWNAME="${BASENAME}${NUM}"
281 echo "$NEWNAME" >${TMPDIR}/.zpools/${DEVICE}
282 echo "${NEWNAME}"
283 return
284 fi
285};
286
287write_image()
288{
289 IMAGE_FILE="$1"
290 DEVICE_FILE="$2"
291
292 if [ -z "${IMAGE_FILE}" ]
293 then
294 echo "ERROR: Image file not specified!"
295 exit 1
296 fi
297
298 if [ -z "${DEVICE_FILE}" ]
299 then
300 echo "ERROR: Device file not specified!"
301 exit 1
302 fi
303
304 if [ ! -f "${IMAGE_FILE}" ]
305 then
306 echo "ERROR: '${IMAGE_FILE}' does not exist!"
307 exit 1
308 fi
309
310 DEVICE_FILE="${DEVICE_FILE#/dev/}"
311 DEVICE_FILE="/dev/${DEVICE_FILE}"
312
313 if [ ! -c "${DEVICE_FILE}" ]
314 then
315 echo "ERROR: '${DEVICE_FILE}' is not a character device!"
316 exit 1
317 fi
318
319 if [ "${RES}" = "0" ]
320 then
321 rc_halt "dd if=${IMAGE_FILE} of=${DEVICE_FILE} ibs=16k obs=16k"
322 fi
323
324 return 0
325};
326
327install_fresh()
328{
329 # Lets start setting up the disk slices now
330 setup_disk_slice
331
332 # Disk setup complete, now lets parse WORKINGSLICES and setup the bsdlabels
333 setup_disk_label
334
335 # Now we've setup the bsdlabels, lets go ahead and run newfs / zfs
336 # to setup the filesystems
337 setup_filesystems
338
339 # Lets mount the partitions now
340 mount_all_filesystems
341
342 # We are ready to begin extraction, lets start now
343 init_extraction
344
345 # Check if we have any optional modules to load
346 install_components
347
348 # Check if we have any packages to install
349 install_packages
350
351 # Do any localization in configuration
352 run_localize
353
354 # Save any networking config on the installed system
355 save_networking_install
356
357 # Now add any users
358 setup_users
359
360 # Now run any commands specified
361 run_commands
362
363 # Do any last cleanup / setup before unmounting
364 run_final_cleanup
365
366 # Unmount and finish up
367 unmount_all_filesystems
368
369 echo_log "Installation finished!"
370}
371
372install_upgrade()
373{
374 # We're going to do an upgrade, skip all the disk setup
375 # and start by mounting the target drive/slices
376 mount_upgrade
377
378 # Start the extraction process
379 init_extraction
380
381 # Do any localization in configuration
382 run_localize
383
384 # ow run any commands specified
385 run_commands
386
387 # Merge any old configuration files
388 merge_old_configs
389
390 # Check if we have any optional modules to load
391 install_components
392
393 # Check if we have any packages to install
394 install_packages
395
396 # All finished, unmount the file-systems
397 unmount_upgrade
398
399 echo_log "Upgrade finished!"
400}