]> git.pld-linux.org Git - packages/chkconfig.git/commitdiff
- updated
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Thu, 24 Apr 2008 07:34:28 +0000 (07:34 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    chkconfig-add.patch -> 1.8
    chkconfig-noxinet.patch -> 1.6

chkconfig-add.patch
chkconfig-noxinet.patch

index 330177fb11b6b9017da4cdb9e4af96c14b4d65c9..ce633cefd60b6199f6efe10b9c851c78a77ea54e 100644 (file)
@@ -1,19 +1,19 @@
-diff -Nru chkconfig-1.2.24h.orig/chkconfig.c chkconfig-1.2.24h/chkconfig.c
---- chkconfig-1.2.24h.orig/chkconfig.c Wed Jul 17 20:10:55 2002
-+++ chkconfig-1.2.24h/chkconfig.c      Wed Jan 22 11:56:32 2003
-@@ -31,6 +31,7 @@
- #include <sys/stat.h>
+diff -urN chkconfig-1.3.37.org/chkconfig.c chkconfig-1.3.37/chkconfig.c
+--- chkconfig-1.3.37.org/chkconfig.c   2007-11-08 22:28:34.000000000 +0100
++++ chkconfig-1.3.37/chkconfig.c       2008-04-24 09:27:21.427392171 +0200
+@@ -27,6 +27,7 @@
  #include <unistd.h>
  static char *progname;
 +extern int addItem;
- struct config conf;           // used by leveldb.c
  
  #define _(String) gettext((String)) 
-@@ -94,12 +95,10 @@
-     if (s.type == TYPE_XINETD) return 0;
-     
-     for (i = 0; i <= conf.maxlevel; i++) {
--      if (!isConfigured(name, i)) {
+@@ -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
@@ -22,19 +22,19 @@ diff -Nru chkconfig-1.2.24h.orig/chkconfig.c chkconfig-1.2.24h/chkconfig.c
      }
  
      return 0;
-@@ -275,7 +274,7 @@
+@@ -558,7 +557,7 @@
+ }
  
  int main(int argc, char ** argv) {
--    int listItem = 0, addItem = 0, delItem = 0;
-+    int listItem = 0, delItem = 0;
+-    int listItem = 0, addItem = 0, delItem = 0, overrideItem = 0;
++    int listItem = 0, delItem = 0, overrideItem = 0;
      int rc, i, x;
+     int LSB = 0;
      char * levels = NULL;
-     int help=0, version=0;
-diff -Nru chkconfig-1.2.24h.orig/leveldb.c chkconfig-1.2.24h/leveldb.c
---- chkconfig-1.2.24h.orig/leveldb.c   Fri Apr 19 03:15:55 2002
-+++ chkconfig-1.2.24h/leveldb.c        Wed Jan 22 12:04:47 2003
-@@ -11,6 +11,10 @@
+diff -urN chkconfig-1.3.37.org/leveldb.c chkconfig-1.3.37/leveldb.c
+--- chkconfig-1.3.37.org/leveldb.c     2007-08-03 19:57:56.000000000 +0200
++++ chkconfig-1.3.37/leveldb.c 2008-04-24 09:27:34.124665839 +0200
+@@ -26,6 +26,10 @@
  #include <stdio.h>
  #include <string.h>
  #include <unistd.h>
@@ -44,34 +44,28 @@ diff -Nru chkconfig-1.2.24h.orig/leveldb.c chkconfig-1.2.24h/leveldb.c
 +int addItem = 0;
  
  /* Changes
-    2001-12-03 - Petter Reinholdtsen <pere@hungry.com>
-@@ -231,6 +235,9 @@
-     char overflow;
-     char levelbuf[20];
-     char * english_desc = NULL;
-+    DIR *dir;
-+    struct dirent *dirent;
-+    int i;
-     sprintf(filename, "%s/%s", conf.initdir, name);
-@@ -345,6 +352,21 @@
-     serv.name = strdup(name);
+    1998-09-22 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+@@ -563,6 +567,25 @@
+           serv.provides[1] = NULL;
+     }
  
 +    if (addItem) {
-+      strcpy(levelbuf,"/etc/rc.d/rc0.d");
-+      for(i=0;i<7;i++,levelbuf[12]++) {
-+          dir=opendir(levelbuf);
-+          if (!dir) return 1;
-+          while ((dirent=readdir(dir))) {
-+              if (strlen(dirent->d_name)<4) continue;
-+              if (strcmp(dirent->d_name+3,name)) continue;
-+              if (*dirent->d_name=='K') serv.levels &= ~(1<<i);
-+              else if (*dirent->d_name=='S') serv.levels |= 1<<i;
++          DIR *dir;
++          struct dirent *dirent;
++          int i;
++
++          strcpy(levelbuf,"/etc/rc.d/rc0.d");
++          for(i=0;i<7;i++,levelbuf[12]++) {
++                  dir=opendir(levelbuf);
++                  if (!dir) return 1;
++                  while ((dirent=readdir(dir))) {
++                          if (strlen(dirent->d_name)<4) continue;
++                          if (strcmp(dirent->d_name+3,name)) continue;
++                          if (*dirent->d_name=='K') serv.levels &= ~(1<<i);
++                          else if (*dirent->d_name=='S') serv.levels |= 1<<i;
++                  }
++                  closedir(dir);
 +          }
-+          closedir(dir);
-+      }
 +    }
 +
      *service = serv;
index def510e6d17618471705cca7bd1d0df4e59f84aa..0ad1689909aa1642928fcbea2c0e248d82202f9f 100644 (file)
@@ -1,24 +1,41 @@
-diff -Nru chkconfig-1.2.24h.orig/chkconfig.c chkconfig-1.2.24h/chkconfig.c
---- chkconfig-1.2.24h.orig/chkconfig.c Wed Jul 17 20:10:55 2002
-+++ chkconfig-1.2.24h/chkconfig.c      Wed Jan 22 12:43:07 2003
-@@ -70,7 +70,6 @@
+diff -urN chkconfig-1.3.37.org/chkconfig.c chkconfig-1.3.37/chkconfig.c
+--- chkconfig-1.3.37.org/chkconfig.c   2007-11-08 22:28:34.000000000 +0100
++++ chkconfig-1.3.37/chkconfig.c       2008-04-24 09:30:17.709152778 +0200
+@@ -68,8 +68,6 @@
        readServiceError(rc, name);
        return 1;
      }
 -    if (s.type == TYPE_XINETD) return 0;
+-
  
-     for (level = 0; level <= conf.maxlevel; level++) {
-           if (!findServiceEntries(name, level, &globres)) {
-@@ -90,8 +89,6 @@
+     if (!findServiceEntries(name, level, &globres)) {
+           for (i = 0; i < globres.gl_pathc; i++)
+@@ -88,7 +86,6 @@
        readServiceError(rc, name);
        return 1;
      }
+-    if (s.type == TYPE_XINETD) return 0;
+     for (level = 0; level < 7; level++) {
+           if (!findServiceEntries(name, level, &globres)) {
+@@ -238,7 +235,6 @@
+       return 1;
+     }
+       
+-    if (s.type == TYPE_XINETD) return 0;
+     if (s.isLSB)
+               frobDependencies(&s);
+     else
+@@ -269,8 +265,6 @@
+     if ((rc = readServiceDifferences(name, &s, &o, 0))) {
+       return 0;
+     }
 -      
 -    if (s.type == TYPE_XINETD) return 0;
-     
-     for (i = 0; i <= conf.maxlevel; i++) {
-       if (!isConfigured(name, i)) {
-@@ -118,10 +115,6 @@
+     if ((s.levels == o.levels) &&
+         (s.kPriority == o.kPriority) &&
+@@ -351,10 +345,6 @@
      }
  
      printf("%-15s", s.name);
@@ -27,44 +44,61 @@ diff -Nru chkconfig-1.2.24h.orig/chkconfig.c chkconfig-1.2.24h/chkconfig.c
 -          return 0;
 -    }
  
-     for (i = 0; i <= conf.maxlevel; i++) {
+     for (i = 0; i < 7; i++) {
        printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off"));
-@@ -131,21 +124,6 @@
+@@ -364,32 +354,10 @@
      return 0;
  }
  
 -static int isXinetdEnabled() {
--    int i;
--    struct service s;
+-      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;
+-}
 -
--    if (readServiceInfo("xinetd", &s, 0)) {
--          return 0;
--    }
--    for (i = 0; i <= conf.maxlevel; i++) {
--      if (isOn("xinetd", i))
--            return 1;
--    }
--    return 0;
+ 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;
+-
+-    return strcmp(first->name, second->name);
 -}
--      
 -
+-
  static int listService(char * item) {
      DIR * dir;
-     struct dirent * ent;
-@@ -200,34 +178,6 @@
+@@ -459,53 +427,6 @@
+       
      closedir(dir);
+       
 -    if (isXinetdEnabled()) {
+-          struct service *s, *t;
+-        
+-          printf("\n");
 -          printf(_("xinetd based services:\n"));
--          if (!(dir = opendir(conf.xinetddir))) {
--                  fprintf(stderr, _("failed to open directory %s: %s"),
--                          conf.xinetddir, strerror(err));
+-          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;
--                  struct service s;
 -
 -                  /* Skip any file starting with a . */
 -                  if (ent->d_name[0] == '.')  continue;
@@ -78,48 +112,77 @@ diff -Nru chkconfig-1.2.24h.orig/chkconfig.c chkconfig-1.2.24h/chkconfig.c
 -                  if (*dn == '~' || *dn == ',')
 -                    continue;
 -          
--                  readXinetdServiceInfo(ent->d_name, &s, 0);
--                  printf("\t%s:\t%s\n", s.name, s.levels ? _("on") : _("off"));
+-                  if (numServices == numServicesAlloced) {
+-                          numServicesAlloced += 10;
+-                          s = realloc(s, numServicesAlloced * sizeof (*s));
+-                  }
+-                  if (readXinetdServiceInfo(ent->d_name, s + numServices, 0) != -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;
  }
  
-@@ -249,7 +199,6 @@
-       return 1;
-     }
--    if (s.type == TYPE_INIT_D) {
-           for (i = 0; i <= conf.maxlevel; i++) {
-                   if (!((1 << i) & where)) continue;
-@@ -261,14 +210,6 @@
-                     what = 0;
-                   doSetService(s, i, what);
+@@ -547,11 +468,6 @@
+                   rc |= doSetService(s, i, what);
            }
+           return rc;
 -    } else if (s.type == TYPE_XINETD) {
--          char xinetd[250];
--
--          setXinetdService(s, state);
--          snprintf(xinetd, sizeof(xinetd),
--                      "%s/xinetd reload >/dev/null 2>&1", conf.initdir);
--          system(xinetd);
--    }
+-          if (setXinetdService(s, state)) {
+-                  return 1;
+-          }
+-          system("/etc/init.d/xinetd reload >/dev/null 2>&1");
+     }
  
      return 0;
- }
-diff -Nru chkconfig-1.2.24h.orig/leveldb.c chkconfig-1.2.24h/leveldb.c
---- chkconfig-1.2.24h.orig/leveldb.c   Fri Apr 19 03:15:55 2002
-+++ chkconfig-1.2.24h/leveldb.c        Wed Jan 22 12:46:28 2003
-@@ -140,88 +140,6 @@
+@@ -682,13 +598,7 @@
+           rc = readServiceInfo(name, &s, 0);
+           if (rc)
+              return 1;
+-          if (s.type == TYPE_XINETD) {
+-             if (isOn("xinetd",level))
+-                     return !s.levels;
+-             else
+-                     return 1;
+-          } else      
+-             return isOn(name, level) ? 0 : 1;
++          return isOn(name, level) ? 0 : 1;
+       } else if (!strcmp(state, "on"))
+           return setService(name, where, 1);
+       else if (!strcmp(state, "off"))
+diff -urN chkconfig-1.3.37.org/leveldb.c chkconfig-1.3.37/leveldb.c
+--- chkconfig-1.3.37.org/leveldb.c     2007-08-03 19:57:56.000000000 +0200
++++ chkconfig-1.3.37/leveldb.c 2008-04-24 09:30:40.913595417 +0200
+@@ -149,101 +149,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 service serv = { 
+-                      name: NULL,
+-                      levels: -1,
+-                      kPriority: -1,
+-                      sPriority: -1, 
+-                      desc: NULL, 
+-                      startDeps: NULL, 
+-                      stopDeps: NULL,
+-                      provides: NULL,
+-                      type: TYPE_XINETD, 
+-                      isLSB: 0, 
+-                      enabled: -1
+-      };
 -      struct stat sb;
 -      char * buf, *ptr;
 -      char * eng_desc = NULL, *start;
@@ -128,6 +191,7 @@ diff -Nru chkconfig-1.2.24h.orig/leveldb.c chkconfig-1.2.24h/leveldb.c
 -      
 -      if ((fd = open(filename, O_RDONLY)) < 0) return -1;
 -      fstat(fd,&sb);
+-      if (! S_ISREG(sb.st_mode)) return -1;
 -      buf = malloc(sb.st_size+1);
 -      if (read(fd,buf,sb.st_size)!=sb.st_size) {
 -              close(fd);
@@ -199,18 +263,9 @@ diff -Nru chkconfig-1.2.24h.orig/leveldb.c chkconfig-1.2.24h/leveldb.c
 -}
 -
  int readServiceInfo(char * name, struct service * service, int honorHide) {
-     char * filename = alloca(strlen(name) + strlen(conf.initdir) + 50);
+     char * filename = alloca(strlen(name) + strlen(RUNLEVELS) + 50);
      int fd;
-@@ -235,7 +153,7 @@
-     sprintf(filename, "%s/%s", conf.initdir, name);
-     if ((fd = open(filename, O_RDONLY)) < 0) {
--          return readXinetdServiceInfo(name,service,honorHide);
-+          return -1;
-     }
-     fstat(fd, &sb);
-@@ -427,60 +345,6 @@
+@@ -656,60 +561,6 @@
      return 1;
  }
  
@@ -271,90 +326,3 @@ diff -Nru chkconfig-1.2.24h.orig/leveldb.c chkconfig-1.2.24h/leveldb.c
  int doSetService(struct service s, int level, int on) {
      int priority = on ? s.sPriority : s.kPriority;
      char linkname[200];
-diff -Nru chkconfig-1.2.24h.orig/ntsysv.c chkconfig-1.2.24h/ntsysv.c
---- chkconfig-1.2.24h.orig/ntsysv.c    Sun Jul 28 10:50:04 2002
-+++ chkconfig-1.2.24h/ntsysv.c Wed Jan 22 12:50:38 2003
-@@ -64,11 +64,6 @@
-     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 <= conf.maxlevel; j++) {
-                       if (levels & (1 << j)) {
-                               if (isOn(services[i].name, j)) break;
-@@ -78,7 +73,6 @@
-                                            (j != (conf.maxlevel+1)) ?
-                                                       '*' : ' ', NULL, 
-                                            states + i);
--      }
-       newtFormAddComponent(subform, checkboxes[i]);
-     }
-@@ -135,13 +129,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 <= conf.maxlevel; j++) {
-                     if (levels & (1 << j))
-                       doSetService(services[i], j, states[i] == '*');
--            }
-       }
-     }
-@@ -212,49 +202,6 @@
-     closedir(dir);
--    if (!stat("/usr/sbin/xinetd",&sb)) {
--      if (!(dir = opendir(conf.xinetddir))) {
--          fprintf(stderr, "failed to open %s: %s\n", conf.xinetddir,
--                  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", conf.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"),
--                  conf.xinetddir, strerror(err));
--          return 1;
--      }
--    }
--
-     qsort(services, numServices, sizeof(*services), serviceNameCmp);
-     *servicesPtr = services;
This page took 0.125044 seconds and 4 git commands to generate.