]> git.pld-linux.org Git - packages/chkconfig.git/commitdiff
- noxinet patch to remove xinetd stuff - we use rc-inetd instead
authorJakub Bogusz <qboosh@pld-linux.org>
Sun, 25 Mar 2001 00:07:59 +0000 (00:07 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    chkconfig-noxinet.patch -> 1.1
    chkconfig.spec -> 1.34

chkconfig-noxinet.patch [new file with mode: 0644]
chkconfig.spec

diff --git a/chkconfig-noxinet.patch b/chkconfig-noxinet.patch
new file mode 100644 (file)
index 0000000..c64a6ec
--- /dev/null
@@ -0,0 +1,401 @@
+diff -Nur chkconfig-1.2.16.orig/chkconfig.c chkconfig-1.2.16/chkconfig.c
+--- chkconfig-1.2.16.orig/chkconfig.c  Sat Mar 24 14:51:20 2001
++++ chkconfig-1.2.16/chkconfig.c       Sat Mar 24 15:15:33 2001
+@@ -52,7 +52,6 @@
+       readServiceError(rc, name);
+       return 1;
+     }
+-    if (s.type == TYPE_XINETD) return 0;
+     for (level = 0; level < 7; level++) {
+           if (!findServiceEntries(name, level, &globres)) {
+@@ -73,8 +72,6 @@
+       return 1;
+     }
+       
+-    if (s.type == TYPE_XINETD) return 0;
+-    
+     for (i = 0; i < 7; i++) {
+           if ((1 << i) & s.levels)
+               doSetService(s, i, 1);
+@@ -97,10 +94,6 @@
+     }
+     printf("%-15s", s.name);
+-    if (s.type == TYPE_XINETD) {
+-          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"));
+@@ -110,21 +103,6 @@
+     return 0;
+ }
+-static int isXinetdEnabled() {
+-      int i;
+-      struct service s;
+-      
+-      if (readServiceInfo("xinetd", &s, 0)) {
+-              return 0;
+-      }
+-      for (i = 0; i < 7; i++) {
+-              if (isOn("xinetd", i))
+-                return 1;
+-      }
+-      return 0;
+-}
+-      
+-
+ static int listService(char * item) {
+     DIR * dir;
+     struct dirent * ent;
+@@ -176,34 +154,6 @@
+     closedir(dir);
+       
+-    if (isXinetdEnabled()) {
+-          printf(_("xinetd based services:\n"));
+-          if (!(dir = opendir(XINETDDIR))) {
+-                  fprintf(stderr, _("failed to open directory %s: %s"),
+-                          XINETDDIR, strerror(err));
+-                  return 1;
+-          }
+-          while ((ent = readdir(dir))) {
+-                  const char *dn;
+-                  struct service s;
+-
+-                  /* 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, ".rpmorig") || !strcmp(dn, ".swp")))
+-                    continue;
+-
+-                  dn = ent->d_name + strlen(ent->d_name) - 1;
+-                  if (*dn == '~' || *dn == ',')
+-                    continue;
+-          
+-                  readXinetdServiceInfo(ent->d_name, &s, 0);
+-                  printf("\t%s:\t%s\n", s.name, s.levels ? _("on") : _("off"));
+-          }
+-          closedir(dir);
+-    }
+     return 0;
+ }
+@@ -225,21 +175,16 @@
+       return 1;
+     }
+-    if (s.type == TYPE_INIT_D) {
+-          for (i = 0; i < 7; i++) {
+-                  if (!((1 << i) & where)) continue;
+-
+-                  if (state == 1 || state == 0)
+-                    what = state;
+-                  else if (s.levels & (1 << i))
+-                    what = 1;
+-                  else
+-                    what = 0;
+-                  doSetService(s, i, what);
+-          }
+-    } else if (s.type == TYPE_XINETD) {
+-          setXinetdService(s, state);
+-          system("/etc/init.d/xinetd reload >/dev/null 2>&1");
++    for (i = 0; i < 7; i++) {
++          if (!((1 << i) & where)) continue;
++
++          if (state == 1 || state == 0)
++            what = state;
++          else if (s.levels & (1 << i))
++            what = 1;
++          else
++            what = 0;
++          doSetService(s, i, what);
+     }
+     return 0;
+diff -Nur chkconfig-1.2.16.orig/leveldb.c chkconfig-1.2.16/leveldb.c
+--- chkconfig-1.2.16.orig/leveldb.c    Sat Mar 24 14:51:20 2001
++++ chkconfig-1.2.16/leveldb.c Sat Mar 24 15:17:14 2001
+@@ -138,88 +138,6 @@
+       return 0;
+ }
+-int readXinetdServiceInfo(char *name, struct service * service, int honorHide) {
+-      char * filename = alloca(strlen(name) + strlen(XINETDDIR) + 50);
+-      int fd;
+-      struct service serv = { NULL, -1, -1, -1, NULL, 1, -1 };
+-      struct stat sb;
+-      char * buf, *ptr;
+-      char * eng_desc = NULL, *start;
+-      
+-      snprintf(filename, strlen(name)+strlen(XINETDDIR)+50, XINETDDIR "/%s", name);
+-      
+-      if ((fd = open(filename, O_RDONLY)) < 0) return -1;
+-      fstat(fd,&sb);
+-      buf = malloc(sb.st_size+1);
+-      if (read(fd,buf,sb.st_size)!=sb.st_size) {
+-              close(fd);
+-              free(buf);
+-              return -1;
+-      }
+-      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 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;
+-}
+-
+ int readServiceInfo(char * name, struct service * service, int honorHide) {
+     char * filename = alloca(strlen(name) + strlen(RUNLEVELS) + 50);
+     int fd;
+@@ -236,7 +154,7 @@
+     sprintf(filename, RUNLEVELS "/init.d/%s", name);
+     if ((fd = open(filename, O_RDONLY)) < 0) {
+-          return readXinetdServiceInfo(name,service,honorHide);
++          return -1;
+     }
+     fstat(fd, &sb);
+@@ -418,60 +336,6 @@
+     globfree(&globres);
+     return 1;
+-}
+-
+-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;
+-      
+-      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);
+-      newfd = mkstemp(newfname);
+-      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)) {
+-                      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);
+-      chmod(newfname,0644);
+-      unlink(oldfname);
+-      return(rename(newfname,oldfname));
+ }
+ int doSetService(struct service s, int level, int on) {
+diff -Nur chkconfig-1.2.16.orig/leveldb.h chkconfig-1.2.16/leveldb.h
+--- chkconfig-1.2.16.orig/leveldb.h    Sat Mar 24 14:51:20 2001
++++ chkconfig-1.2.16/leveldb.h Sat Mar 24 15:14:46 2001
+@@ -2,12 +2,10 @@
+ #define H_LEVELDB
+ #define RUNLEVELS "/etc/rc.d"
+-#define XINETDDIR "/etc/xinetd.d"
+ #include <glob.h>
+ #define TYPE_INIT_D   0
+-#define TYPE_XINETD   1
+ struct service {
+     char * name;
+@@ -27,7 +25,5 @@
+ int isConfigured(char * name, int level);
+ int doSetService(struct service s, int level, int on);
+ int findServiceEntries(char * name, int level, glob_t * globresptr);
+-int readXinetdServiceInfo(char *name, struct service *service, int honorHide);
+-int setXinetdService(struct service s, int on);
+ #endif
+diff -Nur chkconfig-1.2.16.orig/ntsysv.c chkconfig-1.2.16/ntsysv.c
+--- chkconfig-1.2.16.orig/ntsysv.c     Wed Aug 16 22:04:28 2000
++++ chkconfig-1.2.16/ntsysv.c  Sat Mar 24 15:14:46 2001
+@@ -40,20 +40,14 @@
+     states = alloca(sizeof(*states) * numServices);
+     
+     for (i = 0; i < numServices; i++) {
+-      if (services[i].type == TYPE_XINETD) {
+-              checkboxes[i] = newtCheckbox(-1, i, services[i].name, 
+-                                   services[i].levels ? '*' : ' ', NULL, 
+-                                   states + i);
+-      } else {
+-              for (j = 0; j < 7; j++) {
+-                      if (levels & (1 << j)) {
+-                              if (isOn(services[i].name, j)) break;
+-                      }
++      for (j = 0; j < 7; j++) {
++              if (levels & (1 << j)) {
++                      if (isOn(services[i].name, j)) break;
+               }
+-              checkboxes[i] = newtCheckbox(-1, i, services[i].name, 
+-                                           (j != 7) ? '*' : ' ', NULL, 
+-                                           states + i);
+       }
++      checkboxes[i] = newtCheckbox(-1, i, services[i].name, 
++                                   (j != 7) ? '*' : ' ', NULL, 
++                                   states + i);
+       newtFormAddComponent(subform, checkboxes[i]);
+     }
+@@ -110,13 +104,9 @@
+     if (!update) return 1;
+     for (i = 0; i < numServices; i++) {
+-      if (services[i].type == TYPE_XINETD)
+-            setXinetdService(services[i], states[i] == '*');
+-      else {
+-            for (j = 0; j < 7; j++) {
+-                    if (levels & (1 << j))
+-                      doSetService(services[i], j, states[i] == '*');
+-            }
++      for (j = 0; j < 7; j++) {
++            if (levels & (1 << j))
++              doSetService(services[i], j, states[i] == '*');
+       }
+     }
+@@ -186,47 +176,6 @@
+     }
+     closedir(dir);
+-
+-    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, honorHide);
+-      
+-      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;
+-    }
+     qsort(services, numServices, sizeof(*services), serviceNameCmp);
index 127fe737d33e49a3ceffdbccee616d70c28deb91..a006b8008ae00c5ae8c0e75e57363f004b8b2e76 100644 (file)
@@ -18,6 +18,7 @@ Patch1:               %{name}-fhs.patch
 Patch2:                %{name}-add.patch
 Patch3:                %{name}-popt.patch
 Patch4:                %{name}-rcdir.patch
+Patch5:                %{name}-noxinet.patch
 BuildRequires: slang-devel
 BuildRequires: newt-devel
 BuildRequires: popt-devel
@@ -87,6 +88,7 @@ termina
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
 
 %build
 
This page took 0.124922 seconds and 4 git commands to generate.