JSzinger Posted February 1 Share Posted February 1 Is anyone checking to see if two profiles are loaded before running an installer package? I know how to use a requirements script to check for one profile. What is a best practice to check for two and only run the installer if both profiles are loaded. Can I just have two requirements scripts? or do I need to modify my current script to look for both profiles and only exit with '0' if both are there. Link to comment Share on other sites More sharing options...
Moderators Josh Levitsky Posted February 1 Moderators Share Posted February 1 You could use the one requirement script and where it checks for the one profile just use an OR condition in the script to say profile A or profile B if present is ok. If you wanted both then AND can do it. That's how I'd approach it. 2 scripts can also work I imagine but I've just not done that though I can't see why it wouldn't work if you are trying to say BOTH should be there because each script would have an exit code allowing things to run or not run. Single script would give you the ability to say this OR that. Link to comment Share on other sites More sharing options...
JSzinger Posted February 1 Author Share Posted February 1 I am going to try both ways. Using multiple scripts sounds simpler and I can put together a test fileset pretty easily. I have been working on a script to check for both but it's not working as expected yet. I'll let you know what I ultimately use. Thanks. 1 Link to comment Share on other sites More sharing options...
Moderators Sean Posted February 2 Moderators Share Posted February 2 Multiple Requirement Script will increase the traffic back to server, so I'd keep to one if possible. Try the following: #!/bin/zsh counter=0 total=$# found_profile="" while [ $# -gt 0 ] do find_this="profileIdentifier: $1" found_profile=$(profiles list all | awk -v search=$find_this '$0 ~ search {print $NF}') if [ ! -z $found_profile ] then counter=$(( $counter + 1 )) fi shift done if [ $counter -ne $total ] then exit 1 fi exit 0 Add each required profile ID, of each profile to be located, as individual Launch Arguments in the scripts Get Info > Executable. Doesn't matter how many you add, script should only exit 0 if all added Launch Arguments are found. 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now