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

restartService error during yum update of RPM package #1001

Closed
kissit opened this issue Jun 19, 2017 · 1 comment
Closed

restartService error during yum update of RPM package #1001

kissit opened this issue Jun 19, 2017 · 1 comment

Comments

@kissit
Copy link

kissit commented Jun 19, 2017

Expected behaviour

yum install package.rpm (or yum update package.rpm) installs the updated RPM without errors

Actual behaviour

The package is updated, however with this error:

/var/tmp/rpm-tmp.qvjCjS: line 4: restartService: command not found
Failed to try-restart package

Full output:

[root@centos7 ~]# yum update package.1.0.1-1.noarch.rpm
Loaded plugins: fastestmirror
Examining package.1.0.1-1.noarch.rpm
Marking package.1.0.1-1.noarch.rpm as an update to package.1.0.0-1.noarch.rpm
Resolving Dependencies
--> Running transaction check
---> Package package.noarch 0:1.0.0-1 will be updated
---> Package package.noarch 0:1.0.1-1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================================
 Package                                       Arch                              Version                               Repository                                                     Size
===========================================================================================================================================================================================
Updating:
 package                                       noarch                            1.0.1-1                               /package.1.0.1-1.noarch                                      139 M

Transaction Summary
===========================================================================================================================================================================================
Upgrade  1 Package

Total size: 139 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : package.1.0.1-1.noarch                                                                                                                                       1/2
  Cleanup    : package.1.0.0-1.noarch                                                                                                                                       2/2
/var/tmp/rpm-tmp.qvjCjS: line 4: restartService: command not found
Failed to try-restart package
  Verifying  : package.1.0.1-1.noarch                                                                                                                                       1/2
  Verifying  : package.1.0.0-1.noarch                                                                                                                                       2/2

Updated:
  package.noarch 0:1.0.1-1

Complete!

If I list the scripts in the RPM, there is a snippet at the very top of the postuninstall block that is calling restartService() but the function is not defined within.

Here is my applicable build.sbt:

daemonUser in Linux := "package"
daemonUserUid in Linux := Some("1010")
daemonGroup in Linux := "package"
daemonGroupGid in Linux := Some("1010")
packageName in Linux := "package"
packageName in Rpm := "package"
packageSummary in Linux := "Our Application"
packageDescription := "Our Application"
rpmVendor := "xyz"
rpmRelease := "1"
rpmUrl := Some("http://example.com")
rpmLicense := Some("Commercial")
rpmRequirements := Seq("java-1.8.0-openjdk","java-1.8.0-openjdk-devel")
defaultLinuxStartScriptLocation in Rpm := "/etc/systemd/system"
serviceAutostart in Rpm:= false

// Needed to add this to reload systemd after upgrades
import RpmConstants._
maintainerScripts in Rpm := maintainerScriptsAppend((maintainerScripts in Rpm).value)(
   Post -> s"""|if [ $$1 -eq 2 ] ;
               |then
               |systemctl daemon-reload
               |fi
               |""".stripMargin
)

Information

  • What sbt-native-packager are you using: 1.2.0
  • What sbt version: 0.13.15.3-3
  • What is your build system: CentOS 7
  • What package are you building: rpm
  • What version has your build tool: RPM version 4.11.3
  • What is your target system: CentOS 7
@muuki88
Copy link
Contributor

muuki88 commented Jul 9, 2017

This is fixed with #1003

@muuki88 muuki88 closed this as completed Jul 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants