functions-cleanup.sh (217170) | functions-cleanup.sh (217234) |
---|---|
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-cleanup.sh 217170 2011-01-08 22:42:56Z jpaetzel $ | 26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh 217234 2011-01-10 19:57:18Z jpaetzel $ |
27 28# Functions which perform the final cleanup after an install 29 30# Finishes up with ZFS setup before unmounting 31zfs_cleanup_unmount() 32{ 33 # Loop through our FS and see if we have any ZFS partitions to cleanup 34 for PART in `ls ${PARTDIR}` --- 331 unchanged lines hidden (view full) --- 366 echo 'geom_journal_load="YES"' >>${FSMNT}/boot/loader.conf 367 fi 368 369}; 370 371# Function which sets the root password from the install config 372set_root_pw() 373{ | 27 28# Functions which perform the final cleanup after an install 29 30# Finishes up with ZFS setup before unmounting 31zfs_cleanup_unmount() 32{ 33 # Loop through our FS and see if we have any ZFS partitions to cleanup 34 for PART in `ls ${PARTDIR}` --- 331 unchanged lines hidden (view full) --- 366 echo 'geom_journal_load="YES"' >>${FSMNT}/boot/loader.conf 367 fi 368 369}; 370 371# Function which sets the root password from the install config 372set_root_pw() 373{ |
374 # Get the plaintext string |
|
374 get_value_from_cfg_with_spaces rootPass | 375 get_value_from_cfg_with_spaces rootPass |
375 PW="${VAL}" | 376 local PW="${VAL}" |
376 | 377 |
378 # Get the encrypted string 379 get_value_from_cfg_with_spaces rootEncPass 380 local ENCPW="${VAL}" 381 |
|
377 # If we don't have a root pass, return | 382 # If we don't have a root pass, return |
378 if [ -z "${PW}" ] 379 then 380 return 0 381 fi | 383 if [ -z "${PW}" -a -z "${ENCPW}" ] ; then return 0 ; fi |
382 383 echo_log "Setting root password" | 384 385 echo_log "Setting root password" |
384 echo "${PW}" > ${FSMNT}/.rootpw 385 run_chroot_cmd "cat /.rootpw | pw usermod root -h 0" 386 rc_halt "rm ${FSMNT}/.rootpw" | |
387 | 386 |
387 # Check if setting plaintext password 388 if [ ! -z "${PW}" ] ; then 389 echo "${PW}" > ${FSMNT}/.rootpw 390 run_chroot_cmd "cat /.rootpw | pw usermod root -h 0" 391 rc_halt "rm ${FSMNT}/.rootpw" 392 fi 393 394 # Check if setting encrypted password 395 if [ ! -z "${ENCPW}" ] ; then 396 echo "${ENCPW}" > ${FSMNT}/.rootpw 397 run_chroot_cmd "cat /.rootpw | pw usermod root -H 0" 398 rc_halt "rm ${FSMNT}/.rootpw" 399 fi 400 |
|
388}; 389 390 391run_final_cleanup() 392{ 393 # Check if we need to run any gmirror setup 394 ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null 395 if [ "$?" = "0" ] --- 22 unchanged lines hidden --- | 401}; 402 403 404run_final_cleanup() 405{ 406 # Check if we need to run any gmirror setup 407 ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null 408 if [ "$?" = "0" ] --- 22 unchanged lines hidden --- |