Revision e348af75
Added by Scott Ullrich about 16 years ago
etc/rc.firmware | ||
---|---|---|
184 | 184 |
|
185 | 185 |
echo "Installing $IMG." | logger -p daemon.info -i -t Upgrade |
186 | 186 |
|
187 |
zcat $IMG | /root/updatep1 |
|
187 |
BOOT_DEVICE=`/sbin/mount | /usr/bin/grep root | /usr/bin/cut -d'/' -f4 | /usr/bin/cut -d' ' -f1` |
|
188 |
if [ "$BOOT_DEVICE" = "root0" ]; then |
|
189 |
TOFLASH="root1" |
|
190 |
else |
|
191 |
TOFLASH="root0" |
|
192 |
fi |
|
193 |
|
|
194 |
# Remove TOFLASH and get ready for new flash image |
|
195 |
dd if=/dev/zero of=/dev/ufs/${TOFLASH} bs=1m count=1 >/dev/null 2>&1 |
|
196 |
|
|
197 |
# Stream gzipped image to dd and explode image to new area |
|
198 |
/usr/bin/gunzip -S "" -c $IMG | /bin/dd of=/dev/ufs/${TOFLASH} bs=16k >/dev/null 2>&1 |
|
199 |
|
|
200 |
# Ensure that our new system is sound and bail if it is not and file a notice |
|
201 |
/sbin/fsck_ffs -n /dev/ufs/${TOFLASH} |
|
202 |
if [ $? != 0 ]; then |
|
203 |
/usr/local/bin/php -q -d auto_prepend_file=config.inc <<ENDOFF |
|
204 |
<?php |
|
205 |
require_once(\"functions.inc\"); |
|
206 |
require_once(\"/usr/local/pkg/apache_mod_security.inc\"); |
|
207 |
file_notice("UpgradeFailure", "{$g['product_name']} upgrade has failed. Your system has been left in a usable state.", "UpgradeFailure", ""); |
|
208 |
?> |
|
209 |
ENDOFF |
|
210 |
|
|
211 |
fi |
|
212 |
|
|
213 |
/usr/sbin/boot0cfg -s 1 -v /dev/ufs/${TOFLASH} |
|
188 | 214 |
|
189 | 215 |
# restore config |
190 | 216 |
cp -p /tmp/configbak/* /conf 2>/dev/null |
Also available in: Unified diff
Add support for nanobsd upgrades