133 CONFIG=`echo $CONFIG | sed -e "s%///%//$BOOTSRVA/%g;"`
134 L=${#ETHER}
135 while [[ "$L" -gt "0" ]]; do
136 URL="$CONFIG/${ETHER:0:$L}"
137 log "... trying $URL"
138 /bin/curl -s -o $ICFILE $URL
139 if [[ -f $ICFILE ]]; then
140 if [[ -n $(grep BuildRpool $ICFILE) ]]; then
141 log "fetched config."
142 return 0
143 fi
144 rm -f $ICFILE
145 fi
146 L=$(($L - 1))
147 done
148 return 1
149 }
150
151 MakeBootable(){
152 log "Making boot environment bootable"
153 mkdir -p /rpool/boot/grub/bootsign || bomb "mkdir rpool/boot/grub failed"
154 touch /rpool/boot/grub/bootsign/pool_rpool || bomb "making bootsign failed"
155 chown -R root:root /rpool/boot || bomb "rpool/boot chown failed"
156 chmod 444 /rpool/boot/grub/bootsign/pool_rpool || bomb "chmod bootsign failed"
157 for f in capability menu.lst splash.xpm.gz ; do
158 cp -p $ALTROOT/boot/grub/$f /rpool/boot/grub/$f || \
159 bomb "setup rpool/boot/grub/$f failed"
160 done
161 zpool set bootfs=rpool/ROOT/omnios rpool || bomb "setting bootfs failed"
162 beadm activate omnios || bomb "activating be failed"
163 $ALTROOT/boot/solaris/bin/update_grub -R $ALTROOT
164 bootadm update-archive -R $ALTROOT
165 RELEASE=`head -1 $ALTROOT/etc/release | sed -e 's/ *//;'`
166 sed -i -e '/BOOTADM/,/BOOTADM/d' /rpool/boot/grub/menu.lst
167 sed -i -e "s/^title.*/title $RELEASE/;" /rpool/boot/grub/menu.lst
168 SendInstallLog
169 CopyInstallLog
170 beadm umount omnios
171 return 0
172 }
173
174 SetHostname()
175 {
176 log "Setting hostname: ${1}"
177 /bin/hostname "$1"
178 echo "$1" > $ALTROOT/etc/nodename
179 head -n 26 $ALTROOT/etc/hosts > /tmp/hosts
180 echo "::1\t\t$1" >> /tmp/hosts
181 echo "127.0.0.1\t$1" >> /tmp/hosts
182 cat /tmp/hosts > $ALTROOT/etc/hosts
183 }
184
185 AutoHostname() {
186 suffix=$1
187 macadr=`/sbin/ifconfig -a | \
188 /usr/bin/awk '/UP/{if($2 !~ /LOOPBACK/){iface=$1;}} /ether/{if(iface){print $2; exit;}}' | \
189 /bin/tr '[:upper:]' '[:lower:]' | \
190 /bin/sed -e 's/^/ 0/g;s/:/-0/g; s/0\([0-9a-f][0-9a-f]\)/\1/g; s/ //g;'`
|
133 CONFIG=`echo $CONFIG | sed -e "s%///%//$BOOTSRVA/%g;"`
134 L=${#ETHER}
135 while [[ "$L" -gt "0" ]]; do
136 URL="$CONFIG/${ETHER:0:$L}"
137 log "... trying $URL"
138 /bin/curl -s -o $ICFILE $URL
139 if [[ -f $ICFILE ]]; then
140 if [[ -n $(grep BuildRpool $ICFILE) ]]; then
141 log "fetched config."
142 return 0
143 fi
144 rm -f $ICFILE
145 fi
146 L=$(($L - 1))
147 done
148 return 1
149 }
150
151 MakeBootable(){
152 log "Making boot environment bootable"
153 zpool set bootfs=rpool/ROOT/omnios rpool
154 # Must do beadm activate first on the off chance we're bootstrapping from
155 # GRUB.
156 beadm activate omnios
157
158 # NOTE: This installboot loop assumes we're doing GPT whole-disk rpools.
159 for i in `cat /tmp/kayak-disk-list`
160 do
161 installboot -mf /boot/pmbr /boot/gptzfsboot /dev/rdsk/${i}s0
162 done
163
164 bootadm update-archive -R $ALTROOT
165 return 0
166 }
167
168 SetHostname()
169 {
170 log "Setting hostname: ${1}"
171 /bin/hostname "$1"
172 echo "$1" > $ALTROOT/etc/nodename
173 head -n 26 $ALTROOT/etc/hosts > /tmp/hosts
174 echo "::1\t\t$1" >> /tmp/hosts
175 echo "127.0.0.1\t$1" >> /tmp/hosts
176 cat /tmp/hosts > $ALTROOT/etc/hosts
177 }
178
179 AutoHostname() {
180 suffix=$1
181 macadr=`/sbin/ifconfig -a | \
182 /usr/bin/awk '/UP/{if($2 !~ /LOOPBACK/){iface=$1;}} /ether/{if(iface){print $2; exit;}}' | \
183 /bin/tr '[:upper:]' '[:lower:]' | \
184 /bin/sed -e 's/^/ 0/g;s/:/-0/g; s/0\([0-9a-f][0-9a-f]\)/\1/g; s/ //g;'`
|