• 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: Mike Pullen <email@hidden>
  • Date: Thu, 30 Mar 2017 15:22:49 -0500

Stephen,

I don't think it's necessary, or even a good idea, to do things in "public" places like /Applications as any given user. As long as the installer requires admin permissions to install, the script should run with admin permissions and should be able to remove those files. So, there shouldn't be any need to masquerade as a console user for this-- if there is a console user at the moment.

I'll harp again: Are you absolutely certain that your app will never be installed when noone is logged in (like, pushed by ARD or a software deployment mechanism when the machine is at the login screen, or shutting down)?

(I don't wanna be a broken record-- I just hate to see anyone invest time on an installer that would break any of the "Commandments of Mac Packaging"! There is no downside to embracing those commandments with every installer... : )


Mike






On Thu, Mar 30, 2017 at 3: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.

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 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.

Thanks,
- Stephen



 _______________________________________________
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


 _______________________________________________
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>
References: 
 >Packages - deleting older files on newer installation (From: Stephen Kay <email@hidden>)

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