Posted on 01-17-2012 09:29 AM
I have a number individually packaged AAMEE apps available in self service, but when users install them, the adobe installers can't help but install the protected content for another app, which to users, just looks like a broken app. I'd love to come up with a universal way of cleaning up after AAMEE CS5 (and 5.5) installs since I can't dictate order apps are installed in. I tried scripting this for a while yesterday, but failed. I'm sure given 6 more months I would figure it out, but I'm sure someone here would be able to do it in a few minutes. Anyone care to assist?
Here's a more specific example:
Install After effects AAMEE package build with AAMEE 2.x
Case 1: Install After Effects.pkg. (AAMEE package with nothing but after effects)
This also adds "/Applications/Adobe Premier Pro CS5/Adobe Premier Pro CS5.app/" (and a bunch of other app folders, but we will focus on Premier)
The problem is that the .app bundle is broken and wasn't desired to be there anyway. This protected content might be desireable if premier was installed previously. Since premier is not on the machine, I want to remove the Premier folder and contents from /Applications Simple...remove the directory via a posflight, unix command, etc in the after effects policy. BUT, if only it were that simple.
Case 2: Install Premier.pkg (AAMEE package) Install After Effects.ppkg (AAMEE package)
If I fixed this the "easy way", I would have just deleted the desired Premier Pro. Not my intended effect. This is just one folder example. There are many more. So, I started thinking "How do I know which directories are intentional and which ones are unintentional due to AAMEE not being all that smart?"
The only thing I can find is that EVERY folder installed with lack info.plist in the app bundle (if the .app bundle even exists) in $appname.app/Contents/Info.plist. If I loop though Applications looking for CS5 folders, then I should be able to figure out which CS5 folders contain working apps.
Looking at a working app, Info.plist exists in /Applications/Adobe Illustrator CS5/Adobe Illustrator.app/Contents
It does not exist in"/Applications/Adobe Premiere Pro CS5/Adobe Premiere Pro CS5.app/Contents/"
If that is true for all unintended "protected content" installs, then this should be easy to script. I just can't figure out how. I want to loop through /Applications finding every folder with CS5 in it. Then check for the existence of $basepath/Contents/Info.Plist. If it's there, then the folder stays. If it's not, then delete the AppFolder from /Applications.
Some notes: The App is always named the same as the base folder. (eg. "/Applications/Adobe Illustrator CS5" will always contain "Adobe Illustrator CS5.app"). Info.plist is always in $app/Contents/
Anyone interested in cracking this one?
Thanks!
Aaron
Posted on 01-17-2012 03:01 PM
Perhaps I was too wordy?
In short, I'd like to: Loop through /Applications, finding only folders at the root of /Applications applications with CS5 in their name. From that list, search the .app bundle in teh folder for an Info.plist in the app bundle. If it exists, leave it alone and go to the next item in the list. If there's no Info.plist, then the application and it's containing folder should be removed from /Applications.
With this script in hand, I could use individually packaged AAMEE installers with this running after each install to cleanup partial app bits and pieces. Adobe calls it "protected content". I called it unwanted.
Anyone?
Posted on 01-19-2012 03:08 PM
I think I did it. Does anyone see any issues with this? I'm not great with sanity checks or scripting in general. I often don't know that I'm "walking on thin ice". Is there something that I should do to make sure that I don't wipe my entire drive. I've checked this out with some test files and so far, so good.
#!/bin/sh
# AAMEEcleanup.sh
#
#
# Created by Aaron Robinson on 1/19/12.
# Copyright 2012. All rights reserved.
#Need to stop shell from interpreting spaces as separators
IFS='
'
#What CS vsersion do we want to search for. Use CS3 CS4 CS5 CS5.1, etc
searchstring="CS6"
currentTime=$(date +%H%M%S)
#Find all $searchstring folders within /Applicatons
for path in $(/usr/bin/find /Applications -maxdepth 1 -name "*${searchstring}"); do
folderpath=${path}
appname=`/bin/echo "${path}" | cut -d'/' -f3`
plistpath=${path}"/"${appname}".app/Contents/Info.plist"
#echo "Base folder path is "$path
#echo "Application name is "$appname
#echo "Plist path is $plistpath"
if [ ! -e ${plistpath} ]; then
if [[ ${folderpath} =~ 'Adobe' ]]; then
#echo "DELETE: $plistpath does not exist"
#echo "Deleting $folderpath"
echo Removing ${folderpath} >> /tmp/adobecleanup_${date}.txt
/bin/rm -Rf ${folderpath}
fi
else
/bin/echo "LEAVE: "${plistpath}" exists"
fi
done
unset IFS
exit 0