Skip to content

Commit

Permalink
Fixing rpm docs
Browse files Browse the repository at this point in the history
  • Loading branch information
muuki88 committed May 16, 2015
1 parent a68fc77 commit 1b3bdec
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala
Expand Up @@ -36,9 +36,13 @@ object RpmPlugin extends AutoPlugin {
val Scriptlets = "scriptlets"

//maintainer script names
/** `postinst` */
val Post = "postinst"
/** `preinst` */
val Pre = "preinst"
/** `postun` */
val Postun = "postun"
/** `preun` */
val Preun = "preun"
}

Expand Down
40 changes: 35 additions & 5 deletions src/sphinx/formats/rpm.rst
Expand Up @@ -256,7 +256,7 @@ Example Settings:
Template Changes
~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~

Apply the following changes to the default init start script. You can find this in the sbt-native-packager source.

Expand All @@ -275,28 +275,57 @@ Apply the following changes to the default init start script. You can find this
Scriptlet Changes
~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~

Changing the scripts can be done in two ways. Override the ``rpmPre``, ``rpmPostun`` etc. scripts.
For example:

.. code-block:: scala
// overriding
rpmPre := Some("""## override all other enhancements
echo "I take care of everything myself"
""")
// appending different stuff depending if previous content is there
rpmPostun := rpmPost.value.map { content =>
s"""|$content
|echo "I append this to the current content
|""".stripMargin
}.orElse {
Option("""echo "There wasn't any previous content"
""".stripMargin)
}
// just appending
rpmPostun := {
val prev = rpmPostun.value.getOrElse("")
Some(s"""|$prev
| echo "Hello you"
|""".stripMargin)
}
Changing the scripts can be done in two ways. Override the ``rpmPre``, etc. scripts
or place your new scripts in the ``src/rpm/scriptlets`` folder. For example:


``src/rpm/scriptlets/post-rpm``
``src/rpm/scriptlets/preinst``

.. code-block:: bash
...
echo "PACKAGE_PREFIX=${RPM_INSTALL_PREFIX}" > /etc/sysconfig/${{app_name}}
...
``src/rpm/scriptlets/preun-rpm``
``src/rpm/scriptlets/preun``

.. code-block:: bash
...
rm /etc/sysconfig/${{app_name}}
...
Using files will override all previous contents. The names used can be found in
the `Scaladocs`_.


Jar Repackaging
Expand All @@ -320,4 +349,5 @@ For more information on this topic follow these links:
.. _issue #195: https://github.com/sbt/sbt-native-packager/issues/195
.. _pullrequest #199: https://github.com/sbt/sbt-native-packager/pull/199
.. _OpenSuse issue: https://github.com/sbt/sbt-native-packager/issues/215
.. _Scaladocs: http://www.scala-sbt.org/sbt-native-packager/latest/api/#com.typesafe.sbt.packager.rpm.RpmPlugin$$Names$

0 comments on commit 1b3bdec

Please sign in to comment.