commit 6a99f3664bc0759ffd8835ca761b29c5cd0fb512 Author: Marcin Krol <h...@tld-linux.org> Date: Tue May 4 20:40:09 2021 +0200
- updated to 1.15, updated URLs chkconfig-add.patch | 66 ++-- chkconfig-noxinet.patch | 805 ++++++++++++++++++++++++----------------------- chkconfig-optflags.patch | 58 +--- chkconfig-pl.patch | 13 +- chkconfig-rc.d.patch | 7 +- chkconfig.spec | 12 +- 6 files changed, 474 insertions(+), 487 deletions(-) --- diff --git a/chkconfig.spec b/chkconfig.spec index f92f685..c54cc83 100644 --- a/chkconfig.spec +++ b/chkconfig.spec @@ -9,19 +9,19 @@ Summary(ru.UTF-8): Системная утилита для управления Summary(tr.UTF-8): Sistem servis bilgilerini sorgular ve yeniler Summary(uk.UTF-8): Системна утиліта для керування ієрархією /etc/rc.d Name: chkconfig -Version: 1.6 +Version: 1.15 Release: 1 Epoch: 2 License: GPL v2 Group: Applications/System -Source0: https://fedorahosted.org/releases/c/h/chkconfig/%{name}-%{version}.tar.bz2 -# Source0-md5: e5c03e31ddadc3cdcddd8969345b00c0 +Source0: https://github.com/fedora-sysv/chkconfig/archive/refs/tags/%{version}.tar.gz +# Source0-md5: 36c438a0fa5d95125dbe1093aa2b904c Patch0: %{name}-add.patch Patch1: %{name}-noxinet.patch Patch2: %{name}-rc.d.patch Patch3: %{name}-optflags.patch Patch4: %{name}-pl.patch -URL: https://git.fedorahosted.org/git/chkconfig.git +URL: https://github.com/fedora-sysv/chkconfig BuildRequires: gettext-tools BuildRequires: libselinux-devel BuildRequires: newt-devel @@ -166,7 +166,7 @@ Perla; ma być zamiennikiem skryptu update-alternatives z Debiana. CC="%{__cc}" \ OPTFLAGS="%{rpmcppflags} %{rpmcflags}" \ OPTLDFLAGS="%{rpmldflags}" \ - SYSTEMDDIR=/lib/systemd + SYSTEMDUTILDIR=/lib/systemd %install rm -rf $RPM_BUILD_ROOT @@ -174,7 +174,7 @@ install -d $RPM_BUILD_ROOT{/etc/{rc.d/{init,rc{0,1,2,3,4,5,6}}.d,env.d},/sbin} %{__make} install \ MANDIR=%{_mandir} \ - SYSTEMDDIR=/lib/systemd \ + SYSTEMDUTILDIR=/lib/systemd \ DESTDIR=$RPM_BUILD_ROOT %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/bal diff --git a/chkconfig-add.patch b/chkconfig-add.patch index cedbb04..b8249ca 100644 --- a/chkconfig-add.patch +++ b/chkconfig-add.patch @@ -1,45 +1,47 @@ ---- chkconfig-1.3.58/chkconfig.c~ 2012-12-04 15:41:14.000000000 +0200 -+++ chkconfig-1.3.58/chkconfig.c 2012-12-04 15:42:06.080488828 +0200 -@@ -27,6 +27,7 @@ +diff -urNpa chkconfig-1.15.orig/chkconfig.c chkconfig-1.15/chkconfig.c +--- chkconfig-1.15.orig/chkconfig.c 2021-01-21 09:19:06.000000000 +0100 ++++ chkconfig-1.15/chkconfig.c 2021-05-03 16:44:13.175185842 +0200 +@@ -29,6 +29,7 @@ #include <unistd.h> static char *progname; +extern int addItem; - #define _(String) gettext((String)) + #define _(String) gettext((String)) -@@ -243,12 +244,10 @@ - frobDependencies(&s); - else - for (i = 0; i < 7; i++) { -- if (!isConfigured(name, i, NULL, NULL)) { - if ((1 << i) & s.levels) - doSetService(s, i, 1); - else - doSetService(s, i, 0); -- } - } +@@ -347,12 +348,10 @@ static int addService(char *name, int ty + rc = frobDependencies(&s); + } else + for (i = 0; i < 7; i++) { +- if (!isConfigured(name, i, NULL, NULL)) { + if ((1 << i) & s.levels) + doSetService(s, i, 1); + else + doSetService(s, i, 0); +- } + } - return 0; -@@ -626,7 +626,7 @@ + return rc; +@@ -690,7 +689,7 @@ void forwardSystemd(const char *name, in } - int main(int argc, const char ** argv) { -- int listItem = 0, addItem = 0, delItem = 0, overrideItem = 0, noRedirectItem = 0; -+ int listItem = 0, delItem = 0, overrideItem = 0, noRedirectItem = 0; + int main(int argc, const char **argv) { +- int listItem = 0, addItem = 0, delItem = 0, overrideItem = 0, ++ int listItem = 0, delItem = 0, overrideItem = 0, + noRedirectItem = 0; int type = TYPE_ANY; int rc, i, x; - char * levels = NULL; ---- chkconfig-1.4/leveldb.c~ 2015-04-25 12:18:41.000000000 +0300 -+++ chkconfig-1.4/leveldb.c 2015-04-25 12:19:52.959858162 +0300 -@@ -22,6 +22,7 @@ - #include <libintl.h> - #include <locale.h> +diff -urNpa chkconfig-1.15.orig/leveldb.c chkconfig-1.15/leveldb.c +--- chkconfig-1.15.orig/leveldb.c 2021-01-21 09:19:06.000000000 +0100 ++++ chkconfig-1.15/leveldb.c 2021-05-03 16:40:14.588185842 +0200 +@@ -28,6 +28,7 @@ + #include <stdlib.h> + #include <string.h> #include <sys/mman.h> +#include <sys/types.h> #include <sys/stat.h> - #include <stdlib.h> - #include <stdio.h> + #include <unistd.h> + @@ -41,6 +42,8 @@ #include "leveldb.h" @@ -47,10 +49,10 @@ +int addItem = 0; + int selinux_restore(const char *name) { - struct selabel_handle *hnd = NULL; - struct stat buf; -@@ -563,6 +567,25 @@ - serv.provides[1] = NULL; + struct selabel_handle *hnd = NULL; + struct stat buf; +@@ -729,6 +732,25 @@ int parseServiceInfo(int fd, char *name, + serv.provides[1] = NULL; } + if (addItem) { diff --git a/chkconfig-noxinet.patch b/chkconfig-noxinet.patch index b6a4fe0..83d58ed 100644 --- a/chkconfig-noxinet.patch +++ b/chkconfig-noxinet.patch @@ -1,6 +1,7 @@ ---- chkconfig-1.3.63/chkconfig.8 2014-11-05 18:39:09.000000000 +0200 -+++ chkconfig-1.3.63.no-xinetd/chkconfig.8 2014-11-30 14:54:29.771983174 +0200 -@@ -63,16 +63,6 @@ +diff -urNpa chkconfig-1.15.orig/chkconfig.8 chkconfig-1.15/chkconfig.8 +--- chkconfig-1.15.orig/chkconfig.8 2021-01-21 09:19:06.000000000 +0100 ++++ chkconfig-1.15/chkconfig.8 2021-05-03 16:45:40.506185842 +0200 +@@ -63,16 +63,6 @@ or a stop script. When switching runlev an already-started service, and will not re-stop a service that is not running. @@ -17,155 +18,159 @@ .SH OPTIONS .TP \fB-\-level \fIlevels\fR ---- chkconfig-1.4/chkconfig.c~ 2015-04-25 12:27:57.000000000 +0300 -+++ chkconfig-1.4/chkconfig.c 2015-04-25 12:29:08.685346749 +0300 -@@ -102,7 +102,6 @@ - readServiceError(rc, name); - return 1; +diff -urNpa chkconfig-1.15.orig/chkconfig.c chkconfig-1.15/chkconfig.c +--- chkconfig-1.15.orig/chkconfig.c 2021-05-03 16:44:13.175185842 +0200 ++++ chkconfig-1.15/chkconfig.c 2021-05-03 17:27:19.517139905 +0200 +@@ -117,8 +117,6 @@ static int delService(char *name, int ty + readServiceError(rc, name); + return 1; } -- if (s.type == TYPE_XINETD) return 0; +- if (s.type == TYPE_XINETD) +- return 0; checkRoot(); -@@ -298,7 +297,6 @@ - return 1; +@@ -333,8 +331,6 @@ static int addService(char *name, int ty + return 1; } -- if (s.type == TYPE_XINETD) return 0; +- if (s.type == TYPE_XINETD) +- return 0; checkRoot(); if (s.isLSB) { -@@ -337,8 +335,6 @@ - return 0; +@@ -373,9 +369,6 @@ static int overrideService(char *name, i + return 0; } -- if (s.type == TYPE_XINETD) return 0; +- if (s.type == TYPE_XINETD) +- return 0; - checkRoot(); - if ((s.levels == o.levels) && -@@ -416,10 +412,6 @@ + if ((s.levels == o.levels) && (s.kPriority == o.kPriority) && +@@ -452,10 +445,6 @@ static int showServiceInfo(struct servic } printf("%-15s", s.name); - if (s.type == TYPE_XINETD) { -- printf("\t%s\n", s.levels ? _("on") : _("off")); -- return 0; +- printf("\t%s\n", s.levels ? _("on") : _("off")); +- return 0; - } for (i = 0; i < 7; i++) { - printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off")); -@@ -425,7 +425,7 @@ + printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off")); +@@ -469,8 +458,7 @@ static int showServiceInfoByName(char *n int rc; struct service s; -- if (systemdActive() && isOverriddenBySystemd(name) && !(type & TYPE_XINETD)) { +- if (systemdActive() && isOverriddenBySystemd(name) && +- !(type & TYPE_XINETD)) { + if (systemdActive() && isOverriddenBySystemd(name)) { return forgiving ? 0 : 1; } -@@ -448,33 +440,10 @@ +@@ -485,31 +473,10 @@ static int showServiceInfoByName(char *n return showServiceInfo(s, forgiving); } -- -static int isXinetdEnabled() { -- struct service s; +- struct service s; - -- if (isOverriddenBySystemd("xinetd") && isEnabledInSystemd("xinetd")) -- return 1; +- if (isOverriddenBySystemd("xinetd") && isEnabledInSystemd("xinetd")) +- return 1; - -- if (readServiceInfo("xinetd", TYPE_INIT_D, &s, 0)) { -- return 0; -- } -- if (s.currentLevels) -- return 1; -- return 0; +- if (readServiceInfo("xinetd", TYPE_INIT_D, &s, 0)) { +- return 0; +- } +- if (s.currentLevels) +- return 1; +- return 0; -} - - static int serviceNameCmp(const void * a, const void * b) { - return strcmp(* (char **)a, * (char **)b); + static int serviceNameCmp(const void *a, const void *b) { + return strcmp(*(char **)a, *(char **)b); } --static int xinetdNameCmp(const void * a, const void * b) { -- const struct service * first = a; -- const struct service * second = b; +-static int xinetdNameCmp(const void *a, const void *b) { +- const struct service *first = a; +- const struct service *second = b; - - return strcmp(first->name, second->name); -} - -- - static int listService(char * item, int type) { - DIR * dir; - struct dirent * ent; -@@ -502,54 +471,6 @@ - } + static int listService(char *item, int type) { + DIR *dir; + struct dirent *ent; +@@ -539,55 +506,6 @@ static int listService(char *item, int t } } -- + - if (isXinetdEnabled() && type & TYPE_XINETD) { -- struct service *s, *t; -- -- printf("\n"); -- printf(_("xinetd based services:\n")); -- if (!(dir = opendir(XINETDDIR))) { -- fprintf(stderr, _("failed to open directory %s: %s\n"), -- XINETDDIR, strerror(err)); -- return 1; -- } -- numServices = 0; -- numServicesAlloced = 10; -- s = malloc(sizeof (*s) * numServicesAlloced); -- -- while ((ent = readdir(dir))) { -- const char *dn; -- -- /* Skip any file starting with a . */ -- if (ent->d_name[0] == '.') continue; -- -- /* Skip files with known bad extensions */ -- if ((dn = strrchr(ent->d_name, '.')) != NULL && -- (!strcmp(dn, ".rpmsave") || !strcmp(dn, ".rpmnew") || !strcmp(dn, ".rpmorig") || !strcmp(dn, ".swp"))) -- continue; -- -- dn = ent->d_name + strlen(ent->d_name) - 1; -- if (*dn == '~' || *dn == ',') -- continue; -- -- if (numServices == numServicesAlloced) { -- numServicesAlloced += 10; -- s = realloc(s, numServicesAlloced * sizeof (*s)); -- } -- if (readXinetdServiceInfo(ent->d_name, s + numServices) != -1) -- numServices ++; -- } -- -- qsort(s, numServices, sizeof(*s), xinetdNameCmp); -- t = s; -- for (i = 0; i < numServices; i++, s++) { -- char *tmp = malloc(strlen(s->name) + 5); -- sprintf(tmp,"%s:",s->name); -- printf("\t%-15s\t%s\n", tmp, s->levels ? _("on") : _("off")); -- } -- closedir(dir); -- free(t); +- struct service *s, *t; +- +- printf("\n"); +- printf(_("xinetd based services:\n")); +- if (!(dir = opendir(XINETDDIR))) { +- fprintf(stderr, _("failed to open directory %s: %s\n"), XINETDDIR, +- strerror(err)); +- return 1; +- } +- numServices = 0; +- numServicesAlloced = 10; +- s = malloc(sizeof(*s) * numServicesAlloced); +- +- while ((ent = readdir(dir))) { +- const char *dn; +- +- /* Skip any file starting with a . */ +- if (ent->d_name[0] == '.') +- continue; +- +- /* Skip files with known bad extensions */ +- if ((dn = strrchr(ent->d_name, '.')) != NULL && +- (!strcmp(dn, ".rpmsave") || !strcmp(dn, ".rpmnew") || +- !strcmp(dn, ".rpmorig") || !strcmp(dn, ".swp"))) +- continue; +- +- dn = ent->d_name + strlen(ent->d_name) - 1; +- if (*dn == '~' || *dn == ',') +- continue; +- +- if (numServices == numServicesAlloced) { +- numServicesAlloced += 10; +- s = realloc(s, numServicesAlloced * sizeof(*s)); +- } +- if (readXinetdServiceInfo(ent->d_name, s + numServices) != -1) +- numServices++; +- } +- +- qsort(s, numServices, sizeof(*s), xinetdNameCmp); +- t = s; +- for (i = 0; i < numServices; i++, s++) { +- char *tmp = malloc(strlen(s->name) + 5); +- sprintf(tmp, "%s:", s->name); +- printf("\t%-15s\t%s\n", tmp, s->levels ? _("on") : _("off")); +- } +- closedir(dir); +- free(t); - } return 0; } -@@ -610,11 +531,6 @@ - reloadSystemd(); +@@ -650,11 +568,6 @@ int setService(char *name, int type, int + reloadSystemd(); - return rc; + return rc; - } else if (s.type == TYPE_XINETD) { -- if (setXinetdService(s, state)) { -- return 1; -- } -- system("/sbin/service xinetd reload >/dev/null 2>&1"); +- if (setXinetdService(s, state)) { +- return 1; +- } +- system("/sbin/service xinetd reload >/dev/null 2>&1"); } return 0; -@@ -622,8 +538,6 @@ +@@ -662,8 +575,6 @@ int setService(char *name, int type, int void forwardSystemd(const char *name, int type, const char *verb) { int socket = 0; @@ -173,168 +178,173 @@ - return; if (!systemdIsInit()) - return; -@@ -704,12 +618,10 @@ - if (help) usage(progname); + return; +@@ -747,12 +658,10 @@ int main(int argc, const char **argv) { + usage(progname); if (typeString) { -- if (!strcmp(typeString, "xinetd")) -- type = TYPE_XINETD; -- else if (!strcmp(typeString, "sysv")) -+ if (!strcmp(typeString, "sysv")) - type = TYPE_INIT_D; - else { -- fprintf(stderr, _("--type must be 'sysv' or 'xinetd'\n")); -+ fprintf(stderr, _("--type must be 'sysv'\n")); - exit(1); - } +- if (!strcmp(typeString, "xinetd")) +- type = TYPE_XINETD; +- else if (!strcmp(typeString, "sysv")) ++ if (!strcmp(typeString, "sysv")) + type = TYPE_INIT_D; + else { +- fprintf(stderr, _("--type must be 'sysv' or 'xinetd'\n")); ++ fprintf(stderr, _("--type must be 'sysv'\n")); + exit(1); + } } -@@ -809,16 +721,9 @@ - rc = readServiceInfo(name, type, &s, 0); - if (rc) - return 1; -- if (s.type == TYPE_XINETD) { -- if (isOn("xinetd",level)) -- return !s.levels; -- else -- return 1; -- } else { - if (level == -1) - level = currentRunlevel(); - return s.currentLevels & (1 << level) ? 0 : 1; -- } - } else if (!strcmp(state, "on")) { - if (!noRedirectItem) { - forwardSystemd(name, type, "enable"); ---- chkconfig-1.4/leveldb.c~ 2015-04-25 12:20:58.000000000 +0300 -+++ chkconfig-1.4/leveldb.c 2015-04-25 12:21:39.535385553 +0300 -@@ -154,107 +154,6 @@ - return 0; +@@ -877,16 +786,9 @@ int main(int argc, const char **argv) { + rc = readServiceInfo(name, type, &s, 0); + if (rc) + return 1; +- if (s.type == TYPE_XINETD) { +- if (isXinetdEnabled()) +- return !s.levels; +- else +- return 1; +- } else { + if (level == -1) + level = currentRunlevel(); + return s.currentLevels & (1 << level) ? 0 : 1; +- } + } else if (!strcmp(state, "on")) { + if (!noRedirectItem) { + forwardSystemd(name, type, "enable"); +diff -urNpa chkconfig-1.15.orig/leveldb.c chkconfig-1.15/leveldb.c +--- chkconfig-1.15.orig/leveldb.c 2021-05-03 16:40:14.588185842 +0200 ++++ chkconfig-1.15/leveldb.c 2021-05-03 17:50:29.728139905 +0200 +@@ -204,114 +204,6 @@ int readDescription(char *start, char *b + return 0; } --int readXinetdServiceInfo(char *name, struct service * service) { -- char * filename; -- int fd; -- struct service serv = { -- name: NULL, -- levels: -1, -- kPriority: 100, -- sPriority: -1, -- desc: NULL, -- startDeps: NULL, -- stopDeps: NULL, -- softStartDeps: NULL, -- softStopDeps: NULL, -- provides: NULL, -- type: TYPE_XINETD, -- isLSB: 0, -- enabled: -1 -- }; -- struct stat sb; -- char * buf = NULL, *ptr; -- char * eng_desc = NULL, *start; -- -- asprintf(&filename, XINETDDIR "/%s", name); -- -- if ((fd = open(filename, O_RDONLY)) < 0) goto out_err; -- fstat(fd,&sb); -- if (! S_ISREG(sb.st_mode)) goto out_err; -- buf = malloc(sb.st_size+1); -- if (read(fd,buf,sb.st_size)!=sb.st_size) goto out_err; -- close(fd); -- serv.name = strdup(name); -- buf[sb.st_size] = '\0'; -- start = buf; -- while (buf) { -- ptr = strchr(buf,'\n'); -- if (*buf == '#') { -- buf++; -- while (isspace(*buf) && buf < ptr) buf++; -- if (!strncmp(buf,"default:", 9)) { -- buf+=8; -- while(isspace(*buf)) buf++; -- if (!strncmp(buf+9,"on",2)) { -- serv.enabled = 1; -- } else { -- serv.enabled = 0; -- } -- } else if (!strncmp(buf,"description:",12)) { -- buf+=11; -- if (readDescription(buf,start+sb.st_size, -- &serv.desc,&eng_desc)) { -- if (serv.desc) free(serv.desc); -- } -- if (!serv.desc) { -- if (eng_desc) -- serv.desc = eng_desc; -- else -- serv.desc = strdup(name); -- } else if (eng_desc) -- free (eng_desc); -- } -- if (ptr) { -- *ptr = '\0'; -- ptr++; -- } -- buf = ptr; -- continue; -- } -- while (isspace(*buf) && buf < ptr) buf++; -- if (!strncmp(buf,"disable", 7)) { -- buf = strstr(buf,"="); -- if (buf) -- do { -- buf++; -- } while(isspace(*buf)); +-int readXinetdServiceInfo(char *name, struct service *service) { +- char *filename; +- int fd; +- struct service serv = { +- name : NULL, +- levels : -1, +- kPriority : 100, +- sPriority : -1, +- desc : NULL, +- startDeps : NULL, +- stopDeps : NULL, +- softStartDeps : NULL, +- softStopDeps : NULL, +- provides : NULL, +- type : TYPE_XINETD, +- isLSB : 0, +- enabled : -1 +- }; +- struct stat sb; +- char *buf = NULL, *ptr; +- char *eng_desc = NULL, *start; +- +- asprintf(&filename, XINETDDIR "/%s", name); - -- if (buf && strncmp(buf,"yes",3)) { -- serv.levels = parseLevels("0123456",0); -- if (serv.enabled == -1) -- serv.enabled = 1; -- } else { -- serv.levels = 0; -- if (serv.enabled == -1) -- serv.enabled = 0; -- } -- } -- if (ptr) { -- *ptr = '\0'; -- ptr++; -- } -- buf = ptr; -- } -- *service = serv; -- return 0; +- if ((fd = open(filename, O_RDONLY)) < 0) +- goto out_err; +- fstat(fd, &sb); +- if (!S_ISREG(sb.st_mode)) +- goto out_err; +- buf = malloc(sb.st_size + 1); +- if (read(fd, buf, sb.st_size) != sb.st_size) +- goto out_err; +- close(fd); +- serv.name = strdup(name); +- buf[sb.st_size] = '\0'; +- start = buf; +- while (buf) { +- ptr = strchr(buf, '\n'); +- if (*buf == '#') { +- buf++; +- while (isspace(*buf) && buf < ptr) +- buf++; +- if (!strncmp(buf, "default:", 9)) { +- buf += 8; +- while (isspace(*buf)) +- buf++; +- if (!strncmp(buf + 9, "on", 2)) { +- serv.enabled = 1; +- } else { +- serv.enabled = 0; +- } +- } else if (!strncmp(buf, "description:", 12)) { +- buf += 11; +- if (readDescription(buf, start + sb.st_size, &serv.desc, +- &eng_desc)) { +- if (serv.desc) +- free(serv.desc); +- } +- if (!serv.desc) { +- if (eng_desc) +- serv.desc = eng_desc; +- else +- serv.desc = strdup(name); +- } else if (eng_desc) +- free(eng_desc); +- } +- if (ptr) { +- *ptr = '\0'; +- ptr++; +- } +- buf = ptr; +- continue; +- } +- while (isspace(*buf) && buf < ptr) +- buf++; +- if (!strncmp(buf, "disable", 7)) { +- buf = strstr(buf, "="); +- if (buf) +- do { +- buf++; +- } while (isspace(*buf)); +- +- if (buf && strncmp(buf, "yes", 3)) { +- serv.levels = parseLevels("0123456", 0); +- if (serv.enabled == -1) +- serv.enabled = 1; +- } else { +- serv.levels = 0; +- if (serv.enabled == -1) +- serv.enabled = 0; +- } +- } +- if (ptr) { +- *ptr = '\0'; +- ptr++; +- } +- buf = ptr; +- } +- *service = serv; +- return 0; -out_err: -- if (fd >= 0) -- close(fd); -- free(buf); -- free(filename); -- return -1; +- if (fd >= 0) +- close(fd); +- free(buf); +- free(filename); +- return -1; -} - int readServices(struct service **services) { - DIR * dir; - struct dirent * ent; -@@ -304,12 +203,14 @@ + DIR *dir; + struct dirent *ent; +@@ -365,12 +257,12 @@ int readServiceInfo(char *name, int type int parseret; if (!(type & TYPE_INIT_D)) -- goto try_xinetd; -+ return -1; +- goto try_xinetd; ++ return -1; asprintf(&filename, RUNLEVELS "/init.d/%s", name); -- if ((fd = open(filename, O_RDONLY)) < 0) -- goto try_xinetd; -+ if ((fd = open(filename, O_RDONLY)) < 0) { -+ free(filename); -+ return -1; -+ } + if ((fd = open(filename, O_RDONLY)) < 0) +- goto try_xinetd; ++ return -1; free(filename); parseret = parseServiceInfo(fd, name, &serv, honorHide, 0); -@@ -338,12 +239,6 @@ +@@ -410,12 +302,6 @@ int readServiceInfo(char *name, int type free(filename); *service = serv; return 0; @@ -342,28 +352,27 @@ -try_xinetd: - free(filename); - if (!(type & TYPE_XINETD)) -- return -1; -- return readXinetdServiceInfo(name,service); +- return -1; +- return readXinetdServiceInfo(name, service); } - int readServiceDifferences(char * name, int type, struct service * service, struct service * service_overrides, int honorHide) { -@@ -353,12 +248,13 @@ + int readServiceDifferences(char *name, int type, struct service *service, +@@ -426,12 +312,12 @@ int readServiceDifferences(char *name, i int parseret; if (!(type & TYPE_INIT_D)) -- goto try_xinetd; -+ return -1; +- goto try_xinetd; ++ return -1; asprintf(&filename, RUNLEVELS "/init.d/%s", name); if ((fd = open(filename, O_RDONLY)) < 0) { -- goto try_xinetd; -+ free(filename); -+ return -1; +- goto try_xinetd; ++ return -1; } free(filename); -@@ -382,12 +278,6 @@ +@@ -455,12 +341,6 @@ int readServiceDifferences(char *name, i *service = serv; *service_overrides = serv_overrides; return 0; @@ -371,81 +380,83 @@ -try_xinetd: - free(filename); - if (!(type & TYPE_XINETD)) -- return -1; -- return readXinetdServiceInfo(name,service); +- return -1; +- return readXinetdServiceInfo(name, service); } static struct dep *parseDeps(char *pos, char *end) { -@@ -682,67 +682,6 @@ +@@ -863,68 +743,6 @@ int whatLevels(char *name) { return ret; } -int setXinetdService(struct service s, int on) { -- int oldfd, newfd; -- char oldfname[100], newfname[100]; -- char tmpstr[50]; -- char *buf, *ptr, *tmp; -- struct stat sb; -- mode_t mode; -- int r; -- -- if (on == -1) { -- on = s.enabled ? 1 : 0; -- } -- snprintf(oldfname,100,"%s/%s",XINETDDIR,s.name); -- if ( (oldfd = open(oldfname,O_RDONLY)) == -1 ) { -- return -1; -- } -- fstat(oldfd,&sb); -- buf = malloc(sb.st_size+1); -- if (read(oldfd,buf,sb.st_size)!=sb.st_size) { -- close(oldfd); -- free(buf); -- return -1; -- } -- close(oldfd); -- buf[sb.st_size] = '\0'; -- snprintf(newfname,100,"%s/%s.XXXXXX",XINETDDIR,s.name); -- mode = umask(S_IRWXG | S_IRWXO); -- newfd = mkstemp(newfname); -- umask(mode); -- if (newfd == -1) { -- free(buf); -- return -1; -- } -- while (buf) { -- tmp = buf; -- ptr = strchr(buf,'\n'); -- if (ptr) { -- *ptr = '\0'; -- ptr++; -- } -- while (isspace(*buf)) buf++; -- if (strncmp(buf,"disable", 7) && strlen(buf)) { -- write(newfd,tmp,strlen(tmp)); -- write(newfd,"\n",1); -- if (buf[0] == '{') { -- snprintf(tmpstr,50,"\tdisable\t= %s", on ? "no" : "yes"); -- write(newfd,tmpstr,strlen(tmpstr)); -- write(newfd,"\n",1); -- } -- } -- buf = ptr; -- } -- close(newfd); -- unlink(oldfname); -- r = rename(newfname,oldfname); -- if (selinux_restore(oldfname) != 0) -- fprintf(stderr, _("Unable to set selinux context for %s: %s\n"), oldfname, -- strerror(errno)); -- return(r); +- int oldfd, newfd; +- char oldfname[100], newfname[100]; +- char tmpstr[50]; +- char *buf, *ptr, *tmp; +- struct stat sb; +- mode_t mode; +- int r; +- +- if (on == -1) { +- on = s.enabled ? 1 : 0; +- } +- snprintf(oldfname, 100, "%s/%s", XINETDDIR, s.name); +- if ((oldfd = open(oldfname, O_RDONLY)) == -1) { +- return -1; +- } +- fstat(oldfd, &sb); +- buf = malloc(sb.st_size + 1); +- if (read(oldfd, buf, sb.st_size) != sb.st_size) { +- close(oldfd); +- free(buf); +- return -1; +- } +- close(oldfd); +- buf[sb.st_size] = '\0'; +- snprintf(newfname, 100, "%s/%s.XXXXXX", XINETDDIR, s.name); +- mode = umask(S_IRWXG | S_IRWXO); +- newfd = mkstemp(newfname); +- umask(mode); +- if (newfd == -1) { +- free(buf); +- return -1; +- } +- while (buf) { +- tmp = buf; +- ptr = strchr(buf, '\n'); +- if (ptr) { +- *ptr = '\0'; +- ptr++; +- } +- while (isspace(*buf)) +- buf++; +- if (strncmp(buf, "disable", 7) && strlen(buf)) { +- write(newfd, tmp, strlen(tmp)); +- write(newfd, "\n", 1); +- if (buf[0] == '{') { +- snprintf(tmpstr, 50, "\tdisable\t= %s", on ? "no" : "yes"); +- write(newfd, tmpstr, strlen(tmpstr)); +- write(newfd, "\n", 1); +- } +- } +- buf = ptr; +- } +- close(newfd); +- unlink(oldfname); +- r = rename(newfname, oldfname); +- if (selinux_restore(oldfname) != 0) +- fprintf(stderr, _("Unable to set SELinux context for %s: %s\n"), +- oldfname, strerror(errno)); +- return (r); -} - int doSetService(struct service s, int level, int on) { int priority = on ? s.sPriority : s.kPriority; char linkname[200]; ---- chkconfig-1.4/leveldb.h~ 2015-04-25 12:20:58.000000000 +0300 -+++ chkconfig-1.4/leveldb.h 2015-04-25 12:22:49.345672830 +0300 +diff -urNpa chkconfig-1.15.orig/leveldb.h chkconfig-1.15/leveldb.h +--- chkconfig-1.15.orig/leveldb.h 2021-01-21 09:19:06.000000000 +0100 ++++ chkconfig-1.15/leveldb.h 2021-05-03 17:47:25.388139905 +0200 @@ -17,14 +17,12 @@ #define H_LEVELDB @@ -454,102 +465,106 @@ #include <glob.h> - #define TYPE_INIT_D 0x1 --#define TYPE_XINETD 0x2 - #define TYPE_SYSTEMD 0x4 --#define TYPE_ANY (TYPE_INIT_D | TYPE_XINETD | TYPE_SYSTEMD) -+#define TYPE_ANY (TYPE_INIT_D | TYPE_SYSTEMD) + #define TYPE_INIT_D 0x1 +-#define TYPE_XINETD 0x2 + #define TYPE_SYSTEMD 0x4 +-#define TYPE_ANY (TYPE_INIT_D | TYPE_XINETD | TYPE_SYSTEMD) ++#define TYPE_ANY (TYPE_INIT_D | TYPE_SYSTEMD) #ifndef SYSTEMD_SERVICE_PATH #define SYSTEMD_SERVICE_PATH "/lib/systemd/system" -@@ -67,8 +65,6 @@ - int whatLevels(char * name); +@@ -71,8 +69,6 @@ int isConfigured(char *name, int level, + int whatLevels(char *name); int doSetService(struct service s, int level, int on); - int findServiceEntries(char * name, int level, glob_t * globresptr); + int findServiceEntries(char *name, int level, glob_t *globresptr); -int readXinetdServiceInfo(char *name, struct service *service); -int setXinetdService(struct service s, int on); int systemdIsInit(); int systemdActive(); int isOverriddenBySystemd(const char *service); ---- chkconfig-1.4/ntsysv.c~ 2015-03-26 15:14:53.000000000 +0200 -+++ chkconfig-1.4/ntsysv.c 2015-04-25 12:25:27.840559610 +0300 -@@ -67,17 +67,12 @@ - if (last != services[i].type) { - newtFormAddComponent(subform, newtCompactButton(-1, count, - services[i].type == TYPE_INIT_D ? "SysV initscripts": -- services[i].type == TYPE_XINETD ? "xinetd services": - services[i].type == TYPE_SYSTEMD ? "systemd services": - "Unknown")); - count++; - last = services[i].type; +diff -urNpa chkconfig-1.15.orig/ntsysv.c chkconfig-1.15/ntsysv.c +--- chkconfig-1.15.orig/ntsysv.c 2021-01-21 09:19:06.000000000 +0100 ++++ chkconfig-1.15/ntsysv.c 2021-05-03 17:45:56.483139905 +0200 +@@ -69,19 +69,13 @@ static int servicesWindow(struct service + newtCompactButton(-1, count, + services[i].type == TYPE_INIT_D + ? "SysV initscripts" +- : services[i].type == TYPE_XINETD +- ? "xinetd services" + : services[i].type == TYPE_SYSTEMD + ? "systemd services" + : "Unknown")); + count++; + last = services[i].type; } -- if (services[i].type == TYPE_XINETD) { -- checkboxes[i] = newtCheckbox(-1, count, services[i].name, -- services[i].levels ? '*' : ' ', NULL, -- states + i); -- } else if (services[i].type == TYPE_SYSTEMD) { -+ if (services[i].type == TYPE_SYSTEMD) { - checkboxes[i] = newtCheckbox(-1, count, services[i].name, - services[i].enabled ? '*' : ' ', NULL, - states + i); -@@ -142,11 +137,7 @@ - if (!update) return 1; +- if (services[i].type == TYPE_XINETD) { +- checkboxes[i] = +- newtCheckbox(-1, count, services[i].name, +- services[i].levels ? '*' : ' ', NULL, states + i); +- } else if (services[i].type == TYPE_SYSTEMD) { ++ if (services[i].type == TYPE_SYSTEMD) { + checkboxes[i] = + newtCheckbox(-1, count, services[i].name, + services[i].enabled ? '*' : ' ', NULL, states + i); +@@ -150,11 +144,7 @@ static int servicesWindow(struct service + return 1; for (i = 0; i < numServices; i++) { -- if (services[i].type == TYPE_XINETD) { -- if ((services[i].enabled && states[i] != '*') || -- (!services[i].enabled && states[i] == '*')) -- setXinetdService(services[i], states[i] == '*'); -- } else if (services[i].type == TYPE_SYSTEMD) { -+ if (services[i].type == TYPE_SYSTEMD) { - char *cmd = NULL; - int en = 0; - if (services[i].enabled && states[i] != '*') -@@ -347,49 +338,6 @@ +- if (services[i].type == TYPE_XINETD) { +- if ((services[i].enabled && states[i] != '*') || +- (!services[i].enabled && states[i] == '*')) +- setXinetdService(services[i], states[i] == '*'); +- } else if (services[i].type == TYPE_SYSTEMD) { ++ if (services[i].type == TYPE_SYSTEMD) { + char *cmd = NULL; + int en = 0; + if (services[i].enabled && states[i] != '*') +@@ -368,50 +358,6 @@ static int getServices(struct service ** closedir(dir); -- if (!stat("/usr/sbin/xinetd",&sb)) { -- if (!(dir = opendir(XINETDDIR))) { -- fprintf(stderr, "failed to open " XINETDDIR ": %s\n", -- strerror(errno)); -- return 2; -- } -- -- while ((ent = readdir(dir))) { -- if (strchr(ent->d_name, '~') || strchr(ent->d_name, ',') || -- strchr(ent->d_name, '.')) continue; -- -- sprintf(fn, "%s/%s", XINETDDIR, ent->d_name); -- if (stat(fn, &sb)) -- { -- err = errno; -- continue; -- } -- if (!S_ISREG(sb.st_mode)) continue; -- -- if (numServices == numServicesAlloced) { -- numServicesAlloced += 10; -- services = realloc(services, -- numServicesAlloced * sizeof(*services)); -- } -- -- rc = readXinetdServiceInfo(ent->d_name, services + numServices); -- -- if (rc == -1) { -- fprintf(stderr, _("error reading info for service %s: %s\n"), -- ent->d_name, strerror(errno)); -- closedir(dir); -- return 2; -- } else if (!rc) -- numServices++; -- } -- -- if (err) { -- fprintf(stderr, _("error reading from directory %s: %s\n"), -- XINETDDIR, strerror(err)); -- return 1; -- } +- if (!stat("/usr/sbin/xinetd", &sb)) { +- if (!(dir = opendir(XINETDDIR))) { +- fprintf(stderr, "failed to open " XINETDDIR ": %s\n", +- strerror(errno)); +- return 2; +- } +- +- while ((ent = readdir(dir))) { +- if (strchr(ent->d_name, '~') || strchr(ent->d_name, ',') || +- strchr(ent->d_name, '.')) +- continue; +- +- sprintf(fn, "%s/%s", XINETDDIR, ent->d_name); +- if (stat(fn, &sb)) { +- err = errno; +- continue; +- } +- if (!S_ISREG(sb.st_mode)) +- continue; +- +- if (numServices == numServicesAlloced) { +- numServicesAlloced += 10; +- services = +- realloc(services, numServicesAlloced * sizeof(*services)); +- } +- +- rc = readXinetdServiceInfo(ent->d_name, services + numServices); +- +- if (rc == -1) { +- fprintf(stderr, _("error reading info for service %s: %s\n"), +- ent->d_name, strerror(errno)); +- closedir(dir); +- return 2; +- } else if (!rc) +- numServices++; +- } +- +- if (err) { +- fprintf(stderr, _("error reading from directory %s: %s\n"), +- XINETDDIR, strerror(err)); +- return 1; +- } - } - getSystemdServices(&services, &numServices); diff --git a/chkconfig-optflags.patch b/chkconfig-optflags.patch index b7554ae..57511df 100644 --- a/chkconfig-optflags.patch +++ b/chkconfig-optflags.patch @@ -1,46 +1,14 @@ ---- chkconfig-1.4/Makefile~ 2015-03-26 15:14:53.000000000 +0200 -+++ chkconfig-1.4/Makefile 2015-04-25 12:27:11.812618643 +0300 -@@ -1,8 +1,8 @@ - VERSION=$(shell awk '/Version:/ { print $$2 }' chkconfig.spec) - TAG = chkconfig-$(VERSION) - --CFLAGS=-g -Wall $(RPM_OPT_FLAGS) -D_GNU_SOURCE --LDFLAGS+=-g -+CFLAGS=$(OPTFLAGS) -Wall -D_GNU_SOURCE -+LDFLAGS+=$(OPTLDFLAGS) - MAN=chkconfig.8 ntsysv.8 alternatives.8 - PROG=chkconfig +diff -urNpa chkconfig-1.15.orig/Makefile chkconfig-1.15/Makefile +--- chkconfig-1.15.orig/Makefile 2021-01-21 09:19:06.000000000 +0100 ++++ chkconfig-1.15/Makefile 2021-05-04 10:44:37.807341418 +0200 +@@ -2,8 +2,8 @@ VERSION := $(shell awk '/Version:/ { pri + NEXT_VERSION := $(shell awk '/Version:/ { print $$2 + 0.01 }' chkconfig.spec) + TAG = $(VERSION) + +-CFLAGS = -g -Wall $(RPM_OPT_FLAGS) -D_GNU_SOURCE +-LDFLAGS += -g ++CFLAGS = $(OPTFLAGS) -Wall -D_GNU_SOURCE ++LDFLAGS += $(OPTLDFLAGS) + MAN = chkconfig.8 ntsysv.8 alternatives.8 + PROG = chkconfig BINDIR = /sbin -@@ -24,12 +24,12 @@ subdirs: - done && test -z "$$fail" - - chkconfig: $(OBJS) -- $(CC) $(LDFLAGS) -lselinux -lsepol -o chkconfig $(OBJS) -lpopt -+ $(CC) $(LDFLAGS) -o chkconfig $(OBJS) -lpopt -lselinux -lsepol - - alternatives: alternatives.o - - ntsysv: $(NTOBJS) -- $(CC) $(LDFLAGS) -lselinux -lsepol -o ntsysv $(NTOBJS) -lnewt -lpopt $(LIBMHACK) -+ $(CC) $(LDFLAGS) -o ntsysv $(NTOBJS) -lnewt -lpopt -lselinux -lsepol $(LIBMHACK) - - chkconfig.o: chkconfig.c leveldb.h - $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c chkconfig.c -@@ -56,7 +56,7 @@ install: - [ -d $(DESTDIR)/$(MANDIR)/man5 ] || mkdir -p $(DESTDIR)/$(MANDIR)/man5 - [ -d $(DESTDIR)/$(ALTDIR) ] || mkdir -p -m 755 $(DESTDIR)/$(ALTDIR) - [ -d $(DESTDIR)/$(ALTDATADIR) ] || mkdir -p -m 755 $(DESTDIR)/$(ALTDATADIR) -- [ -d $(DESTDIR)/usr/lib/systemd ] || mkdir -p -m 755 $(DESTDIR)/usr/lib/systemd -+ [ -d $(DESTDIR)/$(SYSTEMDDIR) ] || mkdir -p -m 755 $(DESTDIR)/$(SYSTEMDDIR) - - install -m 755 $(PROG) $(DESTDIR)/$(BINDIR)/$(PROG) - ln -s ../../../$(BINDIR)/$(PROG) $(DESTDIR)/usr/lib/systemd/systemd-sysv-install -@@ -59,7 +59,7 @@ install: - [ -d $(DESTDIR)/$(SYSTEMDDIR) ] || mkdir -p -m 755 $(DESTDIR)/$(SYSTEMDDIR) - - install -m 755 $(PROG) $(DESTDIR)/$(BINDIR)/$(PROG) -- ln -s ../../../$(BINDIR)/$(PROG) $(DESTDIR)/usr/lib/systemd/systemd-sysv-install -+ ln -s $(BINDIR)/$(PROG) $(DESTDIR)/$(SYSTEMDDIR)/systemd-sysv-install - - install -m 755 ntsysv $(DESTDIR)/$(SBINDIR)/ntsysv - install -m 755 alternatives $(DESTDIR)/$(SBINDIR)/alternatives diff --git a/chkconfig-pl.patch b/chkconfig-pl.patch index 8232103..fd1f0b1 100644 --- a/chkconfig-pl.patch +++ b/chkconfig-pl.patch @@ -1,16 +1,17 @@ ---- chkconfig-1.3.63/po/pl.po~ 2014-11-05 18:39:09.000000000 +0200 -+++ chkconfig-1.3.63/po/pl.po 2014-11-30 15:01:59.484752041 +0200 -@@ -106,11 +106,11 @@ +diff -urNpa chkconfig-1.15.orig/po/pl.po chkconfig-1.15/po/pl.po +--- chkconfig-1.15.orig/po/pl.po 2021-01-21 09:19:06.000000000 +0100 ++++ chkconfig-1.15/po/pl.po 2021-05-04 10:47:45.426341418 +0200 +@@ -131,11 +131,11 @@ msgstr "Brak wystarczających uprawnień - #: ../chkconfig.c:419 ../chkconfig.c:424 ../chkconfig.c:547 + #: ../chkconfig.c:457 ../chkconfig.c:462 ../chkconfig.c:587 msgid "on" -msgstr "włączone" +msgstr "wł" - #: ../chkconfig.c:419 ../chkconfig.c:424 ../chkconfig.c:547 + #: ../chkconfig.c:457 ../chkconfig.c:462 ../chkconfig.c:587 msgid "off" -msgstr "wyłączone" +msgstr "wył" - #: ../chkconfig.c:509 + #: ../chkconfig.c:547 #, c-format diff --git a/chkconfig-rc.d.patch b/chkconfig-rc.d.patch index 64fd588..f4cdb4d 100644 --- a/chkconfig-rc.d.patch +++ b/chkconfig-rc.d.patch @@ -1,6 +1,7 @@ ---- ./leveldb.h~ 2002-03-13 09:09:04.000000000 +0200 -+++ ./leveldb.h 2005-10-22 15:45:40.000000000 +0300 -@@ -1,7 +1,7 @@ +diff -urNpa chkconfig-1.15.orig/leveldb.h chkconfig-1.15/leveldb.h +--- chkconfig-1.15.orig/leveldb.h 2021-05-03 17:47:25.388139905 +0200 ++++ chkconfig-1.15/leveldb.h 2021-05-04 10:30:35.849341418 +0200 +@@ -16,7 +16,7 @@ #ifndef H_LEVELDB #define H_LEVELDB ================================================================ ---- gitweb: http://git.pld-linux.org/gitweb.cgi/packages/chkconfig.git/commitdiff/6a99f3664bc0759ffd8835ca761b29c5cd0fb512 _______________________________________________ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit