Commit 3a48304a authored by Rusty Myers's avatar Rusty Myers

Adding function to run script during logout

parent d81ca94c
#tag BuildAutomation Begin BuildStepList Linux Begin BuildProjectStep Build End End Begin BuildStepList Mac OS X Begin IDEScriptBuildStep SaveProject , AppliesTo = 0 DoCommand "SaveFile" End Begin BuildProjectStep Build End Begin IDEScriptBuildStep UnDock , AppliesTo = 0 Dim AppLocation as String = CurrentBuildAppName + ".app" AppLocation = AppLocation.ReplaceAll( " ", "\ " ) AppLocation = CurrentBuildLocation + "/" + AppLocation //@ More cocoa info.plist keys here: // https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html Call DoShellCommand("/usr/bin/defaults write " + AppLocation + "/Contents/Info ""LSBackgroundOnly"" -bool ""true""") Call DoShellCommand("/bin/chmod 644 " + AppLocation + "/Contents/Info.plist") End Begin IDEScriptBuildStep tarProject , AppliesTo = 0 /// Set Variables dim packageLoc, res, tarname as string tarname = "Idle-Logout.tar.bz2" packageLoc = "/Users/rzm102/Documents/_Programing/Git/IdleLogout/" //print "Build Location: "+CurrentBuildLocation 'if CurrentBuildLocation="/Users/rzm102/Documents/_Programing/Git/IdleLogout/Builds\ \-\ psuIdleLogout.rbvcp/OS\ X\ 64\ bit" then ' '// Tar up folder 'res = DoShellCommand _ '("cd "+CurrentBuildLocation+"; /usr/bin/tar -c --exclude='.svn' -vjf "+tarname+" *") 'if res = "" then 'print "Results: "+res 'end '// Delete old tar '// print "rm "+packageLoc+tarname 'res = DoShellCommand _ '("rm "+packageLoc+tarname) ' '// Move tar to luggage folder '// print "mv "+CurrentBuildLocation+"/"+tarname+" "+packageLoc '// res = DoShellCommand _ '("mv "+CurrentBuildLocation+"/"+tarname+" "+packageLoc) ' '// Make package '// res = DoShellCommand _ '("cd "+packageLoc+"; make pkg; open "+packageLoc) '// print res 'else '// print "Not on rusty's mac. Skipping pkg creation" '//print CurrentBuildLocation//print "Build Location: "+CurrentBuildLocation 'end End Begin IDEScriptBuildStep PkgApp , AppliesTo = 0 Dim result as String Dim command As String Dim source as String Dim dest as String // Path to Build Path Dim ProjectPath as String = " " + CurrentBuildLocation 'print ProjectPath // Path to Project Root Dim ProjectRoot as String = ProjectShellPath.ReplaceAll( " ", "\ " ) ProjectRoot = Replace(ProjectRoot, "psuIdleLogout.rbvcp", "") 'print ProjectRoot // Path to Application Dim AppLocation as String = CurrentBuildAppName + ".app" AppLocation = AppLocation.ReplaceAll( " ", "\ " ) AppLocation = CurrentBuildLocation + "/" + AppLocation 'print AppLocation // Path to Pkg Output Dim BuildOutput as String = ProjectShellPath + "IdleLogout Builds/IdleLogout-" + PropertyValue("IdleLogout.ShortVersion") + ".pkg" BuildOutput = BuildOutput.ReplaceAll( " ", "\ " ) BuildOutput = Replace(BuildOutput, "psuIdleLogout.rbvcp", "") // Make root dirs command = "mkdir -p " + CurrentBuildLocation + "/Library/LaunchAgents/" result = DoShellCommand(command) command = "mkdir -p " + CurrentBuildLocation + "/Library/CLMshared/Startup\ Items/" result = DoShellCommand(command) // Move App source = " " + AppLocation dest = " " + CurrentBuildLocation + "/Library/CLMshared/Startup\ Items/" command = "mv " + source + dest result = DoShellCommand(command) // Copy LaunchAgent source = " " + ProjectRoot + "IdleLogout\ Builds/LaunchAgent/edu.psu.idlelogout.plist" dest = " " + CurrentBuildLocation + "/Library/LaunchAgents/" command = "cp" + source + dest result = DoShellCommand(command) // Build Pkg command = "/usr/bin/pkgbuild --version " + PropertyValue("IdleLogout.ShortVersion") +" --identifier edu.psu.idlelogout --root " + CurrentBuildLocation + " " + BuildOutput result = DoShellCommand(command) print result // Delete the project root command = "rm -R " + ProjectPath result = DoShellCommand(command) // Run AutoPkg Recipe 'command = "/usr/local/bin/autopkg run -vvv IdleLogout.bigfix -k pathname=" + BuildOutput + " -k version=" + PropertyValue("IdleLogout.ShortVersion") 'print command 'result = DoShellCommand(command) 'print result End End Begin BuildStepList Windows Begin BuildProjectStep Build End End #tag EndBuildAutomation
\ No newline at end of file
#tag BuildAutomation Begin BuildStepList Linux Begin BuildProjectStep Build End End Begin BuildStepList Mac OS X Begin IDEScriptBuildStep SaveProject , AppliesTo = 0 DoCommand "SaveFile" End Begin BuildProjectStep Build End Begin IDEScriptBuildStep UnDock , AppliesTo = 0 Dim AppLocation as String = CurrentBuildAppName + ".app" AppLocation = AppLocation.ReplaceAll( " ", "\ " ) AppLocation = CurrentBuildLocation + "/" + AppLocation //@ More cocoa info.plist keys here: // https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html Call DoShellCommand("/usr/bin/defaults write " + AppLocation + "/Contents/Info ""LSBackgroundOnly"" -bool ""true""") Call DoShellCommand("/bin/chmod 644 " + AppLocation + "/Contents/Info.plist") End Begin IDEScriptBuildStep tarProject , AppliesTo = 0 /// Set Variables dim packageLoc, res, tarname as string tarname = "Idle-Logout.tar.bz2" packageLoc = "/Users/rzm102/Documents/_Programing/Git/IdleLogout/" //print "Build Location: "+CurrentBuildLocation 'if CurrentBuildLocation="/Users/rzm102/Documents/_Programing/Git/IdleLogout/Builds\ \-\ psuIdleLogout.rbvcp/OS\ X\ 64\ bit" then ' '// Tar up folder 'res = DoShellCommand _ '("cd "+CurrentBuildLocation+"; /usr/bin/tar -c --exclude='.svn' -vjf "+tarname+" *") 'if res = "" then 'print "Results: "+res 'end '// Delete old tar '// print "rm "+packageLoc+tarname 'res = DoShellCommand _ '("rm "+packageLoc+tarname) ' '// Move tar to luggage folder '// print "mv "+CurrentBuildLocation+"/"+tarname+" "+packageLoc '// res = DoShellCommand _ '("mv "+CurrentBuildLocation+"/"+tarname+" "+packageLoc) ' '// Make package '// res = DoShellCommand _ '("cd "+packageLoc+"; make pkg; open "+packageLoc) '// print res 'else '// print "Not on rusty's mac. Skipping pkg creation" '//print CurrentBuildLocation//print "Build Location: "+CurrentBuildLocation 'end End Begin IDEScriptBuildStep PkgApp , AppliesTo = 0 Dim result as String Dim command As String Dim source as String Dim dest as String // Path to Build Path Dim ProjectPath as String = " " + CurrentBuildLocation 'print ProjectPath // Path to Project Root Dim ProjectRoot as String = ProjectShellPath.ReplaceAll( " ", "\ " ) ProjectRoot = Replace(ProjectRoot, "psuIdleLogout.rbvcp", "") 'print ProjectRoot // Path to Application Dim AppLocation as String = CurrentBuildAppName + ".app" AppLocation = AppLocation.ReplaceAll( " ", "\ " ) AppLocation = CurrentBuildLocation + "/" + AppLocation 'print AppLocation // Path to Pkg Output Dim BuildOutput as String = ProjectShellPath + "IdleLogout Builds/IdleLogout-" + PropertyValue("IdleLogout.ShortVersion") + ".pkg" BuildOutput = BuildOutput.ReplaceAll( " ", "\ " ) BuildOutput = Replace(BuildOutput, "psuIdleLogout.rbvcp", "") // Make root dirs command = "mkdir -p " + CurrentBuildLocation + "/Library/LaunchAgents/" result = DoShellCommand(command) command = "mkdir -p " + CurrentBuildLocation + "/Library/CLMshared/Startup\ Items/" result = DoShellCommand(command) // Move App source = " " + AppLocation dest = " " + CurrentBuildLocation + "/Library/CLMshared/Startup\ Items/" command = "mv " + source + dest result = DoShellCommand(command) // Copy LaunchAgent source = " " + ProjectRoot + "/IdleLogout\ Builds/LaunchAgent/edu.psu.idlelogout.plist" dest = " " + CurrentBuildLocation + "/Library/LaunchAgents/" command = "cp" + source + dest result = DoShellCommand(command) // Build Pkg command = "/usr/bin/pkgbuild --version " + PropertyValue("IdleLogout.ShortVersion") +" --identifier edu.psu.idlelogout --root " + CurrentBuildLocation + " " + BuildOutput result = DoShellCommand(command) print result // Delete the project root 'command = "rm -R " + ProjectPath 'result = DoShellCommand(command) // Run AutoPkg Recipe command = "/usr/local/bin/autopkg run -vvv IdleLogout.bigfix -k pathname=" + BuildOutput + " -k version=" + PropertyValue("IdleLogout.ShortVersion") print command 'result = DoShellCommand(command) 'print result End End Begin BuildStepList Windows Begin BuildProjectStep Build End End #tag EndBuildAutomation
\ No newline at end of file
......
This diff is collapsed.
......@@ -3,7 +3,7 @@ IdleLogout.app
Description
------------
Application to log out users after a specified period of time. The user will see a prompt with a countdown asking them if they wish to log out or continue working ("More Time"). Users can disable the Idle Logout process using the "Disable Idle Logout.applescript". Remote Control (VNC/ARD over port 5900) will block the logout process unless SkipRemoteControlCheck is set to True in the preference file.
Application to log out users after a specified period of time. The user will see a prompt with a countdown asking them if they wish to log out or continue working ("More Time"). Users can disable the Idle Logout process using the "Disable Idle Logout.applescript". Remote Control (VNC/ARD over port 5900) will block the logout process unless SkipRemoteControlCheck is set to True in the preference file. A optional script can be run before a user is logged out.
**The Idle Logout App will force close any applications the user has open. This will not save any data!**
......@@ -33,7 +33,8 @@ The Idle Logout.app looks for the preference file "/Library/Preferences/edu.psu.
* WaitForUserPromptSeconds = Number of seconds to wait for user to respond to logout prompt.
* WindowTitle = Changes the name shown in the logout window. Uses String.
* WindowMessage = Changes the text shown on the logout window. Uses String.
* SkipRemoteControlCheck = Skips ARD check and logs out if TRUE
* SkipRemoteControlCheck = Skips ARD check and logs out if TRUE.
* LogOutScriptPath = Run a script before user is logged out. Can be any script the terminal supports.
Default Values if plist is not installed:
......@@ -45,6 +46,7 @@ Default Values if plist is not installed:
* WindowTitle = "PSU Idle Logout"
* WindowMessage = "This Mac is idle.\n\nClick the \"More Time\" button to continue using the Mac.\n\nOtherwise, an automatic logout will occur and all unsaved documents will be LOST!"
* SkipRemoteControlCheck = False
* LogOutScriptPath = None
Defaults can be set quickly for all users using defaults write:
......@@ -56,6 +58,7 @@ Defaults can be set quickly for all users using defaults write:
* defaults write /Library/Preferences/edu.psu.idlelogout.plist WindowTitle -string "Our Idle Logout"
* defaults write /Library/Preferences/edu.psu.idlelogout.plist WindowMessage "You're going to be logged out\n\n\nDude\!"
* defaults write /Library/Preferences/edu.psu.idlelogout.plist SkipRemoteControlCheck -bool FALSE
* defaults write /Library/Preferences/edu.psu.idlelogout.plist LogOutScriptPath -string "/path/to/script.sh"
Background
------------
......@@ -66,11 +69,11 @@ The terminal command we use to check idle seconds on USB devices is:
ToDo
-------------
* No Known Issues - Please use GitHub Issues
* No Known Issues - Please use Issues to report any.
Completed
------------
* 10/2017 - Adding SkipRemoteControlCheck to log out even if remote control is true.
* 10/2017 - Adding SkipRemoteControlCheck to log out even if remote control is true. Added script run during logout process.
* 01/2017 - Updated preferences to use CFPrefsD through macoslibs. Update code to Cocoa (Only update UI from main thread).
* 01/2015 - The path to the logout script should be set in the preference file OR the script should be part of the app.
* 01/2015 - Make it part of the .app, create a new method to log out
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment