1 2 Previous Next 15 Replies Latest reply on Mar 12, 2016 6:27 AM by philcebutv

    Executable Script in AM as a package - OSX

    philcebutv Apprentice

      I used to be able to deploy a package in AM using a bash script - I am not anymore. I was wondering if there was a change - we are on version 6.6.

       

      The script is an executable file and I made sure I ran command chmod +x /path_to_script. Running the bash script manually using terminal installs the software without issues but not in AM when uploading it as a package. The script conatins a one liner perl command that gets the directory where the script is - not sure if this is the cause of it.

       

      When pushing it to a client, AM installation window comes up it downloads completely and tries to extract/verify then suddenly quit,  leaving the software uninstalled.

        • 1. Re: Executable Script in AM as a package - OSX
          johnh@unipresssoftware.com Rookie

          Use Platypus | Sveinbjorn Thordarson to wrap it up as an app then you will be able to deploy it.

          1 of 1 people found this helpful
          • 2. Re: Executable Script in AM as a package - OSX
            philcebutv Apprentice

            Thanks John.

             

            I think platypus is similar to packages. I've used packages to wrap up the script but for some reason my script still does not ran properly. However, if I ran the script manually on the terminal it works.

             

            I am stuck as to what to do now.

            • 3. Re: Executable Script in AM as a package - OSX
              patgmac1 Expert

              Are you sure you included the additional file(s) when adding the payload?

               

              Can you post the contents of the script?

               

              The way I get script location is with:

              scriptDir=$(dirname "$0")

              Then use "$scriptDir\script_name.sh"

               

              P.S. You don't need to make the scripts executable. LANrev runs them with sh.

              • 4. Re: Executable Script in AM as a package - OSX
                robert.morton Apprentice

                I am agreeing with Patrick on this one. I can not replicate a failure, so I think we would need to see more information on this. Can you post the script?

                • 5. Re: Executable Script in AM as a package - OSX
                  philcebutv Apprentice

                  Hi Rob and Pat,

                   

                  I am packaging a scientific app called Matlab ver 2015a. Inside the software installer there is a executable command called install. To make the app automated (no prompts) there is a file called installer_input.txt to edit to save your keys and prompt actions, etc... To install the app I will have to run the command below, assuming that I am on the software installer directory

                   

                  ./install -inputFile path_to_the_installer_input.txt

                   

                  I then created a bash script with the command above pointing the correct path. I tested my script and it install the app no issues.

                   

                  Here is my code..

                   

                  #!/bin/bash

                  path=${dirname "$0"}

                  "$path/install -inputFile $path/installer_input.txt

                  # sleep - to give time to the install command to finish installing the app

                  Sleep 900

                  exit 0

                   

                   

                  I also made sure that my script is an executable using chmod a+x.

                   

                  I also tried wrapping my script as a payload free script using packages and copying the .pkg onto the software installer directory - The package install fine but did not install the matlab app.

                   

                  It works if I ran my script manually on the terminal - meaning it install the matlab app under /Applications no issues

                   

                  I also tried to upload  my script including all the contents on the  software installer to AM as a package and setting my script as the executable one. When pushing this package on a client, it install but does not install Matlab.

                   

                   

                  I am stuck at the moment with this app. Need to mass deploy it.

                   

                  any advice is greatly appreciated.

                   

                  Thank you all for giving your time to look onto my issue.

                   

                  For some reason I think I've replied to my initial post..

                  • 6. Re: Executable Script in AM as a package - OSX
                    baotran Apprentice

                    Looks like this line is missing an end quote after "install"?

                     

                    "$path/install -inputFile $path/installer_input.txt

                     

                    You probably want to put quotes around the path to input.txt also in case there are spaces in there when the path is expanded. So something like

                     

                    "$path/install" -inputFile "$path/installer_input.txt"

                    1 of 1 people found this helpful
                    • 7. Re: Executable Script in AM as a package - OSX
                      philcebutv Apprentice

                      Bao, I've tried your suggestion and it still not successful.

                       

                      Rebooting my machine later to see if it helps as I've not rebooted for a couple of weeks.

                       

                      Its been 3 days now trying to figure out why my script won't install the app either through AM or wrapping it with packages.

                       

                      I may have to repackage it using insallease  does anyone know if installease is still available?

                      • 8. Re: Executable Script in AM as a package - OSX
                        patgmac1 Expert

                        I deploy Matlab as well, in the same manner. However, I have been having the same problem with Matlab 2015b. Matlab 2015a installs just fine, both using the same script (below). I haven't spent much time troubleshooting it yet, but I might as well try today. ;-)

                         

                        #!/bin/sh
                        scriptDir=$(dirname "$0")
                        cp "${scriptDir}/license.dat" /tmp/
                        "${scriptDir}/install" -inputFile "${scriptDir}/installer_input.txt"
                        if [ -e /Applications/MATLAB_R2015a.app ]; then
                          exit 0
                        else
                          echo "Something went wrong"
                          exit 1
                        fi
                        
                        

                         

                        You shouldn't need sleep commands in your script. That's just going to add 900 seconds to the already (normally) long install. The script shouldn't exit until it's finished executing.

                         

                        InstallEase is available. But I would use Packages over it. InstallEase is, IMHO, only good for when you want to place a file(s) in every users home directory, or create an uninstaller from an installer. NEVER use the snapshot feature. It takes forever, and it will catch cruft that shouldn't be in your installer.

                         

                        But packaging might be better in this case IF you are using a license server. If you have to activate each install, I believe that activation is machine specific (look at a sample license.dat file on a successful install).

                         

                        I'll work on this today too. I'll let you know what I find.

                        1 of 1 people found this helpful
                        • 9. Re: Executable Script in AM as a package - OSX
                          patgmac1 Expert

                          Also, check to see if you get a /Library/Logs/mathworks_install.log file. If that file is created, it means your install command at least worked.

                          1 of 1 people found this helpful
                          • 10. Re: Executable Script in AM as a package - OSX
                            philcebutv Apprentice

                            Hi Patrick,

                             

                            It's good that you mention R2015b as I may have copied the installer files of the R2015b instead of the R2015a.

                             

                            I like your code as it checks first before it install the app.

                             

                            Quick question though, on your script, what does the echo "Something went wrong" do? Does that register to AM logs or just on the console? and waht's exit 1?

                             

                            Thank you for your advice to remove the sleep command as I was thinking that it might terminate the install process if I don't add the sleep command specially if the script is wrapped as a package. It however delays the install process.

                             

                            The logs, yes I need to check this as well.

                             

                            I am waiting on how you get on...

                             

                            Again thank you for your time. Hopefully, in the future, this thread can help someone dealing with Matlab..

                            • 11. Re: Executable Script in AM as a package - OSX
                              patgmac1 Expert

                              Phil C wrote:

                               

                              Hi Patrick,

                               

                              It's good that you mention R2015b as I may have copied the installer files of the R2015b instead of the R2015a.

                               

                              I like your code as it checks first before it install the app.

                               

                              Quick question though, on your script, what does the echo "Something went wrong" do? Does that register to AM logs or just on the console? and waht's exit 1?

                               

                              Thank you for your advice to remove the sleep command as I was thinking that it might terminate the install process if I don't add the sleep command specially if the script is wrapped as a package. It however delays the install process.

                               

                              The logs, yes I need to check this as well.

                               

                              I am waiting on how you get on...

                               

                              Again thank you for your time. Hopefully, in the future, this thread can help someone dealing with Matlab..

                              It's actually checking AFTER running the install. When you're doing a scripted install, it's handy to throw in some kind of check in there to confirm the install actually took place. LANrev's install status only reports on the exit code it receives at the end of execution. In the case of Matlab, it's always exiting with an "exit 0" which tells LANrev that everything went well. But having the check in there, if /Applications/{product name}.app is not there, then "exit 1" which will properly tell LANrev that the install failed.

                               

                              I don't thing the "something went wrong" actually makes it into the LANrev install status, so that statement can be removed.

                               

                              I packaged up 2015b and just uploaded it. It's deploying to a test machine now...will report back in a few.

                              1 of 1 people found this helpful
                              • 12. Re: Executable Script in AM as a package - OSX
                                patgmac1 Expert

                                Worked like a champ! So do a local install and make sure your license is included in /Applications/MATLAB 2015a.app/licenses/network.lic if you're using a network license. Then create an installer that places Matlab 2015.app into /Applications.

                                 

                                Only snafu is that if you have the OS X firewall enabled, you'll be prompted to allow the app since it's not signed. I was going to script this, but I don't actually see anything added to the firewall. Weird.

                                • 13. Re: Executable Script in AM as a package - OSX
                                  baotran Apprentice

                                  If you want something to show up in the installation status reports when there's an error you need to redirect to stderr like this.

                                   

                                  echo "Something went wrong" >&2

                                   

                                  I think it shows up in the "Add Status Information" column rather than the "Installation Result Error" column in the installation status reports.

                                  2 of 2 people found this helpful
                                  • 14. Re: Executable Script in AM as a package - OSX
                                    patgmac1 Expert

                                    Bao Tran wrote:

                                     

                                    If you want something to show up in the installation status reports when there's an error you need to redirect to stderr like this.

                                     

                                    echo "Something went wrong" >&2

                                     

                                    I think it shows up in the "Add Status Information" column rather than the "Installation Result Error" column in the installation status reports.

                                    Good to know Bao. Thanks!

                                    1 2 Previous Next