From e0bb9180af98961a43c15048e11475bfe8d96186 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 29 Nov 2010 18:05:28 +0200 Subject: better netbless, updated readme --- LICENSE | 1 - README | 14 -------------- README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ netbless.sh | 14 +++++++++++--- up2date.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 100 insertions(+), 18 deletions(-) delete mode 100644 LICENSE delete mode 100644 README create mode 100644 README.md create mode 100755 up2date.sh diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 059abc7..0000000 --- a/LICENSE +++ /dev/null @@ -1 +0,0 @@ -This work is in the Public Domain. To view a copy of the public domain certification, visit http://creativecommons.org/licenses/publicdomain/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. diff --git a/README b/README deleted file mode 100644 index 8c8887d..0000000 --- a/README +++ /dev/null @@ -1,14 +0,0 @@ -## Welcome to the Mac ToolKit ## -A collection of system administration and diagnostic tools for OS X - -###build_rsync### -A helper for building the latest rsync, complete with all Mac-specific patches. - -###hellyes### -A stress test which starts a yes process per every core and then generates IO on the boot drive by creating 10k, 100k, 1m and 10m files in the /tmp/_hellyes folder. - -###blooper### -The Boot Looper is another stress test which opens up a bunch of applications and then -reboots the machine. Very effective when used inside login items. Has two modes of operation: -- Run as is. This launches the first 5 apps from /Applications -- Create a folder called "TestApps" on your desktop and drag aliases into it. This will only launch the apps inside this folder. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6f78550 --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +## Introduction +The Mac Toolkit is a collection of system administration and diagnostic tools for OS X + +## License +DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + +## build_rsync +A helper for building the latest rsync, complete with all Mac-specific patches. + +## hellyes +A stress test which starts a yes process per every core and then generates IO on +the boot drive by creating 10k, 100k, 1m and 10m files in the /tmp/_hellyes folder. + +## poweron +Tool for testing intermittent sleep issues. Works by scheduling + +## blooper +The Boot Looper is another stress test which opens up a bunch of applications and then +reboots the machine. Very effective when used inside login items. Has two modes of operation: +- Run as is. This launches the first 5 apps from /Applications +- Create a folder called "TestApps" on your desktop and drag aliases into it. +This will only launch the apps inside this folder. + +## cyclone +Clones entire drives. Tries to be more efficient than just using dd. + +## netbless +Netbless is a very simple tool to help AASPs match a machine to it's proper installation media. +It requires both a client and a server to function, and + diff --git a/netbless.sh b/netbless.sh index 45bcbc0..dc3a9bc 100755 --- a/netbless.sh +++ b/netbless.sh @@ -1,4 +1,8 @@ #!/usr/bin/env bash +# netbless.sh +# Select NetBoot set from server +# @author Filipp Lepalaan +# @package mtk SERVER=sw.mcare.fi SERVER_PATH="/data/nb" @@ -13,7 +17,11 @@ SERVER_IP=$(dig +short ${SERVER}) ME=$(/usr/sbin/sysctl -n hw.model) MACHINE=$(sysctl -n hw.machine) -if [[ -z ${ME} ]]; then +if [[ $MACHINE == "x86_64" ]]; then + MACHINE="i386/${MACHINE}" +fi + +if [[ -z $ME ]]; then echo "Error: could not determine hardware model" 2>&1 exit 1 fi @@ -32,9 +40,9 @@ do /usr/sbin/bless --netboot \ --booter tftp://${SERVER_IP}/${IMG}/${MACHINE}/booter \ --kernel tftp://${SERVER_IP}/${IMG}/${MACHINE}/mach.macosx \ - --options "rp=nfs:${SERVER_IP}:${SERVER_PATH}:/${IMG}/NetInstall.dmg" + --options "rp=nfs:${SERVER_IP}:${SERVER_PATH}:/${IMG}/NetInstall.dmg" \ --nextonly - echo "NetBoot set" + echo "NetBoot set to ${ME}.nbi" exit 0 fi done diff --git a/up2date.sh b/up2date.sh new file mode 100755 index 0000000..d64d7f6 --- /dev/null +++ b/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 [[ $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/sbin/softwareupdate -ia && /sbin/reboot + exit 0 +fi + +# no more updates available +/bin/launchctl unload -w "${PLIST}" && rm "${PLIST}" +/usr/bin/logger "$(basename $0) unloaded" +exit 0 -- cgit v1.2.3