Need help creating pkg through composer Post Flight script

Not applicable

Hi All,
Need help i have created package. It is specific to package that i have to install it manual so .dmg will not work.Package is been created successful when i am putting script in the package as i want an alias or symbolic link to the desktop of all users or the future users it is giving me error without script it is working fine i mean it is installing the original file on the desired location i wanted
I want the symbolic like of that app to the all user desktop or future users.
here is the script.but it giving me error when i am executing it through .pkg.Please help me with this script.
#!/bin/sh# postflight
# Lock the file at the UNIX level/usr/bin/chflags uchg /Users/Shared/FileMaker_Shortcut/ON-AIR Pro 4.5 Opener.fp7
# Link to User Template/bin/ln /Users/Shared/FileMaker_Shortcut/ON-AIR Pro 4.5 Opener.fp7 /System/Library/User Template/English.lproj/Desktop/
# Link to existing Users' Desktops/bin/ln /Users/Shared/FileMaker_Shortcut/ON-AIR Pro 4.5 Opener.fp7 /Users/*/Desktop/
exit 0
Regards,
Vinay

9 REPLIES 9

tlarkin
Honored Contributor

I see a syntax error

ln -s for symbolic links

Not sure if you want to actually link it to the user template, if anything you may want to have it as a login policy or actually modify the user template

talkingmoose
Moderator
Moderator
On 9/9/10 1:45 PM, "vinay washimkar" <vinaywashimkar at hotmail.com> wrote: I want the symbolic like of that app to the all user desktop or future users.

By default the "ln" command makes hard links, which act as if they were
the actual file. If you want to make a symbolic link, which is similar to
an Apple alias, then you want to add the "-s" switch:

ln -s /path/to/source /path/to/destination/

Also, I see three commands in your script. Have you tried removing two and
seeing if any one of them works? Maybe only one command is causing you
problems.

here is the script. but it giving me error when i am executing it through .pkg. Please help me with this script. #!/bin/sh # postflight # Lock the file at the UNIX level /usr/bin/chflags uchg /Users/Shared/FileMaker_Shortcut/ON-AIR Pro 4.5 Opener.fp7

This looks like you're trying to lock the file to keep it from being
modified. While this should work (I didn't test it) you could also try
using an osascript command to call the AppleScript method of doing the
same thing (this is one line):

osascript -e 'tell application "Finder" to set locked of file "Macintosh
HD:Users:Shared:FileMaker_Shortcut:ON-AIR Pro 4.5 Opener.fp7" to false'

# Link to User Template /bin/ln /Users/Shared/FileMaker_Shortcut/ON-AIR Pro 4.5 Opener.fp7 /System/Library/User Template/English.lproj/Desktop/

Don't forget to use "ln -s" to create a symbolic link.

# Link to existing Users' Desktops /bin/ln /Users/Shared/FileMaker_Shortcut/ON-AIR Pro 4.5 Opener.fp7 /Users/*/Desktop/

Use "ln -s" to create a symbolic link here as well.

--

William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492

Not applicable

Hi William,
Thanks for help!

I did the changes in the script. now it is working, I can see symbolic link to the desktop of Future Users and the other users that are in the computer but I cannot see symbolic link to current User desktop.
her is the script.

# Link to existing Users' Desktops
/bin/ln -s /Users/Shared/FileMaker_Shortcut/ON-AIR Pro 4.5 Opener.fp7 /Users/*/Desktop/

please help if there is some syntax error in script.

As I said package is executing successfully using the below script. symbolic link appearing to the Desktop of all Existing Users and Future Users apart from the Current User.

Regards,

Vinay

talkingmoose
Moderator
Moderator

Hi Vinay!
On 9/10/10 7:14 AM, "vinay washimkar" <vinaywashimkar at hotmail.com> wrote:

Very strange. Would the current user just happen to be your admin account
for Casper on the machine? If so, was this created as a hidden account?

When Casper Imaging creates a hidden account it does two things:

  1. It sets the UID of the account to a number below 500 to prevent it from
    being seen in the login window and the Accounts pane.

  2. It creates the account in /private/var/.

If this is your situation then you you will need to add another line to
create the symbolic link to the admin account. Assuming your account is
called something like "netadmin" you would add this:

ln -s /Users/Shared/FileMaker_Shortcut/ON-AIR Pro 4.5 Opener.fp7
/private/var/netadmin/Desktop

For the exact path you can log in to the account, open the Terminal
application found in /Applications/Utilities and enter:

pwd

This will "print working directory". By default you'll be in the top level
of your home folder wherever it is.

--

William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492

Not applicable

Hi All,
I am still having problem getting symbolic link on the desktop of all users.
by using this below given script

#!/bin/sh# postflight
# Lock the file at the UNIX level/usr/bin/chflags uchg /Users/Shared/FileMaker_Shortcuts/ON-AIR Pro 4.5 Opener.fp7
# Link to User Template/bin/ln -s /Users/Shared/FileMaker_Shortcuts/ON-AIR Pro 4.5 Opener.fp7 /System/Library/User Template/English.lproj/Desktop/
# Link to existing Users' Desktops/bin/ln -s /Users/Shared/FileMaker_Shortcuts/ON-AIR Pro 4.5 Opener.fp7 /Users/*/Desktop/ON-AIR Pro 4.5 Opener.fp7

exit 0
I am able to see the symbolic link to future users.I am able to see symbolic link to the users like Test1 Test2 who are the administrator.
I am not able to see the Symbolic link on the current user desktop on which i am logon after installation of package it is also a admin user.I am not able to see the Symbolic link on the desktop of user link Test3 who is a standard user.
I mean to say.
the script
# Link to existing Users' Desktops/bin/ln -s /Users/Shared/FileMaker_Shortcuts/ON-AIR Pro 4.5 Opener.fp7 /Users/*/Desktop/ON-AIR Pro 4.5 Opener.fp7 is not working for the current user and standard user.
Please guide me resolving this issue.

Not applicable

Sorry There is an error in script.
# Link to existing Users' Desktops/bin/ln -s /Users/Shared/FileMaker_Shortcuts/ON-AIR Pro 4.5 Opener.fp7 /Users//Desktop/ON-AIR Pro 4.5 Opener.fp7 Correct one is this.
# Link to existing Users' Desktops/bin/ln -s /Users/Shared/FileMaker_Shortcuts/ON-AIR Pro 4.5 Opener.fp7 /Users/
/Desktop/
Regards,
Vinay

tlarkin
Honored Contributor

Try a loop

#!/bin/bash

# Lock the file at the UNIX level

/usr/bin/chflags uchg /Users/Shared/FileMaker_Shortcuts/ON-AIR Pro 4.5 Opener.fp7

# Link to User Template

/bin/ln -s /Users/Shared/FileMaker_Shortcuts/ON-AIR Pro 4.5 Opener.fp7 /System/Library/User Template/English.lproj/Desktop/

#now loop through users and add the symbolic link for i in `/bin/ls /Users` do ;

/bin/ln -s /Users/Shared/FileMaker_Shortcuts/ON-AIR Pro 4.5 Opener.fp7 /Users/$i/Desktop/ON-AIR Pro 4.5 Opener.fp7

done

exit 0

talkingmoose
Moderator
Moderator

How are you executing your scripts? If they are part of a .pkg file then
On 9/13/10 10:54 AM, "vinay washimkar" <vinaywashimkar at hotmail.com> wrote:
are you trying to test by double-clicking the .pkg file and running it
manually? Or have you added your .pkg file to Casper Admin and tried to
deploy it using a policy or Casper Remote?

Do your Console, System or JAMF log files show anything unusual?

--

William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492

talkingmoose
Moderator
Moderator

This reads to me like it's trying to install the package directly from the
On 9/14/10 7:14 AM, "vinay washimkar" <vinaywashimkar at hotmail.com> wrote:
network volume rather than copying it to the local machine first. Packages
don't install well from server volumes.

I see you're still at Casper 7.1. You may want to update to the latest
version 7.31 and see if that addresses what's happening here.

--

William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492