functions-installcomponents.sh (209552) | functions-installcomponents.sh (211730) |
---|---|
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-installcomponents.sh 209552 2010-06-27 16:46:11Z imp $ | 26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh 211730 2010-08-24 06:11:46Z imp $ |
27 28# Functions which check and load any optional modules specified in the config 29 30. ${BACKEND}/functions.sh 31. ${BACKEND}/functions-parse.sh 32 33copy_component() 34{ --- 12 unchanged lines hidden (view full) --- 47 48 # Lets start by downloading / copying the files this component needs 49 while read line 50 do 51 CFILE="`echo $line | cut -d ':' -f 1`" 52 CFILEMD5="`echo $line | cut -d ':' -f 2`" 53 CFILE2MD5="`echo $line | cut -d ':' -f 3`" 54 | 27 28# Functions which check and load any optional modules specified in the config 29 30. ${BACKEND}/functions.sh 31. ${BACKEND}/functions-parse.sh 32 33copy_component() 34{ --- 12 unchanged lines hidden (view full) --- 47 48 # Lets start by downloading / copying the files this component needs 49 while read line 50 do 51 CFILE="`echo $line | cut -d ':' -f 1`" 52 CFILEMD5="`echo $line | cut -d ':' -f 2`" 53 CFILE2MD5="`echo $line | cut -d ':' -f 3`" 54 |
55 | |
56 case ${INSTALLMEDIUM} in | 55 case ${INSTALLMEDIUM} in |
57 dvd|usb) # On both dvd / usb, we can just copy the file 58 cp ${CDMNT}/${COMPFILEDIR}/${SUBDIR}/${CFILE} \ 59 ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT} | 56 dvd|usb) 57 # On both dvd / usb, we can just copy the file 58 cp ${CDMNT}/${COMPFILEDIR}/${SUBDIR}/${CFILE} \ 59 ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT} |
60 RESULT="$?" | 60 RESULT="$?" |
61 ;; 62 ftp) get_value_from_cfg ftpPath 63 if [ -z "$VAL" ] 64 then 65 exit_err "ERROR: Install medium was set to ftp, but no ftpPath was provided!" 66 fi 67 FTPPATH="${VAL}" | 61 ;; |
68 | 62 |
69 fetch_file "${FTPPATH}/${COMPFILEDIR}/${SUBDIR}/${CFILE}" "${FSMNT}/${COMPTMPDIR}/${CFILE}" "0" 70 RESULT="$?" 71 ;; | 63 ftp|sftp) 64 get_value_from_cfg ftpPath 65 if [ -z "$VAL" ] 66 then 67 exit_err "ERROR: Install medium was set to ftp, but no ftpPath was provided!" 68 fi 69 FTPPATH="${VAL}" 70 71 fetch_file "${FTPPATH}/${COMPFILEDIR}/${SUBDIR}/${CFILE}" "${FSMNT}/${COMPTMPDIR}/${CFILE}" "0" 72 RESULT="$?" 73 ;; |
72 esac 73 74 if [ "${RESULT}" != "0" ] 75 then 76 echo_log "WARNING: Failed to copy ${CFILE}" 77 FAILED="1" 78 else 79 # Now lets check the MD5 to confirm the file is valid --- 35 unchanged lines hidden (view full) --- 115COMPTMPDIR=\"${COMPTMPDIR}\" 116export COMPTMPDIR 117CFILE=\"${CFILE}\" 118export CFILE 119 120sh ${COMPTMPDIR}/install.sh 121 122" >${FSMNT}/.componentwrapper.sh | 74 esac 75 76 if [ "${RESULT}" != "0" ] 77 then 78 echo_log "WARNING: Failed to copy ${CFILE}" 79 FAILED="1" 80 else 81 # Now lets check the MD5 to confirm the file is valid --- 35 unchanged lines hidden (view full) --- 117COMPTMPDIR=\"${COMPTMPDIR}\" 118export COMPTMPDIR 119CFILE=\"${CFILE}\" 120export CFILE 121 122sh ${COMPTMPDIR}/install.sh 123 124" >${FSMNT}/.componentwrapper.sh |
123 chmod 755 ${FSMNT}/.componentwrapper.sh | 125 chmod 755 ${FSMNT}/.componentwrapper.sh |
124 | 126 |
125 # Copy over the install script for this component 126 cp ${COMPDIR}/${COMPONENT}/install.sh ${FSMNT}/${COMPTMPDIR}/ | 127 # Copy over the install script for this component 128 cp ${COMPDIR}/${COMPONENT}/install.sh ${FSMNT}/${COMPTMPDIR}/ |
127 | 129 |
128 echo_log "INSTALL COMPONENT: ${i}" 129 chroot ${FSMNT} /.componentwrapper.sh >>${LOGOUT} 2>>${LOGOUT} 130 rm ${FSMNT}/.componentwrapper.sh | 130 echo_log "INSTALL COMPONENT: ${i}" 131 chroot ${FSMNT} /.componentwrapper.sh >>${LOGOUT} 2>>${LOGOUT} 132 rm ${FSMNT}/.componentwrapper.sh |
131 | 133 |
132 | |
133}; 134 135# Check for any modules specified, and begin loading them 136install_components() 137{ | 134}; 135 136# Check for any modules specified, and begin loading them 137install_components() 138{ |
138 # First, lets check and see if we even have any optional modules 139 get_value_from_cfg installComponents 140 if [ ! -z "${VAL}" ] 141 then 142 # Lets start by cleaning up the string and getting it ready to parse 143 strip_white_space ${VAL} 144 COMPONENTS=`echo ${VAL} | sed -e "s|,| |g"` 145 for i in $COMPONENTS 146 do 147 if [ ! -e "${COMPDIR}/${i}/install.sh" -o ! -e "${COMPDIR}/${i}/distfiles" ] 148 then 149 echo_log "WARNING: Component ${i} doesn't seem to exist" 150 else | 139 # First, lets check and see if we even have any optional modules 140 get_value_from_cfg installComponents 141 if [ ! -z "${VAL}" ] 142 then 143 # Lets start by cleaning up the string and getting it ready to parse 144 strip_white_space ${VAL} 145 COMPONENTS=`echo ${VAL} | sed -e "s|,| |g"` 146 for i in $COMPONENTS 147 do 148 if [ ! -e "${COMPDIR}/${i}/install.sh" -o ! -e "${COMPDIR}/${i}/distfiles" ] 149 then 150 echo_log "WARNING: Component ${i} doesn't seem to exist" 151 else |
151 | 152 |
152 # Make the tmpdir on the disk 153 mkdir -p ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT} | 153 # Make the tmpdir on the disk 154 mkdir -p ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT} |
154 | 155 |
155 # Start by grabbing the component files 156 copy_component ${i} | 156 # Start by grabbing the component files 157 copy_component ${i} |
157 | 158 |
158 # Remove the tmpdir now 159 rm -rf ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT} | 159 # Remove the tmpdir now 160 rm -rf ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT} 161 fi 162 done 163 fi |
160 | 164 |
161 fi 162 done 163 164 fi 165 | |
166}; | 165}; |