-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX #214 Making rpm scriptlets overrideable
- Loading branch information
Showing
18 changed files
with
273 additions
and
40 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
src/main/resources/com/typesafe/sbt/packager/archetypes/systemv/post-rpm-template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
service ${{app_name}} start |
12 changes: 12 additions & 0 deletions
12
src/main/resources/com/typesafe/sbt/packager/archetypes/systemv/postun-rpm-template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Removing system user/group : ${{daemon_user}} and ${{daemon_group}} | ||
echo "Try deleting system user and group [${{daemon_user}}:${{daemon_group}}]" | ||
if getent passwd | grep -q "^${{daemon_user}}:"; | ||
then | ||
echo "Deleting system user: ${{daemon_user}}" | ||
userdel ${{daemon_user}} | ||
fi | ||
if getent group | grep -q "^${{daemon_group}}:" ; | ||
then | ||
echo "Deleting system group: ${{daemon_group}}" | ||
groupdel ${{daemon_group}} | ||
fi |
11 changes: 11 additions & 0 deletions
11
src/main/resources/com/typesafe/sbt/packager/archetypes/systemv/pre-rpm-template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Adding system user/group : ${{daemon_user}} and ${{daemon_group}} | ||
if ! getent group | grep -q "^${{daemon_group}}:" ; | ||
then | ||
echo "Creating system group: ${{daemon_group}}" | ||
groupadd --system ${{daemon_group}} | ||
fi | ||
if ! getent passwd | grep -q "^${{daemon_user}}:"; | ||
then | ||
echo "Creating system user: ${{daemon_user}}" | ||
useradd --gid ${{daemon_group}} --no-create-home --system -c '${{descr}}' ${{daemon_user}} | ||
fi |
3 changes: 3 additions & 0 deletions
3
src/main/resources/com/typesafe/sbt/packager/archetypes/systemv/preun-rpm-template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Halting ${{app_name}} | ||
echo "Shutdown ${{app_name}}" | ||
service ${{app_name}} stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Halting ${{app_name}} | ||
echo "Shutdown ${{app_name}}" | ||
service ${{app_name}} stop | ||
service ${{app_name}} stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import NativePackagerKeys._ | ||
|
||
packageArchetype.java_server | ||
|
||
name := "rpm-test" | ||
|
||
version := "0.1.0" | ||
|
||
maintainer := "Josh Suereth <joshua.suereth@typesafe.com>" | ||
|
||
packageSummary := "Test rpm package" | ||
|
||
packageDescription := "Description" | ||
|
||
rpmRelease := "1" | ||
|
||
rpmVendor := "typesafe" | ||
|
||
rpmUrl := Some("http://github.com/sbt/sbt-native-packager") | ||
|
||
rpmLicense := Some("BSD") | ||
|
||
mainClass in (Compile, run) := Some("com.example.MainApp") | ||
|
||
TaskKey[Unit]("unzipAndCheck") <<= (packageBin in Rpm, streams) map { (rpmFile, streams) => | ||
val rpmPath = Seq(rpmFile.getAbsolutePath) | ||
Process("rpm2cpio" , rpmPath) #| Process("cpio -i --make-directories") ! streams.log | ||
val scriptlets = Process("rpm -qp --scripts " + rpmFile.getAbsolutePath) !! streams.log | ||
assert(scriptlets contains "echo postinst", "'echo 'postinst' not present in \n" + scriptlets) | ||
assert(scriptlets contains "echo preinst", "'echo 'preinst' not present in \n" + scriptlets) | ||
assert(scriptlets contains "echo postun", "'echo 'postun' not present in \n" + scriptlets) | ||
assert(scriptlets contains "echo preun", "'echo 'preun' not present in \n" + scriptlets) | ||
() | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version")) |
3 changes: 3 additions & 0 deletions
3
src/sbt-test/rpm/scriptlets-override-rpm/src/main/scala/com/example/MainApp.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
object MainApp extends App { | ||
println("Hello World") | ||
} |
1 change: 1 addition & 0 deletions
1
src/sbt-test/rpm/scriptlets-override-rpm/src/rpm/scriptlets/post-rpm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo postinst |
1 change: 1 addition & 0 deletions
1
src/sbt-test/rpm/scriptlets-override-rpm/src/rpm/scriptlets/postun-rpm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo postun |
1 change: 1 addition & 0 deletions
1
src/sbt-test/rpm/scriptlets-override-rpm/src/rpm/scriptlets/pre-rpm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo preinst |
1 change: 1 addition & 0 deletions
1
src/sbt-test/rpm/scriptlets-override-rpm/src/rpm/scriptlets/preun-rpm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo preun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Run the debian packaging. | ||
> rpm:package-bin | ||
$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm | ||
|
||
# Check rpm contents | ||
> unzipAndCheck | ||
$ exists etc/default/rpm-test | ||
$ exists etc/init.d/rpm-test | ||
|
||
$ exists usr/share/rpm-test | ||
|
||
$ exists usr/share/rpm-test/bin | ||
$ exists usr/share/rpm-test/bin/rpm-test | ||
|
||
$ exists usr/share/rpm-test/lib | ||
|
||
$ exists var/log/rpm-test | ||
$ exists var/run/rpm-test | ||
|
||
# TODO symlinks aren't checked |
Oops, something went wrong.