Aspera Connect - thank you IBM for this lovely "package"

donmontalvo
Esteemed Contributor II

Has anyone taken a look at Aspera Connect 3.5.2.x? Owned by IBM, and until today not listed under Third-Party Products, it is distributed as an .app installer, with the requisite PKG icon, probably a hint that IBM thinks we won't notice. It has a 501 line .script (AppleScript) intrusive script embedded in it. It has an embedded flat *.mpkg installer, that has embedded scripts with such lovely syntax as:

Apparently the person writing the preflight script doesn't believe in close quotes...

if [ $is_admin = "yes" ] ; then
  echo removing system wide apps
  rm -rf /Applications/Aspera Connect.app
  rm -rf /Applications/Aspera Crypt.app
  echo removing system wide plugin 
  rm -rf /Library/Internet Plug-Ins/Aspera Web.plugin
  rm -rf /Library/Internet Plug-Ins/Aspera Web.webplugin
  # this is for versioned plugin dirs
  rm -rf /Library/Internet Plug-Ins/Aspera Web*
fi

echo removing local user plugin 
rm -rf ~/Library/Internet Plug-Ins/Aspera Web.plugin
rm -rf ~/Library/Internet Plug-Ins/Aspera Web.webplugin
rm -rf ~/Library/Internet Plug-Ins/Aspera Web*

echo exiting preflight

The postflight littered with copy/pasted blocks of unquoted commands like...

    rmdir "$source_dir/Library/Internet Plug-Ins" || echo $target_dir/Library/Internet Plug-Ins not empty
    rmdir "$source_dir/Library" || echo $target_dir/Library not empty

(believe it, the snippet is unedited...the required quotes did not disappear into the ether)

I'm writing this a second time, since IBM's Aspera Connect developers felt it was OK to force my browsers to close.

--
https://donmontalvo.com
1 ACCEPTED SOLUTION

mm2270
Legendary Contributor II

As long as the structure of that .mf file doesn't change from one version to the next (only the version string within it), then the following should work to pull the version into an EA:

#!/bin/sh

productinfo="/Applications/Aspera Connect.app/Contents/Resources/product-info.mf"

if [ -e "$productinfo" ]; then
    version=$(awk -F'>|<' '/<version>/{print $3; exit}' "$productinfo")
    echo "<result>$version</result>"
else
    echo "<result>N/A</result>"
fi

If that file's structure changes at all, the above could break though.

View solution in original post

40 REPLIES 40

kstrick
Contributor III

i've dealt with there stuff before... it's a "lovely" installer :D....
there are many issue i have with it... (system-wide vs per user installs, etc...)
we are up to version 3.6.1 over here now

What i ended up doing is extracting the base package using pacfist, then packaging it up (with Packages) with my own pre and post flight scripts...

donmontalvo
Esteemed Contributor II

Hi @kstrick, that's what usually happens when we have to create a package from a heap of smelly code. :)

If you don't mind my asking, what did you do in your pre/post flight scripts?

--
https://donmontalvo.com

kstrick
Contributor III

Here's what i've been doing, seems to work pretty well....

I got into their installer app (grrr... installer apps...) and I pull out their .mpkg...
I open it with Pacifist and extract the asperaconnect.pkg

I then go into Packages,
and i throw the package in the 'Additional Resources' area of the 'Scripts' tab....
then attach the two scripts below.

The first script removes older versions that exist either User-wide or System-wide...
second script just installs the package.

Preinstall Script

#!/bin/bash

killall asperaconnect
killall asperacrypt
sleep 2

rm -rf /Library/Internet Plug-Ins/Aspera Web.plugin 2> /dev/null
rm -rf /Library/Internet Plug-Ins/Aspera Web.webplugin 2> /dev/null
rm -rf /Library/Internet Plug-Ins/Aspera Web* 2> /dev/null
rm -rf /Library/Application Support/Aspera/Aspera Connect 2> /dev/null

for EXISTING_USER in $(/bin/ls /Users | sed -e '/Shared/d' -e '/Deleted Users/d' -e '/.localized/d' -e '/.DS_Store/d' -e '/.com.apple.timemachine.supported/d' -e '/Adobe/d' -e '/Library/d');
do
    rm -rf /Users/${EXISTING_USER}/Library/Internet Plug-Ins/Aspera Web.plugin 2> /dev/null
    rm -rf /Users/${EXISTING_USER}/Library/Internet Plug-Ins/Aspera Web.webplugin 2> /dev/null
    rm -rf /Users/${EXISTING_USER}/Library/Internet Plug-Ins/Aspera Web* 2> /dev/null
    rm -rf /Users/${EXISTING_USER}/Library/Application Support/Aspera/Aspera Connect 2> /dev/null
done

exit 0

Postinstall Script

#!/bin/bash

# Determine OS version
osx_vers=$(sw_vers -productVersion | awk -F "." '{print $2}')

# Determine working directory

install_dir=`dirname $0`

if [[ ${osvers} -lt 7 ]]; then
sudo installer -dumplog -verbose -pkg "$install_dir/asperaconnect.pkg" -target /

else
sudo installer -allowUntrusted -dumplog -verbose -pkg "$install_dir/asperaconnect.pkg" -target /
fi

exit 0

donmontalvo
Esteemed Contributor II

Thanks @kstrick, your feedback is awesome! I finally had a chance to circle back and work on this.

I took what you provided and tweaked it a bit. The PKG is deployable in its current state (I do remember it being distributed as an *.app in the past). I'm also a HUGE fan of Packages.app, fortunately it isn't needed for this twist on your idea. Basically deploy the native PKG but run a cleanup script first (see below, now it may not be needed).

  1. Download the PKG, it seems to be a flat/signed deployable PKG now, and upload to JSS.

  2. Create/upload pre-installation script (below), have it run Before.

#!/bin/bash
#
################################################################
# Adapted from a script posted on JAMF Nation:
# https://jamfnation.jamfsoftware.com/discussion.html?id=17091
# 20151018 DM
################################################################

# Variables
Existing_Users=`dscl . list /Users UniqueID | awk '$2 > 500 { print $1 }'`

# Kill processes
/usr/bin/killall asperaconnect 2> /dev/null
/usr/bin/killall asperacrypt 2> /dev/null

# Sleep
/bin/sleep 2

# Forget receipts
/usr/sbin/pkgutil --forget com.aspera.AsperaWeb 2> /dev/null
/usr/sbin/pkgutil --forget com.aspera.connect 2> /dev/null
/usr/sbin/pkgutil --forget com.aspera.crypt 2> /dev/null

# Remove local level stuff
/bin/rm -rf /Applications/Aspera Connect.app 2> /dev/null
/bin/rm -rf /Applications/Aspera Crypt.app 2> /dev/null
/bin/rm -rf /Library/Internet Plug-Ins/Aspera Web* 2> /dev/null
/bin/rm -rf /Library/Application Support/Aspera/Aspera Connect 2> /dev/null

# Remove user level stuff
for u in $Existing_Users
do
    /bin/rm -rf /Users/"$u"/Applications/Aspera Connect.app 2> /dev/null
    /bin/rm -rf /Users/"$u"/Applications/Aspera Crypt.app 2> /dev/null
    /bin/rm -rf /Users/"$u"/Library/Internet Plug-Ins/Aspera Web* 2> /dev/null
    /bin/rm -rf /Users/"$u"/Library/Application Support/Aspera/Aspera Connect 2> /dev/null
    /bin/rm -rf /Users/"$u"/Library/Receipts/com.aspera.* 2> /dev/null
done

exit 0

As a side note, the developer seemed to be welcome to input. Version 3.6.1 appears to default to local level install. Users who run it in Finder will be prompted for admin credentials, whereas hitting Change Install Location... will first warn them with an error:

Non admin user error

...if user clicks Install for me only the error goes away, and it installs into user's home directory.

Non admin user error

Not very intuitive...provided more feedback to developer.

Another note, the developer added logic to the 3.6.1 installer so user level stuff installed before gets removed, before installing at the proper local level. So the above script is probably moot, but will keep it in the policy to be sure. ;)

HTH,
Don

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

Apparently I'm not the only one thanking them (@gregneagle). :)

a2e7ca04d4f74e2fb7f840c3c66a5dbf

--
https://donmontalvo.com

kstrick
Contributor III

Cool, glad to a package now instead of an installer app...

Maybe that they are now owned by IBM, and IBM is now tight with apple, we will continue to see nice things :)

donmontalvo
Esteemed Contributor II

kstrick
Contributor III

@donmontalvo W00t!

kstrick
Contributor III

i guess the question i have is will we consistently get these, and how far will you have to dig to find them...
(the standard connect is at least a package now, but not system wide)

donmontalvo
Esteemed Contributor II

Hopefully that page will be the go-to for 3.6.x.

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

Well...they almost got it right. :) If the server is at an older version than the plug-in, it complains.

But, dismiss the Download Aspera Connect window (click the "x") and everything works fine.

Seems like a server side issue, I'll ping the team that handles that...

29955d2462e341288e811ac4fa1c22b6

--
https://donmontalvo.com

kstrick
Contributor III

ugh, reminds me of some Silverlight issues i've had...

donmontalvo
Esteemed Contributor II

24473ec9ac8d47fbad997965fd765b37

OK, so Aspera busted my bubble...still a number of issues with this "system-wide" installer PKG.

Not sure who the genius was who decided to rename the plug-in to /Library/Internet Plug-Ins/Aspera Web 3.6.1.111259.plugin but I'm not sure that was a great idea.

Especially if your postinstall script looks for an entirely vanilla naming convention for removing old versions of the plug-in and apps from ~/Applications and ~/Library/Internet Plug-Ins.

So, no, the old stuff does not get removed by the "system-wide" installer PKG. Good thing I kept our SubsidizeAsperaDevTeamByCleaningUpTheirMess.sh script to run before the PKG is installed.

I'm convinced IBM's internal dev team are Windows folks totally winging it on the Mac side...too bad they don't report to Fletcher Previn, or this would have been polished long ago. :(

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

Oh...I forgot to include this Suspicious Package screenshot of their "system-wide" PKG...in case you're at the water cooler and need to share a laugh...

4063124e27f14fdf881b3c93753b70bc
5e0ffb9d1f0141b6bdf7db041af5057c
8922be99902240a68e716e4aed3f6ed6

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

Thanks to JeremyH at Aspera support, we now know that both the "Internal" and Release" version information is stored in /Applications/Aspera Connect.app/Contents/Resources/product-info.mf.

I took a stab at coming up with an Extension Attribute to pull the "Release" version...any scripting gurus know how to make this command less fugly? :)

cat /Applications/Aspera Connect.app/Contents/Resources/product-info.mf | grep '<version>' | head -n 1 | cut -d " " -f3- | tr -d "<version>" | tr -d '/'
--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

Looks like I'll be calling Aspera again tomorrow...seems like the preinstall script (still) tries to traverse through existing home directories...including root home directory if the policy is running while the user is logged on...

echo removing local user plugin 
rm -rf ~/Library/Internet Plug-Ins/Aspera Web.plugin 
rm -rf ~/Library/Internet Plug-Ins/Aspera Web.webplugin 
rm -rf ~/Library/Internet Plug-Ins/Aspera Web*

Which causes this error...which Aspera's support page says is due to... the PKG unable to get into home directory/ies.

b3ae7b089911481ab30879b7fd69e956

Lets hit this out of the park, right?

ff0461591c114004943188734cb035f1

PS, a snapshot seems to do the trick, if you run a script to remove old versions and flush receipts...ugh.

Don

--
https://donmontalvo.com

mm2270
Legendary Contributor II

@donmontalvo Can you post a sanitized version of what cat /Applications/Aspera Connect.app/Contents/Resources/product-info.mf outputs? If we can see how its structured, I'm sure we can likely help come up with a more sane way to grab the version info. I'm not bothering to install this... thing on my Mac :) I like my Mac too much to punish it in such a way :)

donmontalvo
Esteemed Contributor II

Here ya go, according to Aspera support, this is where they've been storing the version information. Not sure why they don't put it into /Applications/Aspera Connect.app/Contents/Info.plist.

The first "Version" is "Release" version, the one that matches the version on the download page. The second "Version" is the "Internal" version which we don't need.

$ cat /Applications/Aspera Connect.app/Contents/Resources/product-info.mf
<product>
  <name>Aspera Connect</name>
  <version>3.6.6.119698</version>
  <components>
    <component>
      <name>ascp</name>
      <version>3.5.6.112424</version>
    </component>
  </components>
</product>
--
https://donmontalvo.com

mm2270
Legendary Contributor II

As long as the structure of that .mf file doesn't change from one version to the next (only the version string within it), then the following should work to pull the version into an EA:

#!/bin/sh

productinfo="/Applications/Aspera Connect.app/Contents/Resources/product-info.mf"

if [ -e "$productinfo" ]; then
    version=$(awk -F'>|<' '/<version>/{print $3; exit}' "$productinfo")
    echo "<result>$version</result>"
else
    echo "<result>N/A</result>"
fi

If that file's structure changes at all, the above could break though.

View solution in original post

chris_kemp
Contributor III

Wow...baaaaaad flashbacks...

I remember suffering through Aspera Connect installer issues back at CNN. Nice to see them continuing the legacy... :P

michellem
New Contributor

One small note on the complaints about connect components having different versions: this is actually by design. Each of the components is built on a separately build/tool chain and it is common/intentional that Connect.app, Crypt.app and the .plugin have different version numbers within the Connect package. Realize this is confusing from the outside looking in, but it is as intended.

Michelle

donmontalvo
Esteemed Contributor II

@michellem understood but version information belongs in the appropriate Info.plist file for example /Applications/Aspera Connect.app/Content/Info.plist.

Read through the thread, the version information in that/those files is a mess. So enterprise admins have to deal with the sloppy coding, or to put it in a nicer way, the developer has to brush up on his Mac coding skills. :)

I see you just joined the forum, maybe you are from IBM? If so welcome! Hope our whining can result in some minor changes to help us deploy Aspera Connect with fewer headaches. :)

Don

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

@mm2270 I'll test mañana. :)

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

@mm2270 works like a charm...and btw, JeremyH at Aspera Support noted the "Release" version has been in that spot for quite some time. Hopefully that means it'll stay there...unless they add it to the /Applications/Aspera Connect.app/Content/Info.plist where it belongs. ;)

$ /tmp/test2.sh 
<result>3.6.6.119698</result>

PS, I forgot to mention, you saved 0.006s of my life, that's worth a JNUC beer. :)

$ time cat /Applications/Aspera Connect.app/Contents/Resources/product-info.mf | grep '<version>' | head -n 1 | cut -d " " -f3- | tr -d "<version>" | tr -d '/'
3.6.6.119698

real    0m0.010s
user    0m0.007s
sys 0m0.019s
$ time awk -F'>|<' '/<version>/{print $3; exit}' "/Applications/Aspera Connect.app/Contents/Resources/product-info.mf"
3.6.6.119698

real    0m0.004s
user    0m0.002s
sys 0m0.002s
$
--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

@michellem wrote:

One small note on the complaints about connect components having different versions: this is actually by design. Each of the components is built on a separately build/tool chain and it is common/intentional that Connect.app, Crypt.app and the .plugin have different version numbers within the Connect package. Realize this is confusing from the outside looking in, but it is as intended. Michelle

Putting together a summary for JeremyH at Aspera Support. Olive branch sent to @michellem to connect with Aspera's internal dev folks, to see if we can get proper versioning put into the Info.plist files for each app and the plugin. :)

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

Arranged for a remote session with Aspera's dev team to discuss their PKG, and the hidden cost of Mac admins having to re-engineer their software to deploy. Will post more info after the call.

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

Different kind of products, but it's a race between Aspera and [BlueJeans](shttps://jamfnation.jamfsoftware.com/discussion.html?id=17624#responseChild123654)...who can redesign their PKG to align with Apple guidelines first... :)

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

OMG took a close look at the pre/post scripts in their new version 3.6.6.119698 PKG and...well...

preinstall

loving the tildes...really...they're cute...if not stupid.

#!/bin/sh -x
#
# preflight
# 
# runs immediately after user clicks "Install" but before the actual installer
#
# ============================================================================= #

# comment out to debug
set -v off

# check for admin priveleges

echo starting preflight 

# try to handle exceptions and exit cleanly
trap "echo caught exception!; exit 0" SIGINT SIGTERM 

# grep returns 0 if it finds a match.  1 if no match
/usr/sbin/dseditgroup -o checkmember admin | grep yes > /dev/null
if [ $? -ne 0 ]; then
  is_admin="no"
  echo user is not an admin 
else
  is_admin="yes"
  echo user is an admin 
fi

connect_support_dir="$HOME/Library/Application Support/Aspera/Aspera Connect"
path_file="$connect_support_dir/etc/asperaconnect.path"
# remove local user install bits (even if they are running) to prevent
# the web installer from relaunching an outdated connect 
if [ -f "$path_file" ]; then
    echo found path file
    connect_path=`cat "$path_file"`

    # this causes the installer to fail...?
    #echo killing crypt 
    #echo looking for connect and crypt processes
    #ps -Ax | grep -i asperacrypt   | sed /grep/d | awk '{ print $1 }' | xargs kill -9
    #echo killing connect 
    #ps -Ax | grep -i asperaconnect | sed /grep/d | awk '{ print $1 }' | xargs kill -9

    if [ -d "$connect_path/Aspera Connect.app" ]; then
        echo removing "$connect_path/Aspera Connect.app"
        rm -rf "$connect_path/Aspera Connect.app"
    fi
    if [ -d "$connect_path/Aspera Crypt.app" ]; then
        echo removing "$connect_path/Aspera Crypt.app"
        rm -rf "$connect_path/Aspera Crypt.app"
    fi
    echo removing $connect_support_dir
    rm -rf "$connect_support_dir"
fi

if [ $is_admin = "yes" ] ; then
  echo removing system wide apps
  rm -rf /Applications/Aspera Connect.app
  rm -rf /Applications/Aspera Crypt.app
  echo removing system wide plugin 
  rm -rf /Library/Internet Plug-Ins/Aspera Web.plugin
  rm -rf /Library/Internet Plug-Ins/Aspera Web.webplugin
  # this is for versioned plugin dirs
  rm -rf /Library/Internet Plug-Ins/Aspera Web*
fi

echo removing local user plugin 
rm -rf ~/Library/Internet Plug-Ins/Aspera Web.plugin
rm -rf ~/Library/Internet Plug-Ins/Aspera Web.webplugin
rm -rf ~/Library/Internet Plug-Ins/Aspera Web*

echo exiting preflight

postinstall

I guess they didn't get the notice re lack of postflight in flag PKGs. Loving how they decided to circe back AFTER the install to remove OLD versions of their stuff. #facepalm

#!/bin/sh -x

echo IN POSTFLIGHT

env | sort

user=`whoami`
echo "User : $user"

echo postflight.non_legacy

target_dir="$2"
source_dir="$target_dir"

os_ver=`sw_vers -productVersion | grep 10.7`
current_user=`whoami`
# If the installer has elevated to root, then set user back to the user who launched the installer 
if [ -e "/tmp/au9jlassscJLHCkhsf2398fsfHBHUD" -a "$current_user" = "root" ]; then
    set_user=`cat /tmp/au9jlassscJLHCkhsf2398fsfHBHUD`
    rm -rf /tmp/au9jlassscJLHCkhsf2398fsfHBHUD
else
    set_user="$current_user"
fi
primary_group='staff'
admin_user='root'
admin_group='admin'

webplugin_path="/Library/Internet Plug-Ins/Aspera Web.webplugin"
webplugin_homefolder_path="$HOME/Library/Internet Plug-Ins/Aspera Web.webplugin"

# Check if the user is an admin
# If is_admin is "" = admin
# If is_admin is "no <user> is NOT a member of admin" = not admin
is_admin=`dseditgroup -o checkmember admin | grep NOT | grep no`

# Define location of current installation
app_install_location="/Applications"
plugin_install_location="/Library/Internet Plug-Ins"
home_app_install_location=`cat "$HOME/Library/Application Support/Aspera/Aspera Connect/etc/asperaconnect.path"`
home_plugin_install_location="$HOME/Library/Internet Plug-Ins"

# Exit if user is not root or Scp is installed
if [ `whoami` != "root" -o 
    -e "/Applications/Aspera Scp.app" -o 
    -e "/Applications/Aspera Enterprise Server.app" -o 
    -e "/Applications/Aspera Client.app" -o 
    -e "/Applications/Aspera Point to Point.app" ]; then
    echo "Skipping uninstall - User is not root, or shared files exist."
else
    echo "Uninstalling previous installation of Connect."

    rm -rf /Library/Aspera
    rm -rf "/Library/Application Support/Aspera"
    rm -rf /Library/StartupItems/FaspBuffers
    if [ -f /usr/bin/scp.aspera ]; then
        rm -f /usr/bin/scp.aspera
    fi
    if [ -f /usr/bin/ssh.aspera ]; then
        rm -f /usr/bin/ssh.aspera
    fi
fi


# Exit if not installing to the default location
if [ "$target_dir" = "/" ]; then
    echo "installing to /"
    # we only deliver QT packages with Connect to reduce dmg size.  Copy them to Crypt
    cp -R /Applications/Aspera Connect.app/Contents/Frameworks /Applications/Aspera Crypt.app/Contents/Frameworks
    chmod -R ug+rw /Applications/Aspera Crypt.app/Contents/Frameworks

    cp -R /Applications/Aspera Connect.app/Contents/PlugIns /Applications/Aspera Crypt.app/Contents/PlugIns
    chmod -R ug+rw /Applications/Aspera Crypt.app/Contents/PlugIns

    cp -R /Applications/Aspera Connect.app/Contents/Resources/qt.conf /Applications/Aspera Crypt.app/Contents/Resources/qt.conf
    chmod -R ug+rw /Applications/Aspera Crypt.app/Contents/Resources/qt.conf
    # Put the uninstaller the someplace usable
    mkdir -p /Library/Application Support/Aspera/Aspera Connect
    chmod -R ug+rw /Library/Application Support/Aspera/Aspera Connect
    mv /Applications/Aspera Connect.app/uninstall_connect.sh /Library/Application Support/Aspera/Aspera Connect

    chown -R root:admin /Applications/Aspera Connect.app
    chown -R root:admin /Applications/Aspera Crypt.app
    chown -R root:admin /Library/Application Support/Aspera/Aspera Connect
    chown -R root:admin "/Library/Internet Plug-Ins/Aspera Web 3.2.0.71890-x-30.plugin"

    # This occurs if running on Lion or privileges has been escalated to root
    if [ "$os_ver" != "" -o "$current_user" = "root" ]; then 

    # Clean up plugins in the user's home folder when doing an installation into /Library and /Applications
    if [ -d "$HOME/Library/Internet Plug-Ins/Aspera Web*.plugin" ]; then
            find "$HOME/Library/Internet Plug-Ins" -name "Aspera Web*.plugin" -type d -exec bash -c 'chown -R "$set_user":$primary_group "$0"' {} ;
            find "$HOME/Library/Internet Plug-Ins" -name "Aspera Web*.plugin" -type d -exec bash -c 'rm -rf "$0"' {} ;
        fi

    if [ -d "$HOME/Library/Internet Plug-Ins/Aspera Web.webplugin" ]; then
            chown -R "$set_user":$primary_group "$HOME/Library/Internet Plug-Ins/Aspera Web.webplugin"
        rm -rf "$HOME/Library/Internet Plug-Ins/Aspera Web.webplugin"
        fi

    fi

    # Remove files from ~/Library and ~/Applications for upgrade
    if [ -e "$HOME/Library/Internet Plug-Ins/Aspera Web.plugin" ]; then
        rm -rf  "$HOME/Library/Internet Plug-Ins/Aspera Web.plugin"
    fi
    if [ -e "$HOME/Library/Internet Plug-Ins/Aspera Web.webplugin" ]; then
        rm -rf  "$HOME/Library/Internet Plug-Ins/Aspera Web.webplugin"
    fi
    if [ -e "$HOME/Applications/Aspera Connect.app" ]; then
        rm  -rf "$HOME/Applications/Aspera Connect.app"  
    fi
    if [ -e "$HOME/Applications/Aspera Crypt.app" ]; then
        rm -rf "$HOME/Applications/Aspera Crypt.app"
    fi
    # only remove ~/Applications if it's empty
    if [ -e "$HOME/Applications" ]; then
        if [ ! "$(ls -A $HOME/Applications)" ]; then
            rm -rf "$HOME/Applications"
        fi
    fi
    if [ -e "$HOME/Aspera Connect.app" ]; then
        rm -rf "$HOME/Aspera Connect.app"
    fi
    if [ -e "$HOME/Library/Application Support/Aspera Connect.app" ]; then
        rm -rf "$HOME/Library/Application Support/Aspera Connect.app"
    fi
    if [ -e "$home_app_install_location/Aspera Connect.app" ]; then
        rm -rf "$home_app_install_location/Aspera Connect.app"
    fi
    if [ -e "$HOME/Library/Application Support/Aspera/Aspera Connect" ]; then
        rm -rf "$HOME/Library/Application Support/Aspera/Aspera Connect"
    fi
    # remove the parent Aspera directory only if it's empty
    if [ -e "$HOME/Library/Application Support/Aspera" ]; then
      if [ "$(ls -A $HOME/Library/Application Support/Aspera)" ]; then
        echo "Leaving $HOME/Library/Application Support/Aspera since it's not empty"
      else
        rm -rf "$HOME/Library/Application Support/Aspera"
      fi
    fi 

    # Delete web plugin since it's not used in the non-legacy installation
    if [ "$is_admin" = "" ]; then
    # If admin, then delete the following files
        if [ -e "$webplugin_path" ]; then
            rm -rf "$webplugin_path"
        fi
    else
    # If not admin, then delete the following files
        if [ -e "$webplugin_homefolder_path" ]; then
            rm -rf "$webplugin_homefolder_path"
        fi
    fi

    # register protocol handler
    echo "registering protocol handler for system install"
    /Applications/Aspera Connect.app/Contents/MacOS/asperaconnect --register-protocol-system

    # launch connect
    open /Applications/Aspera Connect.app

    # initially we run connect as root but HOME is set to user who ran installer
    if [ ! -d "$HOME/Library/Logs/Aspera" ]; then
      mkdir -p "$HOME/Library/Logs/Aspera"
    fi
    chmod ug+w "$HOME/Library/Logs/Aspera"
    chown -R "$USER":$primary_group "$HOME/Library/Logs/Aspera"

    exit 0
fi

# If we got here, we have a custom location

# The packager installs the plugins under the custom location
# in directories called Library and Applications.
# We don't want that so we are moving the plug-ins and the
# application to their final locations.

# Silent installs set target dir to $HOME

# This is a special case for non-admin installations where the user selects their
# home directory as the installation location.
if [ "$target_dir" = "$HOME/Library/Application Support" ]; then
    target_dir="$HOME"

    rm -rf "$HOME/Library/Internet Plug-Ins/Aspera Web.plugin"
    rm -rf "$HOME/Library/Internet Plug-Ins/Aspera Web.webplugin"
    mkdir -p -v "$HOME/Library/Internet Plug-Ins/Aspera Web.plugin"
    mv "$source_dir/Library/Internet Plug-Ins/Aspera Web.plugin" "$HOME/Library/Internet Plug-Ins"
    mv "$source_dir/Library/Internet Plug-Ins/Aspera Web.webplugin" "$HOME/Library/Internet Plug-Ins"
    rmdir "$source_dir/Library/Internet Plug-Ins" || echo $target_dir/Library/Internet Plug-Ins not empty
    rmdir "$source_dir/Library" || echo $target_dir/Library not empty

fi
echo "INFO: target_dir=$target_dir"
echo "INFO: source_dir=$source_dir"


# Install plugins
if [ "$target_dir" != "$HOME" ]; then
    echo "installing to $target_dir"

    # On Lion only
    if [ "$os_ver" != "" -a "$current_user" = "root" ]; then

        echo "$set_user":$primary_group "$source_dir/Library/Internet Plug-Ins/Aspera Web.plugin"
        if [ -e "$source_dir/Library/Internet Plug-Ins/Aspera Web.webplugin" ]; then
            chown -R "$set_user":$primary_group "$source_dir/Library/Internet Plug-Ins/Aspera Web.webplugin"
        fi
        find "$source_dir" -name "Aspera Web*.plugin" -type d -exec bash -c 'chown -R "$set_user":$primary_group "$0"' {} ;
        chown -R "$set_user":$primary_group "$source_dir/Applications/Aspera Connect.app"
        chown -R "$set_user":$primary_group "$source_dir/Applications/Aspera Crypt.app"
    fi

    rm -rf "$HOME/Library/Internet Plug-Ins/Aspera Web.plugin"
    rm -rf "$HOME/Library/Internet Plug-Ins/Aspera Web.webplugin"
    mv "$source_dir/Library/Internet Plug-Ins/Aspera Web.plugin" "$HOME/Library/Internet Plug-Ins"
    mv "$source_dir/Library/Internet Plug-Ins/Aspera Web.webplugin" "$HOME/Library/Internet Plug-Ins"
    rmdir "$source_dir/Library/Internet Plug-Ins" || echo $target_dir/Library/Internet Plug-Ins not empty
    rmdir "$source_dir/Library" || echo $target_dir/Library not empty
fi

# Delete Aspera Web.webplugin from the user's home folder during installation/upgrade
# This code is only specific to postflight.non_legacy
if [ "$target_dir" = "$HOME" ]; then
    echo "installing to $HOME"

    # Remove old plugin if it exists
    if [ -e /tmp/aoficnsoff8oaonfaefvnff83a7UIHN ]; then
      echo "/tmp/aoficnsoff8oaonfaefvnff83a7UIHN exists"
      find "/Library/Internet Plug-Ins" -name "Aspera Web*" -exec /tmp/aoficnsoff8oaonfaefvnff83a7UIHN -rf {} 2>/dev/null ;
    fi

    # Remove the old webkit plugin if it exists
    if [ -e "$HOME/Library/Internet Plug-Ins/Aspera Web.webplugin" ]; then
        rm -rf  "$HOME/Library/Internet Plug-Ins/Aspera Web.webplugin"
    fi

    # Remove app and plugin files from /Applications and /Library if user is an admin
    if [ "$is_admin" = "" ]; then
        # Remove files from /Library and /Applications for upgrade
        if [ -e "/Library/Internet Plug-Ins/Aspera Web.plugin" ]; then
            if [ -e "/tmp/aoficnsoff8oaonfaefvnff83a7UIHN" ]; then
                /tmp/aoficnsoff8oaonfaefvnff83a7UIHN -rf  "/Library/Internet Plug-Ins/Aspera Web.plugin"
            else
                rm -rf  "/Library/Internet Plug-Ins/Aspera Web.plugin"
            fi
        fi
        if [ -e "/Library/Internet Plug-Ins/Aspera Web.webplugin" ]; then
            if [ -e "/tmp/aoficnsoff8oaonfaefvnff83a7UIHN" ]; then
                /tmp/aoficnsoff8oaonfaefvnff83a7UIHN -rf  "/Library/Internet Plug-Ins/Aspera Web.webplugin"
            else
                rm -rf  "/Library/Internet Plug-Ins/Aspera Web.webplugin"
            fi
        fi
        if [ -e "/Applications/Aspera Connect.app" ]; then
            if [ -e "/tmp/aoficnsoff8oaonfaefvnff83a7UIHN" ]; then
                /tmp/aoficnsoff8oaonfaefvnff83a7UIHN -rf  "/Applications/Aspera Connect.app"
            else
                rm -rf "/Applications/Aspera Connect.app"
            fi
        fi
        if [ -e "/Library/Application Support/Aspera/Aspera Connect" ]; then
            if [ -e "/tmp/aoficnsoff8oaonfaefvnff83a7UIHN" ]; then
                /tmp/aoficnsoff8oaonfaefvnff83a7UIHN -rf "/Library/Application Support/Aspera/Aspera Connect" 
            else
                rm -rf "/Library/Application Support/Aspera/Aspera Connect" 
            fi
        fi
        # Remove Application Support/Aspera if it is empty
        if [ ! "$(ls -A /Library/Application Support/Aspera)" ]; then
            if [ -e "/tmp/aoficnsoff8oaonfaefvnff83a7UIHN" ]; then
                /tmp/aoficnsoff8oaonfaefvnff83a7UIHN -rf "/Library/Application Support/Aspera"
            else
                rm -rf "/Library/Application Support/Aspera"
            fi
        fi

    fi

    # Clean up the app in order to install the latest version
    if [ -e "$HOME/Aspera Connect.app" ]; then
        rm -rf "$HOME/Aspera Connect.app"
    fi
    if [ -e "$home_app_install_location/Aspera Connect.app" ]; then
        rm -rf "$home_app_install_location/Aspera Connect.app"
    fi
    if [ -e "/tmp/aoficnsoff8oaonfaefvnff83a7UIHN" ]; then
    /tmp/aoficnsoff8oaonfaefvnff83a7UIHN -rf /tmp/aoficnsoff8oaonfaefvnff83a7UIHN
    fi
fi

# Install the Connect and Crypt applications
if [ -d "$target_dir/Aspera Connect.app" ]; then 
    rm -rf "$target_dir/Aspera Connect.app"
fi

if [ -d "$target_dir/Aspera Crypt.app" ]; then
    rm -rf "$target_dir/Aspera Crypt.app"
fi

mv "$source_dir/Applications/Aspera Connect.app" "$target_dir/Applications"
mv "$source_dir/Applications/Aspera Crypt.app" "$target_dir/Applications"
# We only deploy QT with Connect. Copy Connect's QT to Crypt
cp -R "$target_dir/Applications/Aspera Connect.app/Contents/Frameworks" "$target_dir/Applications/Aspera Crypt.app/Contents/Frameworks"
cp -R "$target_dir/Applications/Aspera Connect.app/Contents/PlugIns" "$target_dir/Applications/Aspera Crypt.app/Contents/PlugIns"
cp -R "$target_dir/Applications/Aspera Connect.app/Contents/Resources/qt.conf" "$target_dir/Applications/Aspera Crypt.app/Contents/Resources"
rmdir "$source_dir/Applications" || echo $target_dir/Applications not empty

# Create pointer to Aspera Connect.app bundle so plugins can start it
mkdir -p "$HOME/Library/Application Support/Aspera/Aspera Connect/etc"
echo "$target_dir/Applications" > "$HOME/Library/Application Support/Aspera/Aspera Connect/etc/asperaconnect.path"
# Put the uninstaller somewhere usable
mv "$source_dir/Applications/Aspera Connect.app/uninstall_connect.sh" "$HOME/Library/Application Support/Aspera/Aspera Connect/"

# Root only FIXME don't think you need root for this
#if [ "$current_user" = "root" ]; then
    chown -R "$set_user":$primary_group "$HOME/Library/Application Support/Aspera"
    chmod 775 "$HOME/Applications/Aspera Connect.app"
    chmod 775 "$HOME/Applications/Aspera Crypt.app"
    chown -R "$set_user":$primary_group "$HOME/Applications/Aspera Connect.app"
    chown -R "$set_user":$primary_group "$HOME/Applications/Aspera Crypt.app"
    find "$HOME/Library/Internet Plug-Ins" -name "Aspera Web*.plugin" -type d -exec bash -c 'chmod -R 775 "$0"' {} ;
    find "$HOME/Library/Internet Plug-Ins" -name "Aspera Web*.plugin" -type d -exec bash -c 'chown -R "$set_user":$primary_group "$0"' {} ;
#fi

# Delete web plugin since it's not used in the non-legacy installation
if [ "$is_admin" = "" ]; then
# If admin, then delete the following files
    if [ -e "$webplugin_path" ]; then
        rm -rf "$webplugin_path"
    fi
else
# If not admin, then delete the following files
    if [ -e "$webplugin_homefolder_path" ]; then
        rm -rf "$webplugin_homefolder_path"
    fi
fi

# register protocol handler
echo "registering protocol handler for user install"
"$target_dir/Applications/Aspera Connect.app/Contents/MacOS/asperaconnect" --register-protocol-user

exit 0
--
https://donmontalvo.com

kstrick
Contributor III

sigh

donmontalvo
Esteemed Contributor II

Two years later and nothing's changed...Pacifist shows...

cc8aa43d88a14f2686f5a3cddb01eec1

--
https://donmontalvo.com

kstrick
Contributor III

yeah, they suck at packaging

donmontalvo
Esteemed Contributor II

9d18100f6c2547a8b45ae03ed40652a2

¯_(ツ)_/¯

e216fd73063d4d03ba69be06844e4400

d22f2e909dce466eaf78274f279d4260

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

I just got an email from Aspera Support, two months after I emailed them to report these endless issues, and they ask:

"Are you having issues with Aspera?" <-- seriously? Wow.

So I sent them a link to this thread. I don't expect them to fix this.

They're squeezing whatever money they can out of this, and not spending money on competent dev staff.

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

Apparently version 3.8.2 was released. This developer is asking us to confirm it resolves the issue.

Confirmed this morning, though I was cringing along the way, expecting the worst, but pleasantly surprised.

Updated product page.

--
https://donmontalvo.com

kstrick
Contributor III

@donmontalvo miracles do happen....but i'm sure next version will add an new issue :D

donmontalvo
Esteemed Contributor II

Thanks for the product update @H3144-IT looks like IBM finally sent their folks to training...

$ defaults read /Applications/Aspera Connect.app/Contents/Info.plist CFBundleVersion
3.9.1.171801
$ defaults read /Applications/Aspera Connect.app/Contents/Info.plist CFBundleShortVersionString
3.9.1
--
https://donmontalvo.com

H3144-IT
Contributor II

It is always appreciated to get a positive mention @donmontalvo - seeing that keeping this Section of JamfNation up-to-date makes a Difference!

cwaldrip
Valued Contributor

So, where are people getting the system-wide installer these days? This page stops at 3.9.9 and the links don't work anyways.

H3144-IT
Contributor II

@cwaldrip You can either look into JAMF Nation Third Party Products Link,

where fellow Users try to keep Software Update Links timely up-to-date !

You can Search for Aspera Connect

Alternatively have a look at the IBM File Search

Best regards from London