From d7e2078028a1f334d7cdcda252893f34d3baf198 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Sun, 15 May 2011 12:00:02 +0300 Subject: testing --- up2date.app/Contents/Resources/Scripts/main.scpt | Bin 0 -> 1748 bytes up2date.app/Contents/Resources/applet.icns | Bin 0 -> 40291 bytes up2date.app/Contents/Resources/applet.rsrc | Bin 0 -> 362 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 ++ up2date.app/Contents/Resources/up2date.sh | 47 +++++++++++++++++++++ 5 files changed, 51 insertions(+) create mode 100644 up2date.app/Contents/Resources/Scripts/main.scpt create mode 100644 up2date.app/Contents/Resources/applet.icns create mode 100644 up2date.app/Contents/Resources/applet.rsrc create mode 100644 up2date.app/Contents/Resources/description.rtfd/TXT.rtf create mode 100755 up2date.app/Contents/Resources/up2date.sh (limited to 'up2date.app/Contents/Resources') diff --git a/up2date.app/Contents/Resources/Scripts/main.scpt b/up2date.app/Contents/Resources/Scripts/main.scpt new file mode 100644 index 0000000..5479faa Binary files /dev/null and b/up2date.app/Contents/Resources/Scripts/main.scpt differ diff --git a/up2date.app/Contents/Resources/applet.icns b/up2date.app/Contents/Resources/applet.icns new file mode 100644 index 0000000..fcc1f09 Binary files /dev/null and b/up2date.app/Contents/Resources/applet.icns differ diff --git a/up2date.app/Contents/Resources/applet.rsrc b/up2date.app/Contents/Resources/applet.rsrc new file mode 100644 index 0000000..b06b869 Binary files /dev/null and b/up2date.app/Contents/Resources/applet.rsrc differ diff --git a/up2date.app/Contents/Resources/description.rtfd/TXT.rtf b/up2date.app/Contents/Resources/description.rtfd/TXT.rtf new file mode 100644 index 0000000..33192ea --- /dev/null +++ b/up2date.app/Contents/Resources/description.rtfd/TXT.rtf @@ -0,0 +1,4 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350 +{\fonttbl} +{\colortbl;\red255\green255\blue255;} +} \ No newline at end of file diff --git a/up2date.app/Contents/Resources/up2date.sh b/up2date.app/Contents/Resources/up2date.sh new file mode 100755 index 0000000..40d7f75 --- /dev/null +++ b/up2date.app/Contents/Resources/up2date.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +# up2date.sh +# Run software update until there are no more updates available. +# @author Filipp Lepalaan +# @package mtk + +if [[ id -u != 0 ]]; then + echo "$(basename $0) must be run as root" 2>&1 + exit 1 +fi + +ME=$0 +PLIST=/Library/LaunchDaemons/com.unflyingobject.mtk.up2date.plist + +# updates available... +if /usr/sbin/softwareupdate -l 2>&1 | grep -q 'found the following new' +then + if [[ ! -e "${PLIST}" ]]; then + cat > "${PLIST}" < + + + + RunAtLoad + + Label + com.unflyingobject.mtk.up2date + ProgramArguments + + ${ME} + + + +EOT + /bin/launchctl load -w "${PLIST}" + /usr/bin/logger "$(basename $0) loaded" + exit 0 + fi + /usr/bin/open /var/log/system.log + /usr/sbin/softwareupdate -ia && /sbin/reboot + exit 0 +fi + +# no more updates available +/bin/launchctl unload -w "${PLIST}" && rm "${PLIST}" +/usr/bin/logger "$(basename $0) finished, script unloaded. Have a nice day." +exit 0 -- cgit v1.2.3