Project

General

Profile

Download (15.4 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/bin/sh
2

    
3
# /etc/rc.firmware
4
# originally part of m0n0wall (http://neon1.net/m0n0wall)
5
# Copyright (C) 2005-2009 Scott Ullrich <sullrich@pfsense.org>.
6
# Copyright (C) 2003 Manuel Kasper <mk@neon1.net>.
7
# All rights reserved.
8

    
9
# mount /cf
10
/etc/rc.conf_mount_rw
11

    
12
# Reset file(s)
13
echo "" >/conf/upgrade_log.txt
14
echo "" >/conf/firmware_update_misc.log
15
echo "" >/conf/fdisk_upgrade_log.txt
16

    
17
exec 3>&2 2>>/conf/firmware_update_misc.log
18

    
19
export ACTION=$1
20
export IMG=$2
21
if [ $# -eq 3 ]; then
22
	export CUSTOMIMG=$3
23
fi
24

    
25
if [ $ACTION != "upgrade" ]; then
26
	/sbin/umount -f /ftmp > /dev/null 2>&1
27
fi
28

    
29
file_notice() {
30
	/usr/local/bin/php -q -d auto_prepend_file=config.inc <<ENDOFF
31
	<?php
32
		require_once("globals.inc");		
33
		require_once("functions.inc");
34
		file_notice("$1", "$2", "$1", "");
35
	?>
36
ENDOFF
37
}
38

    
39
output_env_to_log() {
40
	date >> /conf/upgrade_log.txt
41
	echo "" >> /conf/upgrade_log.txt
42
	
43
	ls -lah /dev/ >> /conf/upgrade_log.txt
44
	echo "" >> /conf/upgrade_log.txt
45

    
46
	ls -lah $IMG >> /conf/upgrade_log.txt
47
	echo "" >> /conf/upgrade_log.txt
48

    
49
	md5 $IMG >> /conf/upgrade_log.txt
50
	echo "" >> /conf/upgrade_log.txt
51

    
52
	mount >> /conf/upgrade_log.txt
53
	echo "" >> /conf/upgrade_log.txt
54

    
55
	top >> /conf/upgrade_log.txt
56
	echo "" >> /conf/upgrade_log.txt
57
}
58

    
59
backup_chflags() {
60
	TOPROCESS="bin lib libexec sbin usr"
61
	for files in $TOPROCESS; do
62
		/usr/sbin/mtree -Pcp /${files} | bzip2 -9 > /tmp/chflags.dist.${files}.bz2 >> /conf/upgrade_log.txt 2>&1
63
	done
64
}
65

    
66
restore_chflags() {
67
	TOPROCESS="bin lib libexec sbin usr"
68
	for files in $TOPROCESS; do
69
		cd / && /usr/bin/bzcat /tmp/chflags.dist.${files}.bz2 | /usr/sbin/mtree -PU -p /${files} >> /conf/upgrade_log.txt 2>&1
70
	done
71
}
72

    
73
remove_chflags() {
74
	TOPROCESS="bin lib libexec sbin usr"
75
	for files in $TOPROCESS; do
76
		/bin/chflags -R noschg /${files}
77
		/bin/chmod -R u+rw /${files}
78
	done
79
}
80

    
81
binary_update() {
82
	TGZ=$1
83
	ERR_F="/tmp/bdiff.log"
84
	rm ${ERR_F} 2>/dev/null
85
	/bin/mkdir /tmp/patched /tmp/patches 2>>${ERR_F}
86
	backup_chflags
87
	remove_chflags
88
	cd /tmp/patches
89
	for i in `/usr/bin/tar tvzf $TGZ | egrep -v "(^d|_md5)" | nawk '{print $9;}'`;
90
	 do
91
	   FILE=`basename ${i}`
92
	   echo "Working on ${i}"
93
	   # Untar patch file and md5 files
94
	   /usr/bin/tar xzf ${TGZ} ${i} ${i}.old_file_md5 ${i}.new_patch_md5 ${i}.new_file_md5 2>>${ERR_F}
95

    
96
	   # Apply patch - oldfile newfile patchfile
97
	   /usr/local/bin/bspatch /${i} /tmp/patched/${FILE} /tmp/patches/${i} 2>>${ERR_F}
98

    
99
	   OLD_FILE_MD5=`cat /tmp/patches/${i}.old_file_md5 2>/dev/null`
100
	   NEW_PATCH_MD5=`cat /tmp/patches/${i}.new_patch_md5 2>/dev/null`
101
	   NEW_FILE_MD5=`cat /tmp/patches/${i}.new_file_md5 2>/dev/null`
102
	   PATCHED_MD5=`/sbin/md5 -q /tmp/patched/${FILE} 2>/dev/null`
103

    
104
	   if [ "$PATCHED_MD5" = "$NEW_PATCH_MD5" ]; then
105
		/usr/bin/install -S  /tmp/patched/${FILE} /${i}
106
	   else
107
		#echo "${i} file does not match intended final md5."
108
		echo "${i} file does not match intended final md5." >> ${ERR_F}
109
	   fi
110

    
111
	   /bin/rm /tmp/patched/${FILE} >> ${ERR_F}
112
	   /bin/rm /tmp/patches/${i} >> ${ERR_F}
113
	   /bin/rm /tmp/patches/${i}.* >> ${ERR_F}
114
	done
115
	/bin/rm -rf /tmp/patched /tmp/patches >> ${ERR_F}
116
	restore_chflags
117
}
118

    
119
case $ACTION in
120
enable)
121
	touch /conf/upgrade_log.txt
122
	echo "" >> /conf/upgrade_log.txt
123
	echo "Enable" >> /conf/upgrade_log.txt
124
	echo "" >> /conf/upgrade_log.txt		
125
	;;
126
auto)
127
	touch /var/run/firmwarelock.dirty
128
	backup_chflags
129
	remove_chflags
130
	/etc/rc.firmware_auto
131
	restore_chflags
132
	;;
133
pfSenseNanoBSDupgrade)
134

    
135
	# Sanity check - bail early if there's no firmware file!
136
	if [ ! -r $IMG ]; then
137
		echo "2nd parameter has not been passed or file does not exist. Exiting." >> /conf/upgrade_log.txt 2>&1
138
		/etc/rc.conf_mount_ro
139
		exit 1
140
	fi
141

    
142
	# Prevent full upgrade file from being used to upgrade
143
	if [ `echo $IMG | grep "full"` ]; then
144
		echo "You cannot use a full file for upgrade.  Please use a file labeled upgrade."
145
		file_notice "NanoBSDUpgradeFailure" "You have attemped to use a full NanoBSD installation file as an upgrade.  Please use a NanoBSD file labeled 'upgrade' instead."
146
		/etc/rc.conf_mount_ro		
147
		exit 1
148
	fi
149

    
150
	touch /var/run/firmwarelock.dirty
151

    
152
	echo "NanoBSD Firmware upgrade in progress..."  >> /conf/upgrade_log.txt 2>&1
153
	echo "NanoBSD Firmware upgrade in progress..." | wall
154

    
155
	# backup config
156
	/bin/mkdir -p /tmp/configbak
157
	cp -p /conf/* /tmp/configbak 2>/dev/null
158

    
159
	echo "" >> /conf/upgrade_log.txt
160

    
161
	echo "Installing $IMG." >> /conf/upgrade_log.txt 2>&1
162
	echo "Installing $IMG." >> /conf/upgrade_log.txt
163

    
164
	# resolve glabel label that we booted from
165
	BOOT_DEVICE=`/sbin/mount | /usr/bin/grep pfsense | /usr/bin/cut -d'/' -f4 | /usr/bin/cut -d' ' -f1`
166
	# resolve glabel to the real boot dev entry
167
	REAL_BOOT_DEVICE=`/sbin/glabel list | /usr/bin/grep -B2 ufs/${BOOT_DEVICE} | /usr/bin/head -n 1 | /usr/bin/cut -f3 -d' '`
168
	# grab the boot device, example ad1, ad0
169
	BOOT_DRIVE=`/sbin/glabel list | /usr/bin/grep -B2 ufs/pfsense | /usr/bin/head -n 1 | /usr/bin/cut -f3 -d' ' | /usr/bin/cut -d's' -f1`
170
	# test the slice.  if we are on slice 1 we need to flash 2 and vica versa
171
	if [ `echo $REAL_BOOT_DEVICE | /usr/bin/grep "s1"` ]; then 
172
		SLICE="2"
173
		OLDSLICE="1"
174
		TOFLASH="${BOOT_DRIVE}s${SLICE}"
175
		COMPLETE_PATH="${BOOT_DRIVE}s${SLICE}a"
176
		GLABEL_SLICE="pfsense1"
177
		UFS_ID="1"
178
		OLD_UFS_ID="0"
179
	else
180
		SLICE="1"
181
		OLDSLICE="2"		
182
		TOFLASH="${BOOT_DRIVE}s${SLICE}"
183
		COMPLETE_PATH="${BOOT_DRIVE}s${SLICE}a"
184
		GLABEL_SLICE="pfsense0"
185
		UFS_ID="0"
186
		OLD_UFS_ID="1"
187
	fi
188

    
189
	# Output specifc information that this script is using
190
	echo "SLICE $SLICE" >> /conf/upgrade_log.txt
191
	echo "OLDSLICE $OLDSLICE" >> /conf/upgrade_log.txt
192
	echo "TOFLASH $TOFLASH" >> /conf/upgrade_log.txt
193
	echo "COMPLETE_PATH $COMPLETE_PATH" >> /conf/upgrade_log.txt
194
	echo "GLABEL_SLICE $GLABEL_SLICE" >> /conf/upgrade_log.txt
195

    
196
	# First ensure the new file can fit inside the 
197
	# slice that we are going to be operating on.
198
	NEW_IMG_SIZE=`echo $((\`gzip -l ${IMG} | grep -v compressed | awk '{ print $2}'\` / 1024 / 1024))`
199
	SIZE=`/sbin/fdisk ${COMPLETE_PATH} | /usr/bin/grep Meg | /usr/bin/awk '{ print $5 }' | /usr/bin/cut -d"(" -f2`
200
	if [ "$SIZE" -lt "$NEW_IMG_SIZE" ]; then
201
		file_notice "UpgradeFailure" "Upgrade failed due to the upgrade image being larger than the partition that is configured on disk.  Halting."
202
		echo "Upgrade failed.  Please check the system log file for more information" | wall
203
		rm /var/run/firmwarelock.dirty
204
		/etc/rc.conf_mount_ro		
205
		exit 1
206
	fi
207

    
208
	# Output environment information to log file
209
	output_env_to_log
210
	
211
	# Grab a before upgrade look at fdisk
212
	echo "" >> /conf/fdisk_upgrade_log.txt
213
	echo "Before upgrade fdisk/bsdlabel" >> /conf/fdisk_upgrade_log.txt
214
	fdisk $BOOT_DRIVE >> /conf/fdisk_upgrade_log.txt
215
	fdisk $BOOT_DRIVEs1 >> /conf/fdisk_upgrade_log.txt
216
	fdisk $BOOT_DRIVEs1a >> /conf/fdisk_upgrade_log.txt
217
	fdisk $BOOT_DRIVEs2 >> /conf/fdisk_upgrade_log.txt
218
	fdisk $BOOT_DRIVEs2a >> /conf/fdisk_upgrade_log.txt		
219
	fdisk $BOOT_DRIVEs3 >> /conf/fdisk_upgrade_log.txt
220
	bsdlabel -A $BOOT_DRIVEs1 >> /conf/fdisk_upgrade_log.txt
221
	bsdlabel -A $BOOT_DRIVEs2 >> /conf/fdisk_upgrade_log.txt
222
	bsdlabel -A $BOOT_DRIVEs3 >> /conf/fdisk_upgrade_log.txt
223
	echo "---------------------------------------------------------------" >> /conf/fdisk_upgrade_log.txt
224
	echo "" >> /conf/fdisk_upgrade_log.txt
225
	
226
	# Log that we are really doing a NanoBSD upgrade
227
	echo "" >> /conf/upgrade_log.txt
228
	echo "NanoBSD upgrade starting" >> /conf/upgrade_log.txt
229
	echo "" >> /conf/upgrade_log.txt
230

    
231
	# Remove TOFLASH and get ready for new flash image
232
	echo "" >> /conf/upgrade_log.txt
233
	echo "dd if=/dev/zero of=/dev/${TOFLASH} bs=1m count=1" >> /conf/upgrade_log.txt	
234
	dd if=/dev/zero of=/dev/${TOFLASH} bs=1m count=1 >> /conf/upgrade_log.txt 2>&1
235

    
236
	# Stream gzipped image to dd and explode image to new area
237
	echo "" >> /conf/upgrade_log.txt
238
	echo "/usr/bin/gzip -dc $IMG | /bin/dd of=/dev/${TOFLASH} obs=64k" >> /conf/upgrade_log.txt
239
	/usr/bin/gzip -dc $IMG | /bin/dd of=/dev/${TOFLASH} obs=64k >> /conf/upgrade_log.txt 2>&1
240

    
241
	# Grab a after upgrade look at fdisk
242
	echo "" >> /conf/fdisk_upgrade_log.txt
243
	echo "After upgrade fdisk/bsdlabel" >> /conf/upgrade_log.txt
244
	fdisk $BOOT_DRIVE >> /conf/fdisk_upgrade_log.txt
245
	fdisk $BOOT_DRIVEs1 >> /conf/fdisk_upgrade_log.txt
246
	fdisk $BOOT_DRIVEs1a >> /conf/fdisk_upgrade_log.txt
247
	fdisk $BOOT_DRIVEs2 >> /conf/fdisk_upgrade_log.txt
248
	fdisk $BOOT_DRIVEs2a >> /conf/fdisk_upgrade_log.txt		
249
	fdisk $BOOT_DRIVEs3 >> /conf/fdisk_upgrade_log.txt
250
	bsdlabel -A $BOOT_DRIVEs1 >> /conf/fdisk_upgrade_log.txt
251
	bsdlabel -A $BOOT_DRIVEs2 >> /conf/fdisk_upgrade_log.txt
252
	bsdlabel -A $BOOT_DRIVEs3 >> /conf/fdisk_upgrade_log.txt
253
	echo "---------------------------------------------------------------" >> /conf/fdisk_upgrade_log.txt
254
	echo "" >> /conf/fdisk_upgrade_log.txt
255
	
256
	# Ensure that our new system is sound and bail if it is not and file a notice
257
	echo "" >> /conf/upgrade_log.txt
258
	echo "/sbin/fsck_ufs -y /dev/$COMPLETE_PATH" >> /conf/upgrade_log.txt
259
	/sbin/fsck_ufs -y /dev/$COMPLETE_PATH >> /conf/upgrade_log.txt 2>&1
260
	if [ $? != 0 ]; then
261
		file_notice "UpgradeFailure" "{\$g['product_name']} upgrade has failed.   Your system has been left in a usable state."
262
		rm /var/run/firmwarelock.dirty
263
		/etc/rc.conf_mount_ro		
264
		exit 1
265
	fi
266

    
267
	# Add back the corresponding glabel
268
	echo "" >> /conf/upgrade_log.txt
269
	echo "/sbin/tunefs -L ${GLABEL_SLICE} /dev/$COMPLETE_PATH" >> /conf/upgrade_log.txt
270
	/sbin/tunefs -L ${GLABEL_SLICE} /dev/$COMPLETE_PATH >> /conf/upgrade_log.txt 2>&1
271

    
272
	# restore config
273
	cp -p /tmp/configbak/* /conf 2>/dev/null
274

    
275
	# Remove upgrade file
276
	rm -f $IMG
277

    
278
	# Mount newly prepared slice
279
	mkdir /tmp/$GLABEL_SLICE
280
	mount /dev/ufs/$GLABEL_SLICE /tmp/$GLABEL_SLICE
281

    
282
	# If /tmp/$GLABEL_SLICE/tmp/post_upgrade_command exists 
283
	# after update then execute the command.
284
	if [ -f /tmp/$GLABEL_SLICE/tmp/post_upgrade_command ]; then
285
		sh /tmp/$GLABEL_SLICE/tmp/post_upgrade_command >> /conf/upgrade_log.txt 2>&1
286
	fi
287

    
288
	# Update fstab
289
	cp /etc/fstab /tmp/$GLABEL_SLICE/etc/fstab
290
	sed -i "" "s/pfsense${OLD_UFS_ID}/pfsense${UFS_ID}/g" /tmp/$GLABEL_SLICE/etc/fstab
291
	if [ $? != 0 ]; then
292
		echo "Something went wrong when trying to update the fstab entry.  Aborting upgrade."
293
		file_notice "UpgradeFailure" "Something went wrong when trying to update the fstab entry.  Aborting upgrade."
294
		rm /var/run/firmwarelock.dirty
295
		umount /tmp/$GLABEL_SLICE
296
		/etc/rc.conf_mount_ro
297
		exit 1
298
	fi
299
	echo "" >> /conf/upgrade_log.txt
300
	cat /tmp/$GLABEL_SLICE/etc/fstab >> /conf/upgrade_log.txt
301

    
302
	echo "" >> /conf/upgrade_log.txt
303
	find /tmp/$GLABEL_SLICE >/conf/file_upgrade_log.txt
304
	echo "" >> /conf/upgrade_log.txt
305

    
306
	# Unmount newly prepared slice
307
	umount /tmp/$GLABEL_SLICE
308
	
309
	sync
310

    
311
	# Set active mount slice in fdisk
312
	echo "" >> /conf/upgrade_log.txt
313
	echo "gpart set -a active -i ${SLICE} ${BOOT_DRIVE}" >> /conf/upgrade_log.txt
314
	gpart set -a active -i ${SLICE} ${BOOT_DRIVE}
315

    
316
	sync
317

    
318
	# Set active boot source - NanoBSD does not do this but otherwise we
319
	# end up with the wrong partition being active.
320
	echo "" >> /conf/upgrade_log.txt
321
	echo "/usr/sbin/boot0cfg -s ${SLICE} -v /dev/${BOOT_DRIVE}" >> /conf/upgrade_log.txt
322
	/usr/sbin/boot0cfg -s ${SLICE} -v /dev/${BOOT_DRIVE} >> /conf/upgrade_log.txt 2>&1
323

    
324
	# Grab a final look at fdisk
325
	echo "" >> /conf/fdisk_upgrade_log.txt
326
	echo "Final upgrade fdisk/bsdlabel" >> /conf/fdisk_upgrade_log.txt
327
	fdisk $BOOT_DRIVE >> /conf/fdisk_upgrade_log.txt
328
	fdisk $BOOT_DRIVEs1 >> /conf/fdisk_upgrade_log.txt
329
	fdisk $BOOT_DRIVEs1a >> /conf/fdisk_upgrade_log.txt
330
	fdisk $BOOT_DRIVEs2 >> /conf/fdisk_upgrade_log.txt
331
	fdisk $BOOT_DRIVEs2a >> /conf/fdisk_upgrade_log.txt		
332
	fdisk $BOOT_DRIVEs3 >> /conf/fdisk_upgrade_log.txt
333
	bsdlabel -A $BOOT_DRIVEs1 >> /conf/fdisk_upgrade_log.txt
334
	bsdlabel -A $BOOT_DRIVEs2 >> /conf/fdisk_upgrade_log.txt
335
	bsdlabel -A $BOOT_DRIVEs3 >> /conf/fdisk_upgrade_log.txt
336
	echo "---------------------------------------------------------------" >> /conf/fdisk_upgrade_log.txt
337
	echo "" >> /conf/fdisk_upgrade_log.txt
338

    
339
	# Remove extra stuff
340
	rm -rf /etc/rc.conf
341
	rm -rf /etc/motd
342
	rm -rf /usr/savecore/*
343

    
344
	date >> /conf/upgrade_log.txt
345
	echo "" >> /conf/upgrade_log.txt
346

    
347
	# Trigger a package reinstallation on reobot
348
	touch /conf/needs_package_sync
349

    
350
	# remount /cf ro
351
	/etc/rc.conf_mount_ro
352
	/bin/sync
353

    
354
	sleep 10
355

    
356
	rm -f /var/run/firmwarelock.dirty
357
	sh /etc/rc.reboot
358

    
359
	;;
360
pfSenseupgrade)
361

    
362
	# Sanity check - bail early if there's no firmware file!
363
	if [ ! -r $IMG ]; then
364
		echo "2nd parameter has not been passed or file does not exist. Exiting." >> /conf/upgrade_log.txt 2>&1
365
		/etc/rc.conf_mount_ro
366
		exit
367
	fi
368

    
369
	# wait 1 seconds before beginning
370
	sleep 1
371

    
372
	# Log that we are really doing a NanoBSD upgrade
373
	echo "" >> /conf/upgrade_log.txt
374
	echo "NanoBSD upgrade starting" >> /conf/upgrade_log.txt
375
	echo "" >> /conf/upgrade_log.txt
376

    
377
	touch /var/run/firmwarelock.dirty
378

    
379
	touch /conf/upgrade_log.txt
380
	echo "" >> /conf/upgrade_log.txt
381

    
382
	# Output environment information to log file
383
	output_env_to_log
384

    
385
	backup_chflags
386
	remove_chflags
387

    
388
	# Do we have a pre-upgrade hook in the update file?
389
	if [ `tar tvzf $IMG | grep /tmp/pre_upgrade_command | wc -l` -gt 0 ]; then 
390
		tar xzvf $IMG -C / ./tmp/pre_upgrade_command >> /conf/upgrade_log.txt 2>&1
391
		chmod a+rx /tmp/pre_upgrade_command >> /conf/upgrade_log.txt 2>&1
392
		sh /tmp/pre_upgrade_command >> /conf/upgrade_log.txt 2>&1
393
	fi
394

    
395
	echo "Firmware upgrade in progress..."  >> /conf/upgrade_log.txt 2>&1
396
	echo "Firmware upgrade in progress..."  | wall
397

    
398
	# backup config
399
	/bin/mkdir -p /tmp/configbak
400
	cp -p /conf/* /tmp/configbak 2>/dev/null
401

    
402
	# tar explode image onto hd
403
	echo "Installing $IMG." >> /conf/upgrade_log.txt 2>&1
404
	cd / && /usr/bin/tar xzUPf $IMG >> /conf/upgrade_log.txt 2>&1
405
	/usr/bin/find / -name CVS -exec rm -fr {} \;
406
	echo "Image installed $IMG." >> /conf/upgrade_log.txt 2>&1
407

    
408
    # process custom image if its passed
409
    if [ $# -eq 3 ]; then
410
	    if [ -f $CUSTOMIMG ]; then
411
	        echo "Custom image $CUSTOMIMG found." >> /conf/upgrade_log.txt 2>&1
412
	        echo "Custom image ($CUSTOMIMG) found." >> /conf/upgrade_log.txt 2>&1
413
	        PWD_DIR=`pwd`
414
	        cd / && /usr/bin/tar xzPUf $CUSTOMIMG >> /conf/upgrade_log.txt 2>&1
415
	        cd $PWD_DIR
416
	        echo "Custom image $CUSTOMIMG installed." >> /conf/upgrade_log.txt 2>&1
417
	    fi
418
    fi
419

    
420
	# restore config
421
	cp -p /tmp/configbak/* /conf 2>/dev/null
422

    
423
	# restore /etc symlinks
424
	rm /etc/hosts
425
	ln -s /var/etc/hosts /etc/hosts
426

    
427
	restore_chflags
428

    
429
	# Remove upgrade file
430
	rm -f $IMG
431

    
432
	if [ -e /etc/init_bootloader.sh ]; then
433
		sh /etc/init_bootloader.sh >> /conf/upgrade_log.txt 2>&1
434
	fi
435

    
436
	# If /tmp/post_upgrade_command exists after update
437
	# then execute the command.
438
	if [ -f /tmp/post_upgrade_command ]; then
439
		sh /tmp/post_upgrade_command >> /conf/upgrade_log.txt 2>&1
440
	fi
441

    
442
	# remove unused files
443
	rm -rf /etc/rc.conf
444
	rm -rf /etc/motd
445
	rm -rf /usr/savecore/*
446

    
447
	date >> /conf/upgrade_log.txt
448
	echo "" >> /conf/upgrade_log.txt
449

    
450
	# remount /cf ro
451
	/etc/rc.conf_mount_ro
452

    
453
	# release the firmware lock
454
	rm -f /var/run/firmwarelock.dirty
455
	/bin/sync
456

    
457
	# Sleep and allow disks to catch up
458
	sleep 10
459

    
460
	# If the archive has unpacked a file called
461
	# /tmp/no_upgrade_reboot_required then do
462
	# not reboot after upgrade.
463
	if [ -f /tmp/no_upgrade_reboot_required ]; then
464
		rm /tmp/no_upgrade_reboot_required
465
	else
466
		rm -f /var/run/config.lock
467
		sh /etc/rc.reboot
468
	fi
469

    
470
	;;
471
delta_update)
472
	touch /var/run/firmwarelock.dirty
473
	backup_chflags
474
	remove_chflags
475
	binary_update $IMG
476
	restore_chflags
477
	rm -rf /etc/rc.conf
478
	rm -rf /etc/motd
479
	find / -name CVS -type d -exec rm {} \;
480
	rm -rf /usr/savecore/*
481
	/etc/rc.conf_mount_ro
482
	/sbin/umount -f /cf 2>/dev/null
483
	/sbin/mount -r /cf 2>/dev/null
484
	/sbin/umount -f / 2>/dev/null
485
	/sbin/mount -r / 2>/dev/null
486
	if [ -e /etc/init_bootloader.sh ]; then
487
		sh /etc/init_bootloader.sh
488
	fi
489

    
490
	;;
491
esac
492

    
493

    
(44-44/87)