Posted on 06-02-2010 09:21 AM
I am going to be upgrading my users from Parallels 4 to 5 via Casper and I
am running into issues with existing *.pvm after uninstalling 4 and
installing 5. What I was thinking of doing is just deleting the
~/Documents/Parallels folder on each of the machines but then I thought that
some of our users may have a few extra VMs not created from their Boot Camp
partition.
To get a feel for what is going on in the environment and before going
forward I thought to create an extension attribute script. I logged into the
list to ask how to get the script inside of the result tags when I saw David
Marcantonio's email "Extension Attribute: Screensaver Time" @ Fri, May 28,
2010 at 11:56 AM and decided to make it a variable like he did. In the
interests of sharing, here you go :)
#!/bin/bash
vmresult=$(for i in `ls /Users`; do
if [ -d /Users/$i/Documents/Parallels/ ]; then
ls -d /Users/$i/Documents/Parallels/*.pvm
fi
done)
echo "<result>$vmresult</result>"
exit 0
Critiques are encouraged. :)
Ryan M. Manly
Glenbrook High Schools
ACMT, ACSP, Net+, CCA
Posted on 06-02-2010 12:22 AM
I started thinking at lunch about testing for errors and other issues and it
just got too complicated so here is a better one:
#!/bin/bash
vmlist=$(find /Users -type d -iname "*.pvm")
vmcount=$(echo $vmlist | wc -w)
if [ $vmcount -eq 0 ];
then
echo "<result>None</result>"
else
echo "<result>$vmlist</result>"
fi
exit 0
"wc -l" was returning 1 for the situation where there was one *.pvm and also
where there was none. That is why I switched to "wc -w".
If someone (Mr. Larkin) ;) could explain to me why I got an empty line I
would be in your debt.
Ryan M. Manly
Glenbrook High Schools
ACMT, ACSP, Net+, CCA