Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debian:package-bin throws a FileNotFoundException for missing postrm #117

Merged
merged 2 commits into from
Jan 2, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ trait DebianPlugin extends Plugin with linux.LinuxPlugin {
}


private[this] def appendAndFixPerms(script: File, lines: Seq[String], perms: LinuxFileMetaData): File = {
IO.writeLines(script, lines)
chmod(script, perms.permissions)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the append flag be true here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that, it should be true

script
}


private[this] def scriptMapping(scriptName: String)(script: Option[File], controlDir: File): Seq[(File, String)] = {
(script, controlDir) match {
// check if user defined script exists
Expand Down Expand Up @@ -186,7 +193,7 @@ trait DebianPlugin extends Plugin with linux.LinuxPlugin {
prependAndFixPerms(postinst, userGroupAdd, LinuxFileMetaData())

val purgeAdd = Seq(TemplateWriter.generateScript(DebianPlugin.postrmPurgeTemplateSource, replacements))
prependAndFixPerms(postrm, purgeAdd, LinuxFileMetaData())
appendAndFixPerms(postrm, purgeAdd, LinuxFileMetaData())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While looking into the issue I noticed the code for removing the user account created during installation was being removed before the developers own postrm script code is executed, the developer could possibly be still using the user account at this point.

By appending the user account removal script to the postrm file, the file would be created if not provided by the user and avoid the exception.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix! Thanks.

}
t
},
Expand Down