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-extractimage.sh 211487 2010-08-19 06:02:31Z imp $
27
28# Functions which perform the extraction / installation of system to disk
29
30. ${BACKEND}/functions-mountoptical.sh
31
32# Performs the extraction of data to disk from a uzip or tar archive
33start_extract_uzip_tar()
34{
--- 83 unchanged lines hidden (view full) ---
118
119 HERE=`pwd`
120 DIRS=`ls -d ${INSDIR}/*|grep -Ev '(uzip|kernels|src)'`
121 for dir in ${DIRS}
122 do
123 cd "${dir}"
124 if [ -f "install.sh" ]
125 then
126 echo_log "Extracting" `basename ${dir}`
127 echo "y" | sh install.sh >/dev/null
128 if [ "$?" != "0" ]
129 then
130 exit_err "ERROR: Failed extracting ${dir}"
131 fi
132 else
133 exit_err "ERROR: ${dir}/install.sh does not exist"
134 fi
135 done
136 cd "${HERE}"
137
138 KERNELS=`ls -d ${INSDIR}/*|grep kernels`
139 cd "${KERNELS}"
140 if [ -f "install.sh" ]
141 then
142 echo_log "Extracting" `basename ${KERNELS}`
143 echo "y" | sh install.sh generic >/dev/null
144 if [ "$?" != "0" ]
145 then
146 exit_err "ERROR: Failed extracting ${KERNELS}"
147 fi
148 echo 'kernel="GENERIC"' > "${FSMNT}/boot/loader.conf"
149 else
150 exit_err "ERROR: ${KERNELS}/install.sh does not exist"
151 fi
152 cd "${HERE}"
153
154 SOURCE=`ls -d ${INSDIR}/*|grep src`
155 cd "${SOURCE}"
156 if [ -f "install.sh" ]
157 then
158 echo_log "Extracting" `basename ${SOURCE}`
159 echo "y" | sh install.sh all >/dev/null
160 if [ "$?" != "0" ]
161 then
162 exit_err "ERROR: Failed extracting ${SOURCE}"
163 fi
164 else
165 exit_err "ERROR: ${SOURCE}/install.sh does not exist"
166 fi
--- 87 unchanged lines hidden (view full) ---
254 done
255
256 cat<<EOF>>"${NETRC}"
257bye
258
259
260EOF
261
262 # Fetch the files via ftp
263 echo "$ INSTALL" | ftp -N "${NETRC}" "${FTPHOST}"
264
265 # Done fetching, now reset the INSFILE to our downloaded archived
266 INSFILE="${OUTFILE}" ; export INSFILE
267}
268
269# Function which does the rsync download from the server specifed in cfg
270start_rsync_copy()
271{
--- 116 unchanged lines hidden ---
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-extractimage.sh 211487 2010-08-19 06:02:31Z imp $
27
28# Functions which perform the extraction / installation of system to disk
29
30. ${BACKEND}/functions-mountoptical.sh
31
32# Performs the extraction of data to disk from a uzip or tar archive
33start_extract_uzip_tar()
34{
--- 83 unchanged lines hidden (view full) ---
118
119 HERE=`pwd`
120 DIRS=`ls -d ${INSDIR}/*|grep -Ev '(uzip|kernels|src)'`
121 for dir in ${DIRS}
122 do
123 cd "${dir}"
124 if [ -f "install.sh" ]
125 then
126 echo_log "Extracting" `basename ${dir}`
127 echo "y" | sh install.sh >/dev/null
128 if [ "$?" != "0" ]
129 then
130 exit_err "ERROR: Failed extracting ${dir}"
131 fi
132 else
133 exit_err "ERROR: ${dir}/install.sh does not exist"
134 fi
135 done
136 cd "${HERE}"
137
138 KERNELS=`ls -d ${INSDIR}/*|grep kernels`
139 cd "${KERNELS}"
140 if [ -f "install.sh" ]
141 then
142 echo_log "Extracting" `basename ${KERNELS}`
143 echo "y" | sh install.sh generic >/dev/null
144 if [ "$?" != "0" ]
145 then
146 exit_err "ERROR: Failed extracting ${KERNELS}"
147 fi
148 echo 'kernel="GENERIC"' > "${FSMNT}/boot/loader.conf"
149 else
150 exit_err "ERROR: ${KERNELS}/install.sh does not exist"
151 fi
152 cd "${HERE}"
153
154 SOURCE=`ls -d ${INSDIR}/*|grep src`
155 cd "${SOURCE}"
156 if [ -f "install.sh" ]
157 then
158 echo_log "Extracting" `basename ${SOURCE}`
159 echo "y" | sh install.sh all >/dev/null
160 if [ "$?" != "0" ]
161 then
162 exit_err "ERROR: Failed extracting ${SOURCE}"
163 fi
164 else
165 exit_err "ERROR: ${SOURCE}/install.sh does not exist"
166 fi
--- 87 unchanged lines hidden (view full) ---
254 done
255
256 cat<<EOF>>"${NETRC}"
257bye
258
259
260EOF
261
262 # Fetch the files via ftp
263 echo "$ INSTALL" | ftp -N "${NETRC}" "${FTPHOST}"
264
265 # Done fetching, now reset the INSFILE to our downloaded archived
266 INSFILE="${OUTFILE}" ; export INSFILE
267}
268
269# Function which does the rsync download from the server specifed in cfg
270start_rsync_copy()
271{
--- 116 unchanged lines hidden ---