Accepting request 1084963 from Base:System
- split package from powerd. powerd patches that were never part of sysvinit but need to be mentioned to pass the bot checks: * powerd-2.0.2-getaddrinfo.patch * powerd-2.0.2.dif OBS-URL: https://build.opensuse.org/request/show/1084963 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/sysvinit?expand=0&rev=180
This commit is contained in:
commit
e7aa947ed6
@ -1,67 +0,0 @@
|
|||||||
--- powerd.c
|
|
||||||
+++ powerd.c 2010-05-12 16:12:45.167591612 +0200
|
|
||||||
@@ -625,7 +625,8 @@ void openconfig(int *delay) {
|
|
||||||
int line=0;
|
|
||||||
char *host, *port;
|
|
||||||
int iport;
|
|
||||||
- struct hostent *hname;
|
|
||||||
+ struct addrinfo *hname;
|
|
||||||
+ struct addrinfo *hiter;
|
|
||||||
struct in_addr addr;
|
|
||||||
|
|
||||||
// printf("Opening config\n");
|
|
||||||
@@ -664,6 +665,8 @@ void openconfig(int *delay) {
|
|
||||||
device = strdup(parameter);
|
|
||||||
// printf("Monitoring %s\n", device);
|
|
||||||
} else if (!strcasecmp(command, "notify")) {
|
|
||||||
+ int ret;
|
|
||||||
+
|
|
||||||
if (strlen(password) < 5) {
|
|
||||||
fprintf(stderr, "Password is too short/invalid. Line %d\n", line);
|
|
||||||
exit(-1);
|
|
||||||
@@ -674,27 +677,32 @@ void openconfig(int *delay) {
|
|
||||||
else
|
|
||||||
iport = PORT;
|
|
||||||
|
|
||||||
- if ((hname = gethostbyname(host))) {
|
|
||||||
- while(*hname->h_addr_list != 0) {
|
|
||||||
+ if (!(ret = getaddrinfo(host, NULL, NULL, &hname))) {
|
|
||||||
+ for(hiter = hname; hiter != NULL; hiter = hiter->ai_next) {
|
|
||||||
memset(&addr.s_addr, 0, sizeof(addr.s_addr));
|
|
||||||
- memcpy(&addr.s_addr, *hname->h_addr_list, hname->h_length);
|
|
||||||
+ memcpy(&addr.s_addr, hiter->ai_addr, hiter->ai_addrlen);
|
|
||||||
addclient(inet_ntoa(addr), password, iport);
|
|
||||||
- hname->h_addr_list++;
|
|
||||||
}
|
|
||||||
+ freeaddrinfo(hname);
|
|
||||||
}
|
|
||||||
- }
|
|
||||||
+ else
|
|
||||||
+ fprintf(stderr, "getaddrinfo : %s\n", gai_strerror(ret));
|
|
||||||
+ }
|
|
||||||
} else if (!strcasecmp(command, "listen")) {
|
|
||||||
+ int ret;
|
|
||||||
if (strlen(password) < 5) {
|
|
||||||
fprintf(stderr, "Password is too short/invalid. Line %d\n", line);
|
|
||||||
exit(-1);
|
|
||||||
- } else if ((hname = gethostbyname(parameter))) {
|
|
||||||
- while(*hname->h_addr_list != 0) {
|
|
||||||
- memset(&addr.s_addr, 0, sizeof(addr.s_addr));
|
|
||||||
- memcpy(&addr.s_addr, *hname->h_addr_list, hname->h_length);
|
|
||||||
- addlisten(inet_ntoa(addr), password);
|
|
||||||
- hname->h_addr_list++;
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
+ } else if (! (ret = getaddrinfo(parameter, NULL, NULL, &hname))) {
|
|
||||||
+ for(hiter = hname; hiter != NULL; hiter = hiter->ai_next) {
|
|
||||||
+ memset(&addr.s_addr, 0, sizeof(addr.s_addr));
|
|
||||||
+ memcpy(&addr.s_addr, hiter->ai_addr, hiter->ai_addrlen);
|
|
||||||
+ addlisten(inet_ntoa(addr), password);
|
|
||||||
+ }
|
|
||||||
+ freeaddrinfo(hname);
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ fprintf(stderr, "getaddrinfo : %s\n", gai_strerror(ret));
|
|
||||||
} else if (!strcasecmp(command, "listenport")) {
|
|
||||||
if ((listenport = atoi(parameter)) < 1) {
|
|
||||||
fprintf(stderr, "Listen port is invalid. Line %d\n", line);
|
|
428
powerd-2.0.2.dif
428
powerd-2.0.2.dif
@ -1,428 +0,0 @@
|
|||||||
--- COPYING
|
|
||||||
+++ COPYING 2014-01-14 10:28:52.282236069 +0000
|
|
||||||
@@ -2,7 +2,7 @@
|
|
||||||
Version 2, June 1991
|
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
|
||||||
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
@@ -305,7 +305,7 @@ the "copyright" line and a pointer to wh
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
--- Makefile.in
|
|
||||||
+++ Makefile.in 2006-02-07 16:29:20.000000000 +0100
|
|
||||||
@@ -28,7 +28,7 @@ distclean: clean
|
|
||||||
|
|
||||||
|
|
||||||
detectups: detectups.c
|
|
||||||
- $(CC) $(LFLAGS) $(LIBS) detectups.c -o detectups
|
|
||||||
+ $(CC) $(LFLAGS) $(CFLAGS) $(LIBS) detectups.c -o detectups
|
|
||||||
|
|
||||||
powerd: powerd.h config.h $(OBJS)
|
|
||||||
$(CC) $(LFLAGS) $(LIBS) $(OBJS) -o $@
|
|
||||||
--- config.h
|
|
||||||
+++ config.h 2006-02-07 16:31:03.000000000 +0100
|
|
||||||
@@ -8,7 +8,12 @@
|
|
||||||
/* You shouldnt (and it wont work unless you have modified init) change
|
|
||||||
* this file - this is what init uses to know the power status.
|
|
||||||
*/
|
|
||||||
-#define PWRSTAT "/etc/powerstatus"
|
|
||||||
+#define PWRSTAT "/var/run/powerstatus"
|
|
||||||
+#if WITH_SYSVINIT
|
|
||||||
+# include <initreq.h>
|
|
||||||
+# define NEWINIT
|
|
||||||
+# define INIT_REQ_SLEEP 5
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Define this if you want to develop on powerd. This will cause powerd to
|
|
||||||
--- powerd.8
|
|
||||||
+++ powerd.8 2014-01-14 10:59:42.198735732 +0000
|
|
||||||
@@ -104,13 +104,10 @@ for more information
|
|
||||||
.br
|
|
||||||
/etc/powerd.conf powerd configuration file
|
|
||||||
.br
|
|
||||||
-/etc/powerstatus indicates line power status
|
|
||||||
-.br
|
|
||||||
-/etc/inittab init is what actually issues the
|
|
||||||
- shutdown
|
|
||||||
+/var/run/powerstatus indicates line power status
|
|
||||||
.br
|
|
||||||
.SH SEE ALSO
|
|
||||||
-powerd(8), shutdown(8), wall(1), init(8), inittab(5).
|
|
||||||
+powerd(8), shutdown(8), wall(1), init(8).
|
|
||||||
.SH AUTHOR
|
|
||||||
James Brents <James@nistix.com>
|
|
||||||
(with parts of this man page borrowed from all over the Linux community)
|
|
||||||
--- powerd.c
|
|
||||||
+++ powerd.c 2008-01-10 10:48:25.967567115 +0100
|
|
||||||
@@ -27,7 +27,6 @@
|
|
||||||
|
|
||||||
#include "powerd.h"
|
|
||||||
|
|
||||||
-
|
|
||||||
static Client *clients;
|
|
||||||
static Listen *listens;
|
|
||||||
|
|
||||||
@@ -73,7 +72,10 @@ int main(int argc, char **argv)
|
|
||||||
int i;
|
|
||||||
#endif
|
|
||||||
char *me=argv[0];
|
|
||||||
+ char *base = basename(me);
|
|
||||||
+ char *pidf = NULL;
|
|
||||||
int delay = 16;
|
|
||||||
+ int n;
|
|
||||||
|
|
||||||
if (argc<1 || (argc >1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")))) {
|
|
||||||
printf("powerd %s by: James Brents <james@nistix.com> (DaSyonic)\n\n", ver);
|
|
||||||
@@ -88,14 +90,42 @@ int main(int argc, char **argv)
|
|
||||||
#ifndef DEBUG
|
|
||||||
switch(i=fork()) {
|
|
||||||
case 0: /* Child */
|
|
||||||
- chdir("/");
|
|
||||||
+ if (chdir("/") < 0)
|
|
||||||
+ fprintf(stderr, "%s: %s\n", me, strerror(errno));
|
|
||||||
setsid();
|
|
||||||
|
|
||||||
if ((root = getuid())) {
|
|
||||||
- fprintf(stderr, "%s: need to have root privlidges.", me);
|
|
||||||
+ fprintf(stderr, "%s: need to have root privileges\n", me);
|
|
||||||
} else if (touser != NULL) {
|
|
||||||
if (seteuid(user = uname2id(touser)) == -1)
|
|
||||||
- fprintf(stderr, "%s is not a valid username.", touser);
|
|
||||||
+ fprintf(stderr, "%s is not a valid username: %s\n", touser, strerror(errno));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if ((pidf = (char*)malloc(strlen(_PATH_VARRUN)+strlen(base)+1+3+1)) == NULL) {
|
|
||||||
+ fprintf(stderr, "%s: can create pid file: %s\n", me, strerror(errno));
|
|
||||||
+ } else {
|
|
||||||
+ pidf = strcpy(pidf, _PATH_VARRUN);
|
|
||||||
+ pidf = strcat(pidf, base);
|
|
||||||
+ pidf = strcat(pidf, ".pid");
|
|
||||||
+
|
|
||||||
+ if ((n = open(pidf, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) == -1) {
|
|
||||||
+ fprintf(stderr, "%s: can create pid file: %s\n", me, strerror(errno));
|
|
||||||
+ } else {
|
|
||||||
+ snprintf(logbuffer, sizeof(logbuffer)-1, "%d", (int)getpid());
|
|
||||||
+ if (write(n, logbuffer, strlen(logbuffer)) < 0)
|
|
||||||
+ fprintf(stderr, "%s: %s\n", me, strerror(errno));
|
|
||||||
+ close(n);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if ((n = open("/dev/null", O_RDWR)) == -1) {
|
|
||||||
+ fprintf(stderr, "%s: can not open /dev/null.", me);
|
|
||||||
+ } else {
|
|
||||||
+ (void)dup2(n, 0);
|
|
||||||
+ (void)dup2(n, 1);
|
|
||||||
+ (void)dup2(n, 2);
|
|
||||||
+ (void)close(n);
|
|
||||||
+ errno=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
@@ -116,6 +146,8 @@ int main(int argc, char **argv)
|
|
||||||
monitorups(delay);
|
|
||||||
else if (mode == 1)
|
|
||||||
bindport();
|
|
||||||
+ if (pidf)
|
|
||||||
+ (void)unlink(pidf);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -194,9 +226,12 @@ void monitorups(int delay) {
|
|
||||||
/* log to the syslog */
|
|
||||||
void log(int type, int facility, const char *entry, ...)
|
|
||||||
{
|
|
||||||
+ va_list ap;
|
|
||||||
+ va_start(ap, entry);
|
|
||||||
openlog("powerd", LOG_CONS | LOG_PID, facility);
|
|
||||||
- syslog(type, entry);
|
|
||||||
+ vsyslog(type, entry, ap);
|
|
||||||
closelog();
|
|
||||||
+ va_end(ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Borrowed from Apache
|
|
||||||
@@ -220,12 +255,39 @@ uid_t uname2id(char *name) {
|
|
||||||
*/
|
|
||||||
void notifyinit(int status) {
|
|
||||||
unsigned int file;
|
|
||||||
+#ifdef NEWINIT
|
|
||||||
+ struct init_request req;
|
|
||||||
+ int success = 0;
|
|
||||||
+ void (*save_sigalrm)();
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
|
|
||||||
if (touser != NULL)
|
|
||||||
seteuid(root);
|
|
||||||
|
|
||||||
+#ifdef NEWINIT
|
|
||||||
+ /* Fill out the request struct. */
|
|
||||||
+ memset(&req, 0, sizeof(req));
|
|
||||||
+ req.magic = INIT_MAGIC;
|
|
||||||
+ req.sleeptime = INIT_REQ_SLEEP;
|
|
||||||
+ req.cmd = (status == FAIL) ? INIT_CMD_POWERFAIL : INIT_CMD_POWEROK;
|
|
||||||
+
|
|
||||||
+ /* Open the fifo (with timeout) */
|
|
||||||
+ save_sigalrm = signal(SIGALRM, alarm_handler);
|
|
||||||
+ alarm(3);
|
|
||||||
+ if ((file = open(INIT_FIFO, O_WRONLY, 0644)) >= 0) {
|
|
||||||
+ if (write(file, &req, sizeof(req)) == sizeof(req))
|
|
||||||
+ success = 1;
|
|
||||||
+ close(file);
|
|
||||||
+ }
|
|
||||||
+ alarm(0);
|
|
||||||
+ (void)signal(SIGALRM, save_sigalrm);
|
|
||||||
+
|
|
||||||
+ if (!success) {
|
|
||||||
+ /* The old method ... */
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
if ((file = open(PWRSTAT, O_CREAT | O_WRONLY, 0644)) == -1) {
|
|
||||||
fprintf(stderr, "Cant open %s: %s\n", PWRSTAT, strerror(errno));
|
|
||||||
exit(-1);
|
|
||||||
@@ -237,6 +299,10 @@ void notifyinit(int status) {
|
|
||||||
#else
|
|
||||||
bsdshutdown(status);
|
|
||||||
#endif
|
|
||||||
+
|
|
||||||
+#ifdef NEWINIT
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
if (touser != NULL)
|
|
||||||
seteuid(user);
|
|
||||||
|
|
||||||
@@ -259,7 +325,8 @@ void notifyinit(int status) {
|
|
||||||
* connections
|
|
||||||
*/
|
|
||||||
int bindport() {
|
|
||||||
- int len, addr_len, newfd, sin_size, numbytes;
|
|
||||||
+ socklen_t len, sin_size;
|
|
||||||
+ int newfd, numbytes;
|
|
||||||
struct sockaddr_in serveraddr, remoteaddr;
|
|
||||||
struct timeval mytv;
|
|
||||||
FileDescriptor *list;
|
|
||||||
@@ -289,7 +356,7 @@ int bindport() {
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
- len = sizeof(serveraddr);
|
|
||||||
+ len = (socklen_t)sizeof(serveraddr);
|
|
||||||
|
|
||||||
if (getsockname(serverfd, (struct sockaddr *)&serveraddr, &len)) {
|
|
||||||
fprintf(stderr, "getsockname()\n");
|
|
||||||
@@ -301,8 +368,6 @@ int bindport() {
|
|
||||||
if ((touser != NULL) && (listenport < 1024))
|
|
||||||
seteuid(user);
|
|
||||||
|
|
||||||
- addr_len = sizeof(struct sockaddr);
|
|
||||||
-
|
|
||||||
// printf("Im here\n");
|
|
||||||
while (1) {
|
|
||||||
errno = 0;
|
|
||||||
@@ -321,7 +386,7 @@ int bindport() {
|
|
||||||
|
|
||||||
if (FD_ISSET(serverfd, &readfds)) {
|
|
||||||
FileDescriptor *tmp;
|
|
||||||
- sin_size = sizeof(struct sockaddr_in);
|
|
||||||
+ sin_size = (socklen_t)sizeof(struct sockaddr_in);
|
|
||||||
if ((newfd=accept(serverfd, (struct sockaddr *)&remoteaddr,
|
|
||||||
&sin_size)) == -1) {
|
|
||||||
perror("accept");
|
|
||||||
@@ -540,6 +605,15 @@ void debughelp(int sig)
|
|
||||||
mypower = (mypower == 1) ? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifdef NEWINIT
|
|
||||||
+/* alarm handler for communication with init */
|
|
||||||
+/* static */ void alarm_handler (int sig)
|
|
||||||
+{
|
|
||||||
+ printf("Writing to init FIFO %s timed out\n", INIT_FIFO);
|
|
||||||
+ sleep(1);
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
/* Open and parse the configuration file
|
|
||||||
*/
|
|
||||||
void openconfig(int *delay) {
|
|
||||||
--- powerd.h.in
|
|
||||||
+++ powerd.h.in 2008-01-10 10:46:28.348626572 +0100
|
|
||||||
@@ -60,6 +60,7 @@
|
|
||||||
/*********** If you do, Please send patches. **********/
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
+#include <stdarg.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
@@ -67,6 +68,7 @@
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
+#include <sys/stat.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <syslog.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
@@ -77,6 +79,11 @@
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
+#include <libgen.h>
|
|
||||||
+#include <paths.h>
|
|
||||||
+#ifndef _PATH_VARRUN
|
|
||||||
+# define _PATH_VARRUN "/var/run/"
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
#define CONNECTED 0x01
|
|
||||||
#define SENTNOTICE 0x02
|
|
||||||
@@ -122,7 +129,8 @@ struct filedescriptor_ {
|
|
||||||
Listen *listen;
|
|
||||||
};
|
|
||||||
|
|
||||||
-void log(int type, int facility, const char *entry, ...);
|
|
||||||
+void mylog(int type, int facility, const char *entry, ...);
|
|
||||||
+#define log(args...) mylog(args)
|
|
||||||
uid_t uname2id(char *name);
|
|
||||||
void notifyinit(int status);
|
|
||||||
void monitorups(int delay);
|
|
||||||
@@ -139,6 +147,7 @@ int vhost(FileDescriptor *fd, char *para
|
|
||||||
void auth(FileDescriptor *fd, char *password);
|
|
||||||
void quit_sig(int sig);
|
|
||||||
void debughelp(int sig);
|
|
||||||
+/* static */ void alarm_handler(int sig);
|
|
||||||
int notifyclients(int status);
|
|
||||||
void getrid(FileDescriptor *fd, int i);
|
|
||||||
void bsdshutdown(int status);
|
|
||||||
--- initreq.h
|
|
||||||
+++ initreq.h 2013-08-13 20:02:46.132705014 +0000
|
|
||||||
@@ -0,0 +1,77 @@
|
|
||||||
+/*
|
|
||||||
+ * initreq.h Interface to talk to init through /dev/initctl.
|
|
||||||
+ *
|
|
||||||
+ * Copyright (C) 1995-2004 Miquel van Smoorenburg
|
|
||||||
+ *
|
|
||||||
+ * This library is free software; you can redistribute it and/or
|
|
||||||
+ * modify it under the terms of the GNU Lesser General Public
|
|
||||||
+ * License as published by the Free Software Foundation; either
|
|
||||||
+ * version 2 of the License, or (at your option) any later version.
|
|
||||||
+ *
|
|
||||||
+ * Version: @(#)initreq.h 1.28 31-Mar-2004 MvS
|
|
||||||
+ *
|
|
||||||
+ */
|
|
||||||
+#ifndef _INITREQ_H
|
|
||||||
+#define _INITREQ_H
|
|
||||||
+
|
|
||||||
+#include <sys/param.h>
|
|
||||||
+
|
|
||||||
+#if defined(__FreeBSD_kernel__)
|
|
||||||
+# define INIT_FIFO "/etc/.initctl"
|
|
||||||
+#else
|
|
||||||
+# define INIT_FIFO "/dev/initctl"
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+#define INIT_MAGIC 0x03091969
|
|
||||||
+#define INIT_CMD_START 0
|
|
||||||
+#define INIT_CMD_RUNLVL 1
|
|
||||||
+#define INIT_CMD_POWERFAIL 2
|
|
||||||
+#define INIT_CMD_POWERFAILNOW 3
|
|
||||||
+#define INIT_CMD_POWEROK 4
|
|
||||||
+#define INIT_CMD_BSD 5
|
|
||||||
+#define INIT_CMD_SETENV 6
|
|
||||||
+#define INIT_CMD_UNSETENV 7
|
|
||||||
+
|
|
||||||
+#define INIT_CMD_CHANGECONS 12345
|
|
||||||
+
|
|
||||||
+#ifdef MAXHOSTNAMELEN
|
|
||||||
+# define INITRQ_HLEN MAXHOSTNAMELEN
|
|
||||||
+#else
|
|
||||||
+# define INITRQ_HLEN 64
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * This is what BSD 4.4 uses when talking to init.
|
|
||||||
+ * Linux doesn't use this right now.
|
|
||||||
+ */
|
|
||||||
+struct init_request_bsd {
|
|
||||||
+ char gen_id[8]; /* Beats me.. telnetd uses "fe" */
|
|
||||||
+ char tty_id[16]; /* Tty name minus /dev/tty */
|
|
||||||
+ char host[INITRQ_HLEN]; /* Hostname */
|
|
||||||
+ char term_type[16]; /* Terminal type */
|
|
||||||
+ int signal; /* Signal to send */
|
|
||||||
+ int pid; /* Process to send to */
|
|
||||||
+ char exec_name[128]; /* Program to execute */
|
|
||||||
+ char reserved[128]; /* For future expansion. */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * Because of legacy interfaces, "runlevel" and "sleeptime"
|
|
||||||
+ * aren't in a separate struct in the union.
|
|
||||||
+ *
|
|
||||||
+ * The weird sizes are because init expects the whole
|
|
||||||
+ * struct to be 384 bytes.
|
|
||||||
+ */
|
|
||||||
+struct init_request {
|
|
||||||
+ int magic; /* Magic number */
|
|
||||||
+ int cmd; /* What kind of request */
|
|
||||||
+ int runlevel; /* Runlevel to change to */
|
|
||||||
+ int sleeptime; /* Time between TERM and KILL */
|
|
||||||
+ union {
|
|
||||||
+ struct init_request_bsd bsd;
|
|
||||||
+ char data[368];
|
|
||||||
+ } i;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+#endif
|
|
||||||
--- config.guess
|
|
||||||
+++ config.guess 2019-01-09 15:01:32.155857875 +0000
|
|
||||||
@@ -818,10 +818,10 @@ EOF
|
|
||||||
|
|
||||||
case "${UNAME_MACHINE}" in
|
|
||||||
i?86)
|
|
||||||
- VENDOR=pc;
|
|
||||||
+ VENDOR=suse;
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
- VENDOR=unknown;
|
|
||||||
+ VENDOR=suse;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
# Determine whether the default compiler is a.out or elf
|
|
||||||
--- config.sub
|
|
||||||
+++ config.sub 2019-01-09 15:01:32.155857875 +0000
|
|
||||||
@@ -204,7 +204,7 @@ case $basic_machine in
|
|
||||||
;;
|
|
||||||
# Recognize the basic CPU types with company name.
|
|
||||||
# FIXME: clean up the formatting here.
|
|
||||||
- vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
|
|
||||||
+ vax-* | tahoe-* | i[34567]86-* | i860-* | x86_64-* | ia64-* | m32r-* | m68k-* | m68000-* \
|
|
||||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
|
|
||||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
|
||||||
| power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
|
|
||||||
@@ -216,12 +216,12 @@ case $basic_machine in
|
|
||||||
| alphaev6[78]-* \
|
|
||||||
| we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
|
|
||||||
| clipper-* | orion-* \
|
|
||||||
- | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
|
||||||
+ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpc64-* | powerpcle-* | powerpc64le-* \
|
|
||||||
| sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
|
|
||||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
|
||||||
| mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
|
|
||||||
| mipstx39-* | mipstx39el-* | mcore-* \
|
|
||||||
- | f301-* | armv*-* | s390-* | sv1-* | t3e-* \
|
|
||||||
+ | f301-* | armv*-* | s390-* | s390x-* | sv1-* | t3e-* \
|
|
||||||
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
|
|
||||||
| thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
|
|
||||||
| bs2000-*)
|
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:af54361f205d922126162c872c9b5fa68090ef3f9b105619a8ebe6df9ccc7afc
|
|
||||||
size 59034
|
|
@ -1,61 +0,0 @@
|
|||||||
-------------------------------------------------------------------
|
|
||||||
Wed Jan 4 11:13:33 UTC 2023 - Ludwig Nussel <lnussel@suse.com>
|
|
||||||
|
|
||||||
- Replace transitional %usrmerged macro with regular version check (boo#1206798)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Thu Oct 21 11:29:51 UTC 2021 - Dr. Werner Fink <werner@suse.de>
|
|
||||||
|
|
||||||
- Automatic systemd hardening effort by the security team. This has
|
|
||||||
not been tested. For details please see
|
|
||||||
https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Wed Nov 25 15:04:45 UTC 2020 - Ludwig Nussel <lnussel@suse.de>
|
|
||||||
|
|
||||||
- prepare usrmerge (boo#1029961)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Tue Jun 18 10:25:28 UTC 2019 - Dr. Werner Fink <werner@suse.de>
|
|
||||||
|
|
||||||
- Find newer architectures even with vendor string
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Mon Jan 14 13:28:31 UTC 2019 - Dr. Werner Fink <werner@suse.de>
|
|
||||||
|
|
||||||
- Modify patch powerd-2.0.2.dif that is add x86_64-* to match e.g.
|
|
||||||
basic mchine type x86_64-suse
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Thu May 24 10:30:13 CEST 2018 - kukuk@suse.de
|
|
||||||
|
|
||||||
- Use %license instead of %doc [bsc#1082318]
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Fri Dec 4 15:24:01 UTC 2015 - sweet_f_a@gmx.de
|
|
||||||
|
|
||||||
- cleanup package
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Thu Aug 21 11:38:06 UTC 2014 - lnussel@suse.de
|
|
||||||
|
|
||||||
- use systemd-rpm-macros instead of systemd-devel to avoid build
|
|
||||||
dependency on systemd and it's deps in turn
|
|
||||||
- install rcpowerd link also when using systemd
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Thu Mar 13 14:10:35 UTC 2014 - werner@suse.de
|
|
||||||
|
|
||||||
- Now work with latest systemd
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Wed Jan 15 09:19:19 UTC 2014 - werner@suse.de
|
|
||||||
|
|
||||||
- Correct version number in configuration file
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Tue Jan 14 12:28:42 UTC 2014 - werner@suse.de
|
|
||||||
|
|
||||||
- Split off powerd from sysvinit
|
|
||||||
- Support systemd unit file
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Power Daemon
|
|
||||||
Documentation=man:powerd(8)
|
|
||||||
ConditionPathExists=/etc/powerd.conf
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
# added automatically, for details please see
|
|
||||||
# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
|
|
||||||
ProtectSystem=full
|
|
||||||
ProtectHome=true
|
|
||||||
ProtectHostname=true
|
|
||||||
ProtectKernelTunables=true
|
|
||||||
ProtectKernelModules=true
|
|
||||||
ProtectKernelLogs=true
|
|
||||||
ProtectControlGroups=true
|
|
||||||
RestrictRealtime=true
|
|
||||||
# end of automatic additions
|
|
||||||
Type=forking
|
|
||||||
PIDFile=/var/run/powerd.pid
|
|
||||||
ExecStart=/sbin/powerd
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
106
powerd.spec
106
powerd.spec
@ -1,106 +0,0 @@
|
|||||||
#
|
|
||||||
# spec file for package powerd
|
|
||||||
#
|
|
||||||
# Copyright (c) 2022 SUSE LLC
|
|
||||||
#
|
|
||||||
# All modifications and additions to the file contributed by third parties
|
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
|
||||||
# upon. The license for this file, and modifications and additions to the
|
|
||||||
# file, is the same license as for the pristine package itself (unless the
|
|
||||||
# license for the pristine package is not an Open Source License, in which
|
|
||||||
# case the license is the MIT License). An "Open Source License" is a
|
|
||||||
# license that conforms to the Open Source Definition (Version 1.9)
|
|
||||||
# published by the Open Source Initiative.
|
|
||||||
|
|
||||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
%if 0%{?suse_version} >= 1550
|
|
||||||
%define sbindir %_sbindir
|
|
||||||
%else
|
|
||||||
%define sbindir /sbin
|
|
||||||
%endif
|
|
||||||
|
|
||||||
Name: powerd
|
|
||||||
Version: 2.0.2
|
|
||||||
Release: 0
|
|
||||||
Summary: UPS monitoring daemon
|
|
||||||
License: GPL-2.0-or-later
|
|
||||||
Group: System/Base
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
||||||
BuildRequires: systemd-rpm-macros
|
|
||||||
URL: https://power.sourceforge.net/
|
|
||||||
Source0: powerd-%{version}.tar.bz2
|
|
||||||
Source2: powerd.service
|
|
||||||
Patch0: powerd-%{version}.dif
|
|
||||||
Patch1: powerd-%{version}-getaddrinfo.patch
|
|
||||||
%if %{undefined _unitdir}
|
|
||||||
%{expand: %%global %_unitdir %(pkg-config systemd --variable=systemdsystemunitdir)}
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%description -n powerd
|
|
||||||
powerd monitors the serial port connected to an UPS device and will perform
|
|
||||||
an unattended shutdown of the system if the UPS is on battery longer
|
|
||||||
than a specified number of minutes.
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -q
|
|
||||||
%patch0
|
|
||||||
%patch1
|
|
||||||
%_fixowner .
|
|
||||||
%_fixgroup .
|
|
||||||
/bin/chmod -Rf a+rX,g-w,o-w .
|
|
||||||
|
|
||||||
%build
|
|
||||||
RPM_OPT_FLAGS="${RPM_OPT_FLAGS} $(getconf LFS_CFLAGS) -pipe"
|
|
||||||
CC=%__cc
|
|
||||||
export RPM_OPT_FLAGS CC
|
|
||||||
%configure --prefix= --bindir='$(DESTDIR)%{sbindir}' \
|
|
||||||
--mandir='$(DESTDIR)%{_mandir}' \
|
|
||||||
--sbindir='$(DESTDIR)%{sbindir}'
|
|
||||||
make %{?_smp_mflags} CFLAGS="-I. $RPM_OPT_FLAGS -DWITH_SYSVINIT"
|
|
||||||
|
|
||||||
%install
|
|
||||||
mkdir -m 755 -p %{buildroot}/etc
|
|
||||||
mkdir -m 755 -p %{buildroot}/sbin
|
|
||||||
mkdir -m 755 -p %{buildroot}%{_sbindir}
|
|
||||||
mkdir -m 755 -p %{buildroot}%{_mandir}/man8
|
|
||||||
make install DESTDIR=%{buildroot}
|
|
||||||
echo '# ' > %{buildroot}/etc/powerd.conf
|
|
||||||
echo '# /etc/powerd.conf for powerd version-%{version}' >> %{buildroot}/etc/powerd.conf
|
|
||||||
echo '# ' >> %{buildroot}/etc/powerd.conf
|
|
||||||
echo '# read manual page of detectups(8) and powerd(8) its self.' >> %{buildroot}/etc/powerd.conf
|
|
||||||
echo '# ' >> %{buildroot}/etc/powerd.conf
|
|
||||||
echo '# to enable powerd service run the command' >> %{buildroot}/etc/powerd.conf
|
|
||||||
echo '# systemctl enable powerd.service' >> %{buildroot}/etc/powerd.conf
|
|
||||||
echo '# systemctl start powerd.service' >> %{buildroot}/etc/powerd.conf
|
|
||||||
mkdir -p %{buildroot}/%{_unitdir}
|
|
||||||
install -m 0644 %{S:2} %{buildroot}/%{_unitdir}/powerd.service
|
|
||||||
ln -sf service %{buildroot}%{_sbindir}/rcpowerd
|
|
||||||
|
|
||||||
%pre
|
|
||||||
%service_add_post powerd.service
|
|
||||||
|
|
||||||
%preun
|
|
||||||
%service_del_preun powerd.service
|
|
||||||
|
|
||||||
%post
|
|
||||||
%service_add_post powerd.service
|
|
||||||
|
|
||||||
%postun
|
|
||||||
%service_del_postun powerd.service
|
|
||||||
|
|
||||||
%files -n powerd
|
|
||||||
%defattr (-,root,root,755)
|
|
||||||
%license COPYING
|
|
||||||
%doc README SUPPORTED FAQ powerd.conf.monitor powerd.conf.peer
|
|
||||||
%{sbindir}/powerd
|
|
||||||
%{sbindir}/detectups
|
|
||||||
%{_sbindir}/rcpowerd
|
|
||||||
%config /etc/powerd.conf
|
|
||||||
%attr(0644,root,root) %{_unitdir}/powerd.service
|
|
||||||
%doc %{_mandir}/man8/powerd.8.gz
|
|
||||||
%doc %{_mandir}/man8/detectups.8.gz
|
|
||||||
|
|
||||||
%changelog
|
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu May 4 16:57:57 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
- split package from powerd. powerd patches that were never
|
||||||
|
part of sysvinit but need to be mentioned to pass the bot checks:
|
||||||
|
* powerd-2.0.2-getaddrinfo.patch
|
||||||
|
* powerd-2.0.2.dif
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jan 4 11:13:37 UTC 2023 - Ludwig Nussel <lnussel@suse.com>
|
Wed Jan 4 11:13:37 UTC 2023 - Ludwig Nussel <lnussel@suse.com>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package sysvinit
|
# spec file for package sysvinit
|
||||||
#
|
#
|
||||||
# Copyright (c) 2022 SUSE LLC
|
# Copyright (c) 2023 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user