• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Packages - deleting older files on newer installation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Packages - deleting older files on newer installation


  • Subject: Re: Packages - deleting older files on newer installation
  • From: Karl Kuehn <email@hidden>
  • Date: Thu, 30 Mar 2017 13:23:31 -0700

Notes in-line:

On Mar 30, 2017, at 1:09 PM, Stephen Kay <email@hidden> wrote:

My installation puts a folder inside /Applications that holds the .app and
some other support files (sorry, it's old). Within that folder, there is
another folder that holds a pdf Help File.

The structure is like this (note spaces in names):

/Applications/My App Folder/My App.app
/Applications/My App Folder/Help Folder/Help File 3.3.pdf

So if you install the new version on top of an older version, all files
having the same names get replaced except for the Help File which has a
version number at the end of it. So the user can end up with several older
help files. 

If the older version was installed using a .pkg, then `installer` (even when called by `Installer.app`) should be cleaning away any files that were explicitly in the older version[1], but not explicitly in the newer version. This does not take any files created in any installer scripts into account, nor anything like data, cache, or preferences files created in the use of an app. But for most cases this should just be taken care of for you.

If you are just switching to a /pkg from something else (e.g. Mindvision Installer) then you are on your own. This also applies if you are changing the package id.

So I wanted to have the post-install script that is attached to my .app
bundle delete any older Help Files.

In testing this, this WORKS to delete an older file (if it exists, and if
not, who cares):

rm -rf "$2/../Help Folder/Help 3.2.pdf"

But I had gotten the impression that you should use sudo and the current
user for everything, as shown in most of the examples I've seen here.

If you are installing into /Applications, then things should already be running as root (well… with root permissions), and that is the appropriate user for anything in /Applications.

If I try this, it doesn't work:

/usr/bin/su $USER -c "/usr/bin/rm -rf \"$2/../Help Folder/Help 3.2.pdf\""

I must have something wrong with the quoting, I tried it without quotes,
numerous variations of quoting and escaping etc., but I can't see it. Or
there's something I'm misunderstanding about the examples I've seen.

You don’t need to do any of this for things in /Applications. All of that advise only applies if you are trying to put things into place for a specific user… which is generally a bad idea anyways.

—
Karl Kuehn
email@hidden

[1] This seems to be done using the package receipts. To see what a system thinks the files are for a given installed package use `pkgutil --pkgs YOUR_PACKAGE_ID_HERE`.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Packages - deleting older files on newer installation
      • From: Stephen Kay <email@hidden>
    • Re: Packages - deleting older files on newer installation
      • From: Conor Schutzman <email@hidden>
References: 
 >Packages - deleting older files on newer installation (From: Stephen Kay <email@hidden>)

  • Prev by Date: Packages - deleting older files on newer installation
  • Next by Date: Re: Packages - deleting older files on newer installation
  • Previous by thread: Packages - deleting older files on newer installation
  • Next by thread: Re: Packages - deleting older files on newer installation
  • Index(es):
    • Date
    • Thread