aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2011-05-15 13:13:04 +0300
committerFilipp Lepalaan <filipp@mac.com>2011-05-15 13:13:04 +0300
commitc98e968933b806630986895c72cd21c5d3d6de99 (patch)
treee5e1e7b74c789a81d784756c7db4dc065dfb8234
parent4eccc89ade476790ef1511a22707bb25127622f5 (diff)
downloadmtk-c98e968933b806630986895c72cd21c5d3d6de99.tar.gz
mtk-c98e968933b806630986895c72cd21c5d3d6de99.tar.bz2
mtk-c98e968933b806630986895c72cd21c5d3d6de99.zip
testing
-rw-r--r--up2date.app/Contents/Info.plist2
-rwxr-xr-xup2date.app/Contents/Resources/up2date.sh18
2 files changed, 15 insertions, 5 deletions
diff --git a/up2date.app/Contents/Info.plist b/up2date.app/Contents/Info.plist
index 5c8b161..533cf06 100644
--- a/up2date.app/Contents/Info.plist
+++ b/up2date.app/Contents/Info.plist
@@ -38,7 +38,7 @@
<key>savedFrame</key>
<string>77 104 824 602 0 0 1440 878 </string>
<key>selectedTabView</key>
- <string>result</string>
+ <string>event log</string>
</dict>
</dict>
</plist>
diff --git a/up2date.app/Contents/Resources/up2date.sh b/up2date.app/Contents/Resources/up2date.sh
index b9e4841..fdad055 100755
--- a/up2date.app/Contents/Resources/up2date.sh
+++ b/up2date.app/Contents/Resources/up2date.sh
@@ -10,8 +10,12 @@ if [[ $(id -u) != 0 ]]; then
fi
ME=$0
-LOGFILE=/var/log/up2date.log
-PLIST=/Library/LaunchAgents/com.unflyingobject.mtk.up2date.plist
+MAILTO="filipp@mcare.fi"
+LOGFILE=/Library/Logs/up2date.log
+PLIST=/Library/LaunchDaemons/com.unflyingobject.mtk.up2date.plist
+
+# disable automatic checking to avoid possible race condition
+/usr/sbin/softwareupdate --schedule off
# updates available...
if /usr/sbin/softwareupdate -l 2>&1 | grep -q 'found the following new'
@@ -34,19 +38,25 @@ then
</plist>
EOT
/bin/launchctl load -w "${PLIST}"
- /usr/bin/logger "$(basename $0) loaded"
+ echo "$(basename $0) loaded" > "${LOGFILE}"
exit 0
fi
# wait for the GUI to come up...
# while [[ ! (/bin/ps aux | /usr/bin/grep loginwindow | /usr/bin/grep -qv grep) ]]; do
# sleep 5
# done
- /usr/bin/open "${LOGFILE}"
+# /usr/bin/open "${LOGFILE}"
/usr/sbin/softwareupdate -ia > "${LOGFILE}" 2>&1 && /sbin/reboot
exit 0
fi
# no more updates available
+/usr/sbin/softwareupdate --schedule on
/bin/launchctl unload -w "${PLIST}" && rm "${PLIST}"
/usr/bin/logger "$(basename $0) finished, script unloaded. Have a nice day."
+
+if [[ ! -z "${MAILTO}" ]]; then
+ cat "${LOGFILE} | mail -s up2date ${MAILTO}"
+fi
+
exit 0