2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2024-11-25 02:50:10 +00:00

Merge pull request #10 from chenglch/ipmi-signal

Handle TERM and HUP signal in ipmitool
This commit is contained in:
Xiaopeng Wang 2016-08-11 11:37:11 +08:00 committed by GitHub
commit 6c97ae24b8
7 changed files with 66 additions and 2 deletions

View File

@ -93,7 +93,7 @@ if (! grep /libcrypto.so/, @output) {
exit 1;
}
my $objrpm = "$blddir/RPMS/$arch/ipmitool-xcat-$version-2.$arch.rpm";
my $objrpm = "$blddir/RPMS/$arch/ipmitool-xcat-$version-3.$arch.rpm";
my $dstdir = "/tmp/build/$os/$arch";
# check the build result

View File

@ -1,3 +1,8 @@
ipmitool-xcat (1.8.15-3) unstable; urgency=low
* Handle HUP and TERM signal
-- chenglch <chenglch@cn.ibm.com> Wed, 10 Aug 2016 11:18:00 +0100
ipmitool-xcat (1.8.15-2) unstable; urgency=low
* To close sol session after no more data get from server side

View File

@ -0,0 +1 @@
../../ipmitool-1.8.15-signal.patch

View File

@ -0,0 +1 @@
../../ipmitool-1.8.15-solactivate.patch

View File

@ -1,3 +1,4 @@
ipmitool-1.8.15-saneretry.patch
ipmitool-1.8.15-rflash.patch
ipmitool-1.8.15-solactivate.patch
ipmitool-1.8.15-signal.patch

View File

@ -0,0 +1,54 @@
diff -uNr ipmitool-1.8.15/include/ipmitool/ipmi_sol.h ipmitool-1.8.15-signal/include/ipmitool/ipmi_sol.h
--- ipmitool-1.8.15/include/ipmitool/ipmi_sol.h 2014-03-28 08:36:21.000000000 -0400
+++ ipmitool-1.8.15-signal/include/ipmitool/ipmi_sol.h 2016-08-09 22:35:14.030029120 -0400
@@ -103,6 +103,6 @@
int ipmi_get_sol_info(struct ipmi_intf * intf,
uint8_t channel,
struct sol_config_parameters * params);
-
+void leave_raw_mode(void);
#endif /* IPMI_SOL_H */
diff -uNr ipmitool-1.8.15/lib/ipmi_main.c ipmitool-1.8.15-signal/lib/ipmi_main.c
--- ipmitool-1.8.15/lib/ipmi_main.c 2014-08-11 13:37:37.000000000 -0400
+++ ipmitool-1.8.15-signal/lib/ipmi_main.c 2016-08-10 01:13:38.350442782 -0400
@@ -258,20 +258,22 @@
if (cmdlist != NULL)
ipmi_cmd_print(cmdlist);
}
-/* ipmi_catch_sigint - Handle the interrupt signal (Ctrl-C), close the
- * interface, and exit ipmitool with error (-1)
+/* ipmi_catch_sig - Handle the interrupt signal (Ctrl-C),TERM signal,
+ * and HUP signal. Close the interface, and exit
+ * ipmitool with error (-1)
*
- * This insures that the IOL session gets freed
- * for other callers.
+ * This insures that the IOL session gets freed
+ * for other callers.
*
* returns -1
*/
-void ipmi_catch_sigint()
+void ipmi_catch_sig(const int sig)
{
if (ipmi_main_intf != NULL) {
- printf("\nSIGN INT: Close Interface %s\n",ipmi_main_intf->desc);
+ printf("\nSIGN %s: Close Interface %s\n",strsignal(sig), ipmi_main_intf->desc);
ipmi_main_intf->close(ipmi_main_intf);
}
+ leave_raw_mode();
exit(-1);
}
@@ -391,7 +393,9 @@
/* save program name */
progname = strrchr(argv[0], '/');
progname = ((progname == NULL) ? argv[0] : progname+1);
- signal(SIGINT, ipmi_catch_sigint);
+ signal(SIGINT, ipmi_catch_sig);
+ signal(SIGTERM, ipmi_catch_sig);
+ signal(SIGHUP, ipmi_catch_sig);
while ((argflag = getopt(argc, (char **)argv, OPTION_STRING)) != -1)
{

View File

@ -1,7 +1,7 @@
Name: ipmitool-xcat
Summary: ipmitool - Utility for IPMI control
Version: 1.8.15
Release: 2
Release: 3
License: BSD
Group: Utilities
Packager: IBM Corp.
@ -9,6 +9,7 @@ Source: ipmitool-%{version}.tar.gz
Patch: ipmitool-%{version}-saneretry.patch
Patch2: ipmitool-%{version}-rflash.patch
Patch3: ipmitool-%{version}-solactivate.patch
Patch4: ipmitool-%{version}-signal.patch
Buildroot: /var/tmp/ipmitool-root
%description
@ -35,6 +36,7 @@ fi
%patch -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
./configure --with-kerneldir \