Utils:LogoutHook - dont rewrite identical file
@@ -26,6 +26,7 @@ fi
abort() {
echo "Fatal error: ${1}"
+# echo "Fatal error: ${1}" >> error.log
exit 1
}
@@ -35,7 +36,11 @@ rm -f /tmp/nvram.plist
UUID="$(nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:boot-path | /usr/bin/sed 's/.*GPT,\([^,]*\),.*/\1/')"
if [ "$(printf '%s' "${UUID}" | /usr/bin/wc -c)" -eq 36 ] && [ -z "$(echo "${UUID}" | /usr/bin/sed 's/[-0-9A-F]//g')" ]; then
/usr/sbin/diskutil mount "${UUID}" || abort "Failed to mount ${UUID}!"
- /bin/cp /tmp/nvram.plist "$(/usr/sbin/diskutil info "${UUID}" | /usr/bin/sed -n 's/.*Mount Point: *//p')" || abort "Failed to copy nvram.plist!"
+ p="$(/usr/sbin/diskutil info "${UUID}" | /usr/bin/sed -n 's/.*Mount Point: *//p')"
+if ! cmp -s /tmp/nvram.plist "${p}/nvram.plist"
+then
+ /bin/cp /tmp/nvram.plist "${p}/nvram.plist" || abort "Failed to copy nvram.plist!"
+fi
/usr/sbin/diskutil unmount "${UUID}" || abort "Failed to unmount ${UUID}!"
exit 0
else
