K1000 Mac Scripting
I've been having issues for a long time with Mac scripts with the $(KACE_DEPENDECY_DIR) variable. It never seems to work on Macs, but does for Windows. So in order for me to get my scripts to work with dependencies, I have to specify the full path to where the script goes (i.e. /Library/Application\ Support/Dell/KACE/data/kbots_cache/packages/kbots/453).
Is there a $KACE DEPENDENCY DIR variable for Macs? Do I just have the name/capitalization/syntax wrong?
Answers (5)
There are many ways to bake a cake; I mean do things in Kace. In this situation, when trying to use a profile file with a unix Command on a MAC we ran into pathing issues; Kace know where $(KACE_DEPENDECY_DIR) but the MAC obviously did not. So despite several attempts to work with $(KACE_DEPENDECY_DIR), we opted to just unzip the profile file into a known location /tmp and point our MAC unix commands to /tmp Success!
$KACE_DEPENDENCY_DIR should work in a Mac script. What version of the K1000 do you have installed?
Comments:
-
We use it all the time, works like a charm - Jbr32 10 years ago
-
I must be doing something wrong then. Here's a script I'm working on that removes our staff/faculty Macs from student-access and older employee-access configs that don't work anymore because the certificate expired.
This is for OSX 10.6 and under.
employee-access-profile.1 is a dependency.
On Success
Launch "/usr/sbin\networksetup" with params "-setairportpower en1 off".
Launch "/usr/sbin\networksetup" with params "-removepreferredwirelessnetwork en1 employee-access".
Launch "/usr/sbin\networksetup" with params " -removepreferredwirelessnetwork en1 student-access".
Launch "/usr/sbin\networksetup" with params "-deletesystemprofile AirPort ".
Launch "/usr/sbin\networksetup" with params "-import8021xProfiles AirPort $KACE_DEPENDENCY_DIR/employee-access-profile.1".
Launch "/usr/sbin\networksetup" with params "-setairportpower en1 on".
The 2nd to last line with $KACE_DEPENDENCY_DIR does not work. However if I replace that with the full path /Library/Application\ Support/Dell/KACE/data/kbots_cache/packages/kbots/453 it does work. - jtremblay 10 years ago
jtremblay - does your script look like the image below?
Comments:
-
No, I'm using Directory: /usr/bin then File (unix command) and I'm trying to put $(KACE_DEPENDENCY_DIR) as a variable in Target. Is that incorrect? How should I call unix commands?
Also, I can't figure out how to post an image like you did. - jtremblay 10 years ago
Comments:
-
I just did a quick test and it appears that $(KACE_DEPENDENCY_DIR) is a full path, but it does include spaces. Perhaps try "$(KACE_DEPENDENCY_DIR)" - Jbr32 10 years ago
-
I tried replacing the full path as above with:
-import8021xProfiles AirPort $(KACE_DEPENDENCY_DIR)/employee-access-profile.1
And it doesn't work.
I also tried the same but with no / after $(KACE_DEPENDENCY_DIR) which also didn't work. - jtremblay 10 years ago-
I think this might be one of those cases where I would get creative with my deployment.
Here is what I would try, add an additional dependency called moveThis.sh
Just prior to your import command, execute moveThis.sh which basically just contains the following:
mv $(KACE_DEPENDENCY_DIR)/employee-access-profile.1 /tmp/
Then run your import command but change the path to reflect the new location of your employee-access-profile.1 file as /tmp - Jbr32 10 years ago
So here's the revised script.
employee-access-profile.zip contains employe-access-profile.1 and movethis.sh, which is chmod'ed +x and contains "mv $(KACE_DEPENDENCY_DIR)/employee-access-profile.1 /tmp"
This script still doesn't work. On my test machine, I opened a terminal, went to the script dir, and executed:
(KACE_DEPENDENCY_DIR)= path
But I just get command not found.
If I remove the ('s it works. So I take it OSX doesn't like ('s in a variable name.
However, even when I remove the the ('s and sudo sh movethis.sh, it still doesn't work. It's not passing the variable.
Comments:
-
For the screenshot above, I do not see under dependencies the moveThis.sh file (I was just making up a file name). - Jbr32 10 years ago
-
It's in the zip file - jtremblay 10 years ago
-
Does your employee-acces-profile.1 file end up in /tmp ? - Jbr32 10 years ago
-
No, employee-access-profile.1 doesn't get moved. - jtremblay 10 years ago
-
Can you post the contents of the moveThis.sh script you created. It sounds like there might be an error in there. - Jbr32 10 years ago
-
movethis.sh:
mv $KACE_DEPENDENCY_DIR/employee-access-profile.1 /tmp
I tried it with and without ('s. It's looking to me like the variable only works on the K1000 server side, not on the client end. - jtremblay 10 years ago -
I changed it to: mv employee-access-profile.1 /tmp
However the profile doesn't get moved. Can't tell if the movethis.sh is not running or if it errors out. If I manually run it from the terminal on the target it does move. - jtremblay 10 years ago