-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #449 from robertcboll/master
add support for uid and gid
- Loading branch information
Showing
15 changed files
with
162 additions
and
17 deletions.
There are no files selected for viewing
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
4 changes: 2 additions & 2 deletions
4
src/main/resources/com/typesafe/sbt/packager/debian/postinst-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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
${{header}} | ||
${{control-functions}} | ||
|
||
addGroup ${{daemon_group}} | ||
addUser ${{daemon_user}} ${{daemon_group}} "${{app_name}} daemon-user" ${{daemon_shell}} | ||
addGroup ${{daemon_group}} "${{daemon_group_gid}}" | ||
addUser ${{daemon_user}} "${{debian_user_uid}}" ${{daemon_group}} "${{app_name}} daemon-user" ${{daemon_shell}} | ||
|
||
${{chown-paths}} |
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,44 @@ | ||
import com.typesafe.sbt.packager.archetypes.ServerLoader | ||
|
||
enablePlugins(JavaServerAppPackaging) | ||
|
||
serverLoading in Debian := ServerLoader.Upstart | ||
|
||
daemonUser in Linux := "daemonuser" | ||
|
||
daemonGroup in Linux := "daemongroup" | ||
|
||
daemonGroupGid in Linux := Some("25000") | ||
|
||
mainClass in Compile := Some("empty") | ||
|
||
name := "debian-test" | ||
|
||
version := "0.1.0" | ||
|
||
maintainer := "Josh Suereth <[email protected]>" | ||
|
||
packageSummary := "Test debian package" | ||
|
||
packageDescription := """A fun package description of our software, | ||
with multiple lines.""" | ||
|
||
TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) => | ||
val debian = target / "debian-test-0.1.0" / "DEBIAN" | ||
val postinst = IO.read(debian / "postinst") | ||
val postrm = IO.read(debian / "postrm") | ||
assert(postinst contains """addGroup daemongroup "25000"""", "postinst misses addgroup for daemongroup: " + postinst) | ||
assert(postinst contains """addUser daemonuser "" daemongroup "debian-test user-daemon" "/bin/false"""", "postinst misses useradd for daemonuser: " + postinst) | ||
assert(postinst contains "chown daemonuser:daemongroup /var/log/debian-test", "postinst misses chown daemonuser /var/log/debian-test: " + postinst) | ||
assert(!(postinst contains "addgroup --system daemonuser"), "postinst has addgroup for daemonuser: " + postinst) | ||
assert(!(postinst contains "useradd --system --no-create-home --gid daemonuser --shell /bin/false daemonuser"), "postinst has useradd for daemongroup: " + postinst) | ||
assert(postrm contains "deleteUser daemonuser", "postrm misses purging daemonuser user: " + postrm) | ||
assert(postrm contains "deleteGroup daemongroup", "postrm misses purging daemongroup group: " + postrm) | ||
assert(!(postinst contains "chown debian-test:daemongroup"), "postinst contains wrong user: \n" + postinst) | ||
assert(!(postinst contains "chown daemonuser:debian-test"), "postinst contains wrong group: \n" + postinst) | ||
assert(!(postinst contains "chown debian-test:debian-test"), "postinst contains wrong user and group: \n" + postinst) | ||
assert(!(postinst contains "chown daemonuser:daemongroup /usr/share/debian-test"), "postinst contains chown /usr/share/app_name: \n" + postinst) | ||
out.log.success("Successfully tested upstart control files") | ||
() | ||
} | ||
|
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")) |
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 @@ | ||
# Run the debian packaging. | ||
> debian:package-bin | ||
$ exists target/debian-test_0.1.0_all.deb | ||
|
||
$ exists target/debian-test-0.1.0/etc | ||
$ exists target/debian-test-0.1.0/etc/init/debian-test.conf | ||
# Check defaults | ||
$ exists target/debian-test-0.1.0/DEBIAN/prerm | ||
$ exists target/debian-test-0.1.0/DEBIAN/postinst | ||
|
||
# Check files for defaults | ||
> check-control-files |
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,44 @@ | ||
import com.typesafe.sbt.packager.archetypes.ServerLoader | ||
|
||
enablePlugins(JavaServerAppPackaging) | ||
|
||
serverLoading in Debian := ServerLoader.Upstart | ||
|
||
daemonUser in Linux := "daemonuser" | ||
|
||
daemonUserUid in Linux := Some("20000") | ||
|
||
daemonGroup in Linux := "daemongroup" | ||
|
||
mainClass in Compile := Some("empty") | ||
|
||
name := "debian-test" | ||
|
||
version := "0.1.0" | ||
|
||
maintainer := "Josh Suereth <[email protected]>" | ||
|
||
packageSummary := "Test debian package" | ||
|
||
packageDescription := """A fun package description of our software, | ||
with multiple lines.""" | ||
|
||
TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) => | ||
val debian = target / "debian-test-0.1.0" / "DEBIAN" | ||
val postinst = IO.read(debian / "postinst") | ||
val postrm = IO.read(debian / "postrm") | ||
assert(postinst contains """addGroup daemongroup """"", "postinst misses addgroup for daemongroup: " + postinst) | ||
assert(postinst contains """addUser daemonuser "20000" daemongroup "debian-test user-daemon" "/bin/false"""", "postinst misses useradd for daemonuser: " + postinst) | ||
assert(postinst contains "chown daemonuser:daemongroup /var/log/debian-test", "postinst misses chown daemonuser /var/log/debian-test: " + postinst) | ||
assert(!(postinst contains "addgroup --system daemonuser"), "postinst has addgroup for daemonuser: " + postinst) | ||
assert(!(postinst contains "useradd --system --no-create-home --gid daemonuser --shell /bin/false daemonuser"), "postinst has useradd for daemongroup: " + postinst) | ||
assert(postrm contains "deleteUser daemonuser", "postrm misses purging daemonuser user: " + postrm) | ||
assert(postrm contains "deleteGroup daemongroup", "postrm misses purging daemongroup group: " + postrm) | ||
assert(!(postinst contains "chown debian-test:daemongroup"), "postinst contains wrong user: \n" + postinst) | ||
assert(!(postinst contains "chown daemonuser:debian-test"), "postinst contains wrong group: \n" + postinst) | ||
assert(!(postinst contains "chown debian-test:debian-test"), "postinst contains wrong user and group: \n" + postinst) | ||
assert(!(postinst contains "chown daemonuser:daemongroup /usr/share/debian-test"), "postinst contains chown /usr/share/app_name: \n" + postinst) | ||
out.log.success("Successfully tested upstart control files") | ||
() | ||
} | ||
|
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")) |
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 @@ | ||
# Run the debian packaging. | ||
> debian:package-bin | ||
$ exists target/debian-test_0.1.0_all.deb | ||
|
||
$ exists target/debian-test-0.1.0/etc | ||
$ exists target/debian-test-0.1.0/etc/init/debian-test.conf | ||
# Check defaults | ||
$ exists target/debian-test-0.1.0/DEBIAN/prerm | ||
$ exists target/debian-test-0.1.0/DEBIAN/postinst | ||
|
||
# Check files for defaults | ||
> check-control-files |