#echo "${i} file does not match intended final md5."
echo"${i} file does not match intended final md5.">>${ERR_F}
fi
/bin/rm /tmp/patched/${FILE}>>${ERR_F}
/bin/rm /tmp/patches/${i}>>${ERR_F}
/bin/rm /tmp/patches/${i}.*>>${ERR_F}
done
/bin/rm -rf /tmp/patched /tmp/patches >>${ERR_F}
restore_chflags
}
case$ACTIONin
enable)
touch /conf/upgrade_log.txt
echo"">> /conf/upgrade_log.txt
echo"Enable">> /conf/upgrade_log.txt
echo"">> /conf/upgrade_log.txt
;;
auto)
touch /var/run/firmwarelock.dirty
backup_chflags
remove_chflags
/usr/local/etc/rc.firmware_auto
restore_chflags
;;
pfSenseNanoBSDupgrade)
# Sanity check - bail early if there's no firmware file!
if[!-r$IMG];then
echo"2nd parameter has not been passed or file does not exist. Exiting.">> /conf/upgrade_log.txt 2>&1
exit 1
fi
# Prevent full upgrade file from being used to upgrade
if[`echo$IMG | grep"full"`];then
echo"You cannot use a full file for upgrade. Please use a file labeled nanobsd upgrade."
file_notice "NanoBSDUpgradeFailure""You have attemped to use a full NanoBSD installation file as an upgrade. Please use a NanoBSD file labeled 'upgrade' instead."
rm-f$IMG
exit 1
fi
touch /var/run/firmwarelock.dirty
echo"NanoBSD Firmware upgrade in progress...">> /conf/upgrade_log.txt 2>&1
echo"NanoBSD Firmware upgrade in progress..." | wall
/usr/local/etc/rc.notify_message -e-g-m"NanoBSD Firmware upgrade in progress..."
# backup config
/bin/mkdir -p /tmp/configbak
cp-Rp /conf/* /tmp/configbak 2>/dev/null
# Remove logs from backup dir to avoid clobbering upon restore.
# USB slices are under-reported even more than CF slices when viewed
# directly, instead of when looking at the entire disk. Compensate
# by adding exactly 6MB. 4MB was consistently 2MB too few, and
# was resulting in failing upgrades on USB Flash based installs.
SIZE=`expr$SIZE + 6`
if["$SIZE"-lt"$NEW_IMG_SIZE"];then
file_notice "UpgradeFailure""Upgrade failed due to the upgrade image being larger than the partition that is configured on disk. Halting. Size on disk: $SIZE < Size of new image: $NEW_IMG_SIZE"
echo"Upgrade failed. Please check the system log file for more information" | wall
print_info_box(gettext("An upgrade is currently in progress.<p>The firewall will reboot when the operation is complete.")."</p><p><img src='/themes/{$g['theme']}/images/icons/icon_fw-update.gif' alt='update' /></p>");
echo"<a onclick=\"return confirm('".gettext("Do you really want to delete this backup?")."')\" href='system_firmware_restorefullbackup.php?deletefile=".htmlspecialchars($arf)."'>";