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/Info.plist | 44 +++++++++++++++++++ up2date.app/Contents/MacOS/applet | Bin 0 -> 55856 bytes up2date.app/Contents/PkgInfo | 1 + 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 +++++++++++++++++++++ up2date.scptd/Contents/Info.plist | 21 --------- up2date.scptd/Contents/Resources/Scripts/main.scpt | Bin 1748 -> 0 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 -- up2date.scptd/Contents/Resources/up2date.sh | 47 --------------------- 12 files changed, 96 insertions(+), 72 deletions(-) create mode 100644 up2date.app/Contents/Info.plist create mode 100755 up2date.app/Contents/MacOS/applet create mode 100644 up2date.app/Contents/PkgInfo 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 delete mode 100644 up2date.scptd/Contents/Info.plist delete mode 100644 up2date.scptd/Contents/Resources/Scripts/main.scpt delete mode 100644 up2date.scptd/Contents/Resources/description.rtfd/TXT.rtf delete mode 100755 up2date.scptd/Contents/Resources/up2date.sh diff --git a/up2date.app/Contents/Info.plist b/up2date.app/Contents/Info.plist new file mode 100644 index 0000000..5c8b161 --- /dev/null +++ b/up2date.app/Contents/Info.plist @@ -0,0 +1,44 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + English + CFBundleExecutable + applet + CFBundleIconFile + applet + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + up2date + CFBundlePackageType + APPL + CFBundleSignature + aplt + LSMinimumSystemVersionByArchitecture + + x86_64 + 10.6 + + LSRequiresCarbon + + WindowState + + dividerCollapsed + + eventLogLevel + -1 + name + ScriptWindowState + positionOfDivider + 346 + savedFrame + 77 104 824 602 0 0 1440 878 + selectedTabView + result + + + diff --git a/up2date.app/Contents/MacOS/applet b/up2date.app/Contents/MacOS/applet new file mode 100755 index 0000000..6a47312 Binary files /dev/null and b/up2date.app/Contents/MacOS/applet differ diff --git a/up2date.app/Contents/PkgInfo b/up2date.app/Contents/PkgInfo new file mode 100644 index 0000000..3253614 --- /dev/null +++ b/up2date.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLaplt \ No newline at end of file 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 diff --git a/up2date.scptd/Contents/Info.plist b/up2date.scptd/Contents/Info.plist deleted file mode 100644 index c23a467..0000000 --- a/up2date.scptd/Contents/Info.plist +++ /dev/null @@ -1,21 +0,0 @@ - - - - - WindowState - - dividerCollapsed - - eventLogLevel - -1 - name - ScriptWindowState - positionOfDivider - 346 - savedFrame - 77 104 824 602 0 0 1440 878 - selectedTabView - result - - - diff --git a/up2date.scptd/Contents/Resources/Scripts/main.scpt b/up2date.scptd/Contents/Resources/Scripts/main.scpt deleted file mode 100644 index 5479faa..0000000 Binary files a/up2date.scptd/Contents/Resources/Scripts/main.scpt and /dev/null differ diff --git a/up2date.scptd/Contents/Resources/description.rtfd/TXT.rtf b/up2date.scptd/Contents/Resources/description.rtfd/TXT.rtf deleted file mode 100644 index 33192ea..0000000 --- a/up2date.scptd/Contents/Resources/description.rtfd/TXT.rtf +++ /dev/null @@ -1,4 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350 -{\fonttbl} -{\colortbl;\red255\green255\blue255;} -} \ No newline at end of file diff --git a/up2date.scptd/Contents/Resources/up2date.sh b/up2date.scptd/Contents/Resources/up2date.sh deleted file mode 100755 index c917e81..0000000 --- a/up2date.scptd/Contents/Resources/up2date.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -# up2date.sh -# Run software update until there are no more updates available. -# @author Filipp Lepalaan -# @package mtk - -if [[ $USER != "root" ]]; 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