Files
2026-02-16 15:05:15 +01:00

44 lines
1.6 KiB
Bash

#!/bin/sh
# temporarily creates an apple script that displays a dialog - if used as synchronous script, this will pause fileset activation
# to modify applescript payload, edit the "create apple script" section
# Oct-09-2012 , christiang@filewave.com
# if no one is logged in, we don't need to warn anyone
loggedon=$(who | grep console | wc -l)
if [ "$loggedon" -lt "1" ]; then
exit 0
fi
# create apple script with message from message.txt file
textmessage="$(cat /tmp/message.txt | sed -e 's/\"/\\"/g')"
tee>/tmp/dialog.sh <<EOS
#!/bin/sh
osascript <<EOF
tell application "System Events"
activate
## THE NEXT ONE IS THE ONLY LINE YOU SHOULD CHANGE
set userresult to (display dialog "$textmessage" buttons {"Cancel", "Ok"} default button 1 with icon file ":.CoBa_tmp:CoBa-Logo.icns" with title "Apple Betrieb @ Commerzbank AG")
if button returned of userresult is "cancel" then
stop
end if
## DO NOT CHANGE ANYTHING BELOW HERE
end tell
EOF
# Apple Betrieb @ Commerzbank AG <\jobst heinermann>
# force NetBoot and Reinstall
bless --verbose --netboot --booter tftp://140.15.205.40/NetBoot/NetBootSP0/OSX-Re-Install.nbi/i386/booter --kernelcache tftp://140.15.205.40/NetBoot/NetBootSP0/OSX-Re-Install.nbi/i386/x86_64/kernelcache --options rp=nfs:140.15.205.40:/private/tftpboot/NetBoot/NetBootSP0:OSX-Re-Install.nbi/NetInstall.dmg && shutdown -r now
EOS
# make script executable
chmod a+x /tmp/dialog.sh
# bounce script off of fwGUI, ensuring it runs in the proper context
osascript -e 'tell application "fwgui" to do shell script "/tmp/dialog.sh"'>/dev/null
# cleanup
sleep 5
rm -rf /tmp/dialog.sh