functions-cleanup.sh (222365) | functions-cleanup.sh (232899) |
---|---|
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 222365 2011-05-27 16:17:35Z kevlo $ | 26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh 232899 2012-03-12 21:32:43Z 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}` 35 do 36 PARTDEV=`echo $PART | sed 's|-|/|g'` | 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}` 35 do 36 PARTDEV=`echo $PART | sed 's|-|/|g'` |
37 PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`" 38 PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`" | 37 PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" 38 PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" |
39 ZPOOLNAME=$(get_zpool_name "${PARTDEV}") 40 41 if [ "$PARTFS" = "ZFS" ] 42 then 43 # Check if we have multiple zfs mounts specified 44 for ZMNT in `echo ${PARTMNT} | sed 's|,| |g'` 45 do 46 if [ "${ZMNT}" = "/" ] --- 32 unchanged lines hidden (view full) --- 79 # Copy the hostid so that our zfs cache works 80 cp /etc/hostid ${FSMNT}/etc/hostid 81 fi 82 83 # Loop through our FS and see if we have any ZFS partitions to cleanup 84 for PART in `ls ${PARTDIR}` 85 do 86 PARTDEV=`echo $PART | sed 's|-|/|g'` | 39 ZPOOLNAME=$(get_zpool_name "${PARTDEV}") 40 41 if [ "$PARTFS" = "ZFS" ] 42 then 43 # Check if we have multiple zfs mounts specified 44 for ZMNT in `echo ${PARTMNT} | sed 's|,| |g'` 45 do 46 if [ "${ZMNT}" = "/" ] --- 32 unchanged lines hidden (view full) --- 79 # Copy the hostid so that our zfs cache works 80 cp /etc/hostid ${FSMNT}/etc/hostid 81 fi 82 83 # Loop through our FS and see if we have any ZFS partitions to cleanup 84 for PART in `ls ${PARTDIR}` 85 do 86 PARTDEV=`echo $PART | sed 's|-|/|g'` |
87 PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`" 88 PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`" 89 PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`" | 87 PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" 88 PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" 89 PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" |
90 ZPOOLNAME=$(get_zpool_name "${PARTDEV}") 91 92 if [ "$PARTFS" = "ZFS" ] 93 then 94 95 # Create a list of zpool names we can export 96 echo $ZPOOLEXPORTS | grep -q "$ZPOOLNAME " 97 if [ $? -ne 0 ] ; then 98 export ZPOOLEXPORTS="$ZPOOLNAME $ZPOOLEXPORTS" 99 fi 100 101 # Check if we have multiple zfs mounts specified 102 for ZMNT in `echo ${PARTMNT} | sed 's|,| |g'` 103 do | 90 ZPOOLNAME=$(get_zpool_name "${PARTDEV}") 91 92 if [ "$PARTFS" = "ZFS" ] 93 then 94 95 # Create a list of zpool names we can export 96 echo $ZPOOLEXPORTS | grep -q "$ZPOOLNAME " 97 if [ $? -ne 0 ] ; then 98 export ZPOOLEXPORTS="$ZPOOLNAME $ZPOOLEXPORTS" 99 fi 100 101 # Check if we have multiple zfs mounts specified 102 for ZMNT in `echo ${PARTMNT} | sed 's|,| |g'` 103 do |
104 ZMNT="`echo $ZMNT | cut -d '(' -f 1`" |
|
104 PARTMNTREV="${ZMNT} ${PARTMNTREV}" 105 done 106 107 for ZMNT in ${PARTMNTREV} 108 do | 105 PARTMNTREV="${ZMNT} ${PARTMNTREV}" 106 done 107 108 for ZMNT in ${PARTMNTREV} 109 do |
109 if [ "${ZMNT}" != "/" ] 110 then 111 rc_halt "zfs set mountpoint=${ZMNT} ${ZPOOLNAME}${ZMNT}" | 110 if [ "${ZMNT}" = "/" ] ; then continue ; fi 111 # Some ZFS like /swap aren't mounted, and dont need unmounting 112 mount | grep -q "${FSMNT}${ZMNT}" 113 if [ $? -eq 0 ] ; then |
112 rc_halt "zfs unmount ${ZPOOLNAME}${ZMNT}" | 114 rc_halt "zfs unmount ${ZPOOLNAME}${ZMNT}" |
113 sleep 2 | 115 rc_halt "zfs set mountpoint=${ZMNT} ${ZPOOLNAME}${ZMNT}" |
114 fi | 116 fi |
117 sleep 2 |
|
115 done 116 fi 117 done 118 119}; 120 121# Function which performs the specific setup for using a /boot partition 122setup_dedicated_boot_part() --- 26 unchanged lines hidden (view full) --- 149 150 # Create the header 151 echo "# Device Mountpoint FStype Options Dump Pass" >> ${FSTAB} 152 153 # Loop through the partitions, and start creating /etc/fstab 154 for PART in `ls ${PARTDIR}` 155 do 156 PARTDEV=`echo $PART | sed 's|-|/|g'` | 118 done 119 fi 120 done 121 122}; 123 124# Function which performs the specific setup for using a /boot partition 125setup_dedicated_boot_part() --- 26 unchanged lines hidden (view full) --- 152 153 # Create the header 154 echo "# Device Mountpoint FStype Options Dump Pass" >> ${FSTAB} 155 156 # Loop through the partitions, and start creating /etc/fstab 157 for PART in `ls ${PARTDIR}` 158 do 159 PARTDEV=`echo $PART | sed 's|-|/|g'` |
157 PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`" 158 PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`" 159 PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`" 160 PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d ':' -f 4`" | 160 PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" 161 PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" 162 PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" 163 PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d '#' -f 4`" |
161 162 # Unset EXT 163 EXT="" 164 165 # Set mount options for file-systems 166 case $PARTFS in 167 UFS+J) MNTOPTS="rw,noatime,async" ;; 168 SWAP) MNTOPTS="sw" ;; --- 240 unchanged lines hidden --- | 164 165 # Unset EXT 166 EXT="" 167 168 # Set mount options for file-systems 169 case $PARTFS in 170 UFS+J) MNTOPTS="rw,noatime,async" ;; 171 SWAP) MNTOPTS="sw" ;; --- 240 unchanged lines hidden --- |