0

I have postInstall scriptlet in script.

But it is not getting executed

 <preinstallScriptlet>
    <script>echo "Installing now ${project.artifactId}-${project.version}-${timestamp}   /script>
                    </preinstallScriptlet>
                    <postinstallScriptlet>
                        <script>
                            echo "Updating Symlink"
                            ln -s -f
                            /usr/local/lib/myproject/${project.artifactId}-${project.version}-${timestamp}
                            /usr/local/lib/myproject/mycode
                        </script>
                    </postinstallScriptlet>
user2230605
  • 2,390
  • 6
  • 27
  • 45
  • Look at the spec file generated by the build (under the target/rpm/.../SPECS). See if it contains your configuration. Did it work in the past? We use version 2.1-alpha-2 and its fine. – Eldad Assis Apr 29 '14 at 04:54
  • The spec file has the contents.I am using for the first time. I am trying to install the rpm which is produced under path /target/rpm/myproject/noarch/mycode.rpm – user2230605 Apr 29 '14 at 05:11
  • So you have tested to do rpm -i and the postinstall script is not executed? – khmarbaise Apr 29 '14 at 06:23
  • Yes , i did the install and cannot see the symlink being created.However the jar which was part of rpm got deployed. – user2230605 Apr 29 '14 at 21:34
  • Is there any requirement for rpm-build version for this plugin to work – user2230605 May 01 '14 at 01:44

1 Answers1

1

I found that <script /> works well only with short, single commands, as XML formatting adds additional line breaks that don't work well with shell scripts. I suggest that you move your script code to a separate file and use <scriptFile /> instead. When you have the script in a separate file, it is also easier to test this script outside of the package.

Best regards, Alexander.

ahus1
  • 5,782
  • 24
  • 42