Taylor Hempy updated April 21, 2010 at 7:55 PM
Concepts
We can infer whether a user has installed ChronoSync by checking for the presence of Application Support files and infer the version they have installed by identifying directories unique to a particular version.
ID Tests
We can determine whether or not ChronoSync is installed by testing for the existence of the /Home/[username]/Library/Application\ Support/ChronoSync directory.
ChronoSync 4 introduces a new directory in the user's /Library/Application\ Support/ChronoSync folder called "Templates". By testing for this directory's existence on the server we can determine if ChronoSync 4 is installed.
Note: These tests assume the user has successfully synchronized after upgrading.
The Script
This code will perform the two tests above. If the Templates directory exists, it will report "4 [username]". If only the ChronoSync Application Support directory exists, it will report "3 [username]". If neither exist, it will report "X [username]". It will then sort the results so that all the versions are together.
Note: This script can be deployed over ARD.
#!/bin/sh
# Create a file in /tmp that has only the heaer " ChronoSync Version Report". Leading space is included so that when we run sort it will appear at top.
echo " ChronoSync Version Report" > /tmp/CSyncVersion
# Get a listing of only directories in /Home on the server and for each line (each directory) run the following commands.
ls -d /Home/* | sed 's/\/Home\///g' | while read line
do
# If the user has the Templates directory, we can infer the they have version 4. Print this information to the report.
if [ -e /Home/$line/Library/Application\ Support/ChronoSync/Templates ];
then
echo "4 $line" >> /tmp/CSyncVersion
else
# If the user didn't have version 4, check to see if they have the ChronoSync application support directory and if they do, report that they have version 3 installed.
if [ -e /Home/$line/Library/Application\ Support/ChronoSync/ ];
then
echo "3 $line" >> /tmp/CSyncVersion
else
# If they didn't have the ChronoSync application support directory either, report that ChronoSync isn't installed (indicated with an X).
echo "X $line" >> /tmp/CSyncVersion
fi
fi
done
# Get the contents of the report, sort them alphabetically, and display the results.
sort /tmp/CSyncVersion
# Remove the temporary report file.
rm /tmp/CSyncVersion