1
0
Эх сурвалжийг харах

* Fixed some problems with updating within 1.1
* Fixed some general things in the update system
* All leaf bots now call parseconf()
as opposed to just the localhub
* Binaries/Tars now in format: Packname.OS-VER.ext
was: Packname.OS.VER.ext


svn: 731

Bryan Drewery 22 жил өмнө
parent
commit
f07cfeb674

+ 3 - 3
build

@@ -183,7 +183,7 @@ fi
 
 
 for bin in $fls
 for bin in $fls
 do
 do
-  mv -f $bin $bin.$os.$ver${d}
+  mv -f $bin $bin.$os-$ver${d}
 done
 done
 
 
 # Wrap it nicely up into an archive
 # Wrap it nicely up into an archive
@@ -199,12 +199,12 @@ if [ $nopkg = "0" ]; then
   #This MALLOC business is to not Abort 'tar' due to some bug it has.
   #This MALLOC business is to not Abort 'tar' due to some bug it has.
   tmp=${MALLOC_CHECK_}
   tmp=${MALLOC_CHECK_}
   unset MALLOC_CHECK_
   unset MALLOC_CHECK_
-  tar -c${zip}f ${PACKNAME}.$os.$ver${d}.tar.${ext} *.$os.$ver${d}
+  tar -c${zip}f ${PACKNAME}.$os-$ver${d}.tar.${ext} *.$os.$ver${d}
   if test -n "$tmp"; then
   if test -n "$tmp"; then
     declare -x MALLOC_CHECK_=$tmp
     declare -x MALLOC_CHECK_=$tmp
   fi
   fi
   rm -f *$os.$ver${d}
   rm -f *$os.$ver${d}
-  echo "Binaries are now in '${PACKNAME}.$os.$ver${d}.tar.${ext}'."
+  echo "Binaries are now in '${PACKNAME}.$os-$ver${d}.tar.${ext}'."
 fi
 fi
   exit 0
   exit 0
 
 

+ 1 - 1
src/dcc.h

@@ -177,7 +177,7 @@ struct dupwait_info {
 #define STAT_LEAF    0x00080    /* this bot is a leaf only               */
 #define STAT_LEAF    0x00080    /* this bot is a leaf only               */
 #define STAT_LINKING 0x00100    /* the bot is currently going through
 #define STAT_LINKING 0x00100    /* the bot is currently going through
                                    the linking stage                     */
                                    the linking stage                     */
-#define STAT_AGGRESSIVE   0x200 /* aggressively sharing with this bot    */
+#define STAT_AGGRESSIVE   0x00200 /* aggressively sharing with this bot    */
 #define STAT_OFFEREDU 0x00400
 #define STAT_OFFEREDU 0x00400
 #define STAT_SENDINGU 0x00800
 #define STAT_SENDINGU 0x00800
 #define STAT_GETTINGU 0x01000
 #define STAT_GETTINGU 0x01000

+ 8 - 8
src/main.c

@@ -578,14 +578,12 @@ static void init_main() {
   if (do_confedit)
   if (do_confedit)
     confedit(cfile);		/* this will exit() */
     confedit(cfile);		/* this will exit() */
 #endif /* S_CONFEDIT */
 #endif /* S_CONFEDIT */
+  parseconf();
+
 #ifdef LEAF
 #ifdef LEAF
-  if (localhub) {
+  if (localhub)
 #endif /* LEAF */
 #endif /* LEAF */
-    parseconf();
     writeconf(cfile, NULL, CONF_ENC);
     writeconf(cfile, NULL, CONF_ENC);
-#ifdef LEAF
-  }
-#endif /* LEAF */
 
 
   if (!can_stat(binname))
   if (!can_stat(binname))
    werr(ERR_BINSTAT);
    werr(ERR_BINSTAT);
@@ -608,7 +606,9 @@ static void init_main() {
     if (strcmp(binname, newbin) && strcmp(newbin, real)) { 		/* if wrong path and new path != current */
     if (strcmp(binname, newbin) && strcmp(newbin, real)) { 		/* if wrong path and new path != current */
       int ok = 1;
       int ok = 1;
 
 
-      sdprintf(STR("wrong dir, is: %s :: %s"), binname, newbin);
+      sdprintf("real: %s", real);
+      sdprintf("wrong dir, is: %s :: %s", binname, newbin);
+
       unlink(newbin);
       unlink(newbin);
       if (copyfile(binname, newbin))
       if (copyfile(binname, newbin))
         ok = 0;
         ok = 0;
@@ -623,9 +623,9 @@ static void init_main() {
           ok = 0;
           ok = 0;
       }
       }
 
 
-      if (!ok)
+      if (!ok) {
         werr(ERR_WRONGBINDIR);
         werr(ERR_WRONGBINDIR);
-      else {
+      } else {
         unlink(binname);
         unlink(binname);
         system(newbin);
         system(newbin);
         sdprintf(STR("exiting to let new binary run..."));
         sdprintf(STR("exiting to let new binary run..."));

+ 1 - 7
src/mod/transfer.mod/transfer.c

@@ -594,13 +594,7 @@ static void eof_dcc_send(int idx)
       lostdcc(idx);
       lostdcc(idx);
       return;
       return;
     } else if (!strcmp(dcc[idx].nick, "*binary")) {
     } else if (!strcmp(dcc[idx].nick, "*binary")) {
-      module_entry *me = module_find("update", 0, 0);
-
-      if (me && me->funcs) {
-	Function f = me->funcs[UPDATE_FINISH];
-
-	(f) (idx);
-      }
+      finish_update(idx);
       killsock(dcc[idx].sock);
       killsock(dcc[idx].sock);
       lostdcc(idx);
       lostdcc(idx);
       return;
       return;

+ 10 - 10
src/mod/update.mod/update.c

@@ -93,13 +93,14 @@ static void update_ufsend(int idx, char *par)
   char *ip = NULL, *port = NULL, s[1024] = "";
   char *ip = NULL, *port = NULL, s[1024] = "";
   int i, sock;
   int i, sock;
   FILE *f = NULL;
   FILE *f = NULL;
+
   putlog(LOG_BOTS, "*", "Downloading updated binary from %s", dcc[idx].nick);
   putlog(LOG_BOTS, "*", "Downloading updated binary from %s", dcc[idx].nick);
 #ifdef HUB
 #ifdef HUB
   egg_snprintf(s, sizeof s, "%s.update.%s.hub", tempdir, conf.bot->nick);
   egg_snprintf(s, sizeof s, "%s.update.%s.hub", tempdir, conf.bot->nick);
 #else
 #else
   egg_snprintf(s, sizeof s, "%s.update.%s.leaf", tempdir, conf.bot->nick);
   egg_snprintf(s, sizeof s, "%s.update.%s.leaf", tempdir, conf.bot->nick);
 #endif
 #endif
-  unlink(s); //make sure there isnt already a new binary here..
+  unlink(s); /* make sure there isnt already a new binary here.. */
   if (dcc_total == max_dcc) {
   if (dcc_total == max_dcc) {
     putlog(LOG_MISC, "*", "NO MORE DCC CONNECTIONS -- can't grab new binary");
     putlog(LOG_MISC, "*", "NO MORE DCC CONNECTIONS -- can't grab new binary");
     dprintf(idx, "sb e I can't open a DCC to you; I'm full.\n");
     dprintf(idx, "sb e I can't open a DCC to you; I'm full.\n");
@@ -238,8 +239,7 @@ void finish_update(int idx)
   int i, j = -1;
   int i, j = -1;
 
 
   for (i = 0; i < dcc_total; i++)
   for (i = 0; i < dcc_total; i++)
-    if (!egg_strcasecmp(dcc[i].nick, dcc[idx].host) &&
-	(dcc[i].type->flags & DCT_BOT))
+    if (!egg_strcasecmp(dcc[i].nick, dcc[idx].host) && (dcc[i].type->flags & DCT_BOT))
       j = i;
       j = i;
   if (j == -1)
   if (j == -1)
     return;
     return;
@@ -292,7 +292,7 @@ static void start_sending_binary(int idx)
   struct stat sb;
   struct stat sb;
   int i = 1;
   int i = 1;
 
 
-  dcc[idx].status &= ~STAT_OFFEREDU;
+  dcc[idx].status &= ~(STAT_OFFEREDU | STAT_SENDINGU);
 
 
   if (bupdating) return;
   if (bupdating) return;
   bupdating = 1;
   bupdating = 1;
@@ -304,15 +304,16 @@ static void start_sending_binary(int idx)
     putlog(LOG_MISC, "*", "Cannot update \002%s\002 automatically, uname not returning os name.", dcc[idx].nick);
     putlog(LOG_MISC, "*", "Cannot update \002%s\002 automatically, uname not returning os name.", dcc[idx].nick);
     return;
     return;
   }
   }
-  if (bot_hublevel(dcc[idx].user) == 999) { //send them the leaf binary..
+  if (bot_hublevel(dcc[idx].user) == 999) { /* send them the leaf binary.. */
     sprintf(buf2, "leaf");
     sprintf(buf2, "leaf");
   } else {
   } else {
     sprintf(buf2, "hub");
     sprintf(buf2, "hub");
   }
   }
-  sprintf(update_file, "%s.%s.%s", buf2,dcc[idx].u.bot->sysname, egg_version);
+  sprintf(update_file, "%s.%s-%s", buf2,dcc[idx].u.bot->sysname, egg_version);
 
 
   if (stat(update_file, &sb)) {
   if (stat(update_file, &sb)) {
     putlog(LOG_MISC, "*", "Need to update \002%s\002 with %s, but it cannot be accessed", dcc[idx].nick, update_file);
     putlog(LOG_MISC, "*", "Need to update \002%s\002 with %s, but it cannot be accessed", dcc[idx].nick, update_file);
+    bupdating = 0;
     return;
     return;
   } 
   } 
   sprintf(buf3, "%s.%s", tempdir, update_file);
   sprintf(buf3, "%s.%s", tempdir, update_file);
@@ -411,17 +412,16 @@ static void check_updates()
     char buf[1024] = "";
     char buf[1024] = "";
 
 
     cnt++;
     cnt++;
-    if ((cnt > 5) && bupdating)  bupdating = 0; //2 minutes should be plenty.
+    if ((cnt > 5) && bupdating)  bupdating = 0; /* 2 minutes should be plenty. */
     if (bupdating) return;
     if (bupdating) return;
     cnt = 0;
     cnt = 0;
 
 
     for (i = 0; i < dcc_total; i++) {
     for (i = 0; i < dcc_total; i++) {
       if (dcc[i].type->flags & DCT_BOT && (dcc[i].status & STAT_SHARE) &&
       if (dcc[i].type->flags & DCT_BOT && (dcc[i].status & STAT_SHARE) &&
           !(dcc[i].status & STAT_SENDINGU) && !(dcc[i].status & STAT_OFFEREDU) &&
           !(dcc[i].status & STAT_SENDINGU) && !(dcc[i].status & STAT_OFFEREDU) &&
-          !(dcc[i].status & STAT_UPDATED)) { //only offer binary to bots that are sharing
+          !(dcc[i].status & STAT_UPDATED)) { /* only offer binary to bots that are sharing */
 
 
-        dcc[i].status &= ~(STAT_GETTINGU | STAT_SENDINGU |
-                         STAT_OFFEREDU);
+        dcc[i].status &= ~(STAT_GETTINGU | STAT_SENDINGU | STAT_OFFEREDU);
 
 
         if ((dcc[i].u.bot->bts < buildts) && (isupdatehub())) {
         if ((dcc[i].u.bot->bts < buildts) && (isupdatehub())) {
           putlog(LOG_DEBUG, "@", "Bot: %s has build %lu, offering them %lu", dcc[i].nick, dcc[i].u.bot->bts, buildts);
           putlog(LOG_DEBUG, "@", "Bot: %s has build %lu, offering them %lu", dcc[i].nick, dcc[i].u.bot->bts, buildts);