systemd: solve exist problems for systemd
Update to version 0.2-4 Signed-off-by: Longjun Luo <luolongjuna@gmail.com>
This commit is contained in:
parent
ea3768dd45
commit
87aca38bde
@ -0,0 +1,54 @@
|
||||
From c65a42ea5d2e3626adfd5d09864b2b4bdb0f27d5 Mon Sep 17 00:00:00 2001
|
||||
From: Longjun Luo <luolongjuna@gmail.com>
|
||||
Date: Mon, 26 Dec 2022 23:53:48 +0800
|
||||
Subject: [PATCH] systemd: solve the problem of parsing pid of message
|
||||
|
||||
When restore the service of Notify, need to parse
|
||||
the right pid.
|
||||
|
||||
Signed-off-by: Longjun Luo <luolongjuna@gmail.com>
|
||||
---
|
||||
src/client.go | 2 +-
|
||||
src/systemd.go | 9 ++++++++-
|
||||
2 files changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/client.go b/src/client.go
|
||||
index 2bf6875..70d5832 100644
|
||||
--- a/src/client.go
|
||||
+++ b/src/client.go
|
||||
@@ -79,7 +79,7 @@ func startClient(path string) {
|
||||
if ret != 0 {
|
||||
handleRet("restore", ret)
|
||||
}
|
||||
- RestoreMainPid(c.Args().Get(1))
|
||||
+ RestoreMainPid(c.Args().First())
|
||||
NotifySytemd()
|
||||
SystemdReload()
|
||||
return nil
|
||||
diff --git a/src/systemd.go b/src/systemd.go
|
||||
index 65c53bc..cae7c05 100644
|
||||
--- a/src/systemd.go
|
||||
+++ b/src/systemd.go
|
||||
@@ -1,11 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
+ "strings"
|
||||
"github.com/coreos/go-systemd/daemon"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
-func RestoreMainPid(pid string) {
|
||||
+func RestoreMainPid(command string) {
|
||||
+ commands := strings.Split(command, "@")
|
||||
+ if (len(commands) != 2) {
|
||||
+ log.Errorf("Invalid command format %s \n", command)
|
||||
+ return
|
||||
+ }
|
||||
+ pid := commands[1]
|
||||
ifSupport, err := daemon.SdNotify(false, "READY=1\nMAINPID="+pid)
|
||||
if ifSupport == false || err != nil {
|
||||
log.Errorf("Unable to notify systemd, support %v err %s \n", ifSupport, err)
|
||||
--
|
||||
2.38.1
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
From a6b0c93a80bfdfb51d92d2da0b61c520832add5c Mon Sep 17 00:00:00 2001
|
||||
From: Longjun Luo <luolongjuna@gmail.com>
|
||||
Date: Fri, 6 Jan 2023 11:16:37 +0800
|
||||
Subject: [PATCH] nvwa: let nvwa to parse help/h and remove version print
|
||||
|
||||
Signed-off-by: Longjun Luo <luolongjuna@gmail.com>
|
||||
---
|
||||
src/client.go | 1 -
|
||||
src/main.go | 2 ++
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/client.go b/src/client.go
|
||||
index 70d5832..1f0c485 100644
|
||||
--- a/src/client.go
|
||||
+++ b/src/client.go
|
||||
@@ -43,7 +43,6 @@ func startClient(path string) {
|
||||
app := &cli.App{
|
||||
Name: "nvwa",
|
||||
Usage: "a tool used for openEuler kernel update.",
|
||||
- Version: "0.1",
|
||||
Compiled: time.Now(),
|
||||
Commands: []*cli.Command{
|
||||
{
|
||||
diff --git a/src/main.go b/src/main.go
|
||||
index bcb5bb4..27811ed 100644
|
||||
--- a/src/main.go
|
||||
+++ b/src/main.go
|
||||
@@ -9,6 +9,8 @@ var socketPath = "/run/nvwa/nvwa.socket"
|
||||
func main() {
|
||||
server := flag.Int("server", 0,
|
||||
"set this value to 1 to start a server")
|
||||
+ _ = flag.Bool("h", false, "use nvwa help to see help text")
|
||||
+ _ = flag.Bool("help", false, "use nvwa help to see help text")
|
||||
flag.Parse()
|
||||
if *server != 0 {
|
||||
startServer(socketPath)
|
||||
--
|
||||
2.38.1
|
||||
|
||||
13
nvwa.spec
13
nvwa.spec
@ -1,6 +1,6 @@
|
||||
Name: nvwa
|
||||
Version: 0.2
|
||||
Release: 3
|
||||
Release: 4
|
||||
Summary: a tool used for openEuler kernel update
|
||||
|
||||
License: MulanPSL-2.0 and Apache-2.0 and MIT and MPL-2.0
|
||||
@ -8,8 +8,11 @@ URL: https://gitee.com/openeuler/nvwa
|
||||
Source: %{name}-v%{version}.tar.gz
|
||||
|
||||
Patch1: 0001-ignore-pin-memory-init-in-x86.patch
|
||||
Patch2: 0002-systemd-solve-the-problem-of-parsing-pid-of-message.patch
|
||||
Patch3: 0003-nvwa-let-nvwa-to-parse-help-h-and-remove-version-pri.patch
|
||||
|
||||
BuildRequires: golang >= 1.13
|
||||
BuildRequires: systemd
|
||||
Requires: kexec-tools criu
|
||||
Requires: systemd-units iptables-services iproute
|
||||
Requires: gcc
|
||||
@ -17,10 +20,11 @@ Requires: gcc
|
||||
%description
|
||||
A tool used to automate the process of seamless update of the openEuler.
|
||||
|
||||
%global debug_package %{nil}
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-v%{version} -p1
|
||||
|
||||
|
||||
%build
|
||||
|
||||
cd src
|
||||
@ -79,9 +83,10 @@ source /usr/share/bash-completion/completions/nvwa
|
||||
%{_bindir}/%{name}-pre.sh
|
||||
|
||||
%changelog
|
||||
* Thu Dec 08 2022 fushanqing <fushanqing@kylinos.cn> - 0.2-3
|
||||
* Tue Jan 03 2023 anatasluo <luolongjun@huawei.com> - 0.2-4
|
||||
- Solve the problem of parsing pid of message
|
||||
* Thu Dec 15 2022 fushanqing <fushanqing@kylinos.cn> - 0.2-3
|
||||
- Enable debuginfo for fix strip
|
||||
|
||||
* Wed Dec 14 2022 anatasluo <luolongjun@huawei.com> - 0.2-2
|
||||
- Fix issues caused by ctrl-c and systemd
|
||||
* Fri Jul 30 2021 anatasluo <luolongjun@huawei.com> - 0.2-1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user