Re: icon in Dock
Re: icon in Dock
- Subject: Re: icon in Dock
- From: Per Olofsson <email@hidden>
- Date: Fri, 13 Dec 2013 15:32:34 +0000
- Thread-topic: icon in Dock
13 dec 2013 kl. 03:00 skrev Oakman <email@hidden>:
> We have an application that could be a drag & drop install, but will be installed using Installer.app. Only reason being the manager wants the app's icon in the Dock.
In that case, please use two payloads in your package, one for the application and an optional dummy payload for the postinstall that adds the item to the dock. This gives users the option to not have stuff added to the dock without their consent, and us admins the option to disable it when deploying to remote machines.
> Problem is I am not a programmer and only have some basic knowledge of applescripting and even less of shell scripting.
>
> To create a .mpkg I used Packages and am trying to use emmett to put the icon in the Dock by using a postinsall.sh to do the lifting. Nothing I have tried so far has worked. From Terminal I use
> 'path/to/emmett add /Applications/foo.app'
> which works a treat. If I use the same code in the postinstall.sh it fails.
This is because the postinstall script is running as root, and not as a regular user. emmett most likely added it to root's dock, check out /var/root/Library/Preferences. If you want to add it to the user's dock, first consider the fact that there might not even be a user installing the package - it could be installed while creating an unbooted system volume with System Image Utility, or deployed to a remote machine sitting at the login window. There may also be several users logged in at the same time. Should the icon be added to every logged in user's dock, or just if a user runs the installer interactively? Should it also handle users that log in to a machine where the application is already installed? You can use the following shell variables to build the logic you need:
$3 Current install volume, "/" if it's installing on the current system
$USER Typically (but not always) set when a user double clicks on the installer.
If you want to add the icon to the dock when a user installs the package manually, you can use something like:
if [[ "$3" == "/" ]]; then
if [[ ! -z "$USER" ]]; then
su "$USER" -c "/path/to/emmett add /Applications/foo.app"
fi
fi
--
Per Olofsson, IT-service, University of Gothenburg
_______________________________________________
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