Revision: 3076
          http://ipcop.svn.sourceforge.net/ipcop/?rev=3076&view=rev
Author:   riddles
Date:     2009-06-17 15:14:05 +0000 (Wed, 17 Jun 2009)

Log Message:
-----------
Merged /ipcop/trunk:r3056-3075

Modified Paths:
--------------
    ipcop/branches/template-branch/config/arch/i486/extlinux.conf
    ipcop/branches/template-branch/config/arch/i486/syslinux-serial.cfg
    ipcop/branches/template-branch/config/arch/i486/syslinux.cfg
    ipcop/branches/template-branch/config/install/halt
    ipcop/branches/template-branch/config/install/init
    ipcop/branches/template-branch/config/rootfiles/common/ncurses
    ipcop/branches/template-branch/html/html/themes/default/vars.tpl
    ipcop/branches/template-branch/lfs/Config
    ipcop/branches/template-branch/lfs/busybox
    ipcop/branches/template-branch/lfs/initramfs
    ipcop/branches/template-branch/make.sh
    ipcop/branches/template-branch/src/installer/arch_defs.h
    ipcop/branches/template-branch/src/installer/installer.c
    ipcop/branches/template-branch/src/installer/keymap.c
    ipcop/branches/template-branch/src/installer/partition.c
    ipcop/branches/template-branch/src/installer/setup.c
    ipcop/branches/template-branch/src/patches/busybox-1.14.1_modprobe.patch

Added Paths:
-----------
    ipcop/branches/template-branch/src/patches/busybox-1.14.1-ash.patch

Property Changed:
----------------
    ipcop/branches/template-branch/
    ipcop/branches/template-branch/config/ssl/openvpn.cnf
    ipcop/branches/template-branch/html/cgi-bin/openvpn.cgi
    ipcop/branches/template-branch/html/html/images/openvpnzip.gif
    ipcop/branches/template-branch/src/libs/multilines.pl


Property changes on: ipcop/branches/template-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - /ipcop/trunk:2760-3055
   + /ipcop/trunk:2760-3075

Modified: ipcop/branches/template-branch/config/arch/i486/extlinux.conf
===================================================================
--- ipcop/branches/template-branch/config/arch/i486/extlinux.conf       
2009-06-17 12:23:18 UTC (rev 3075)
+++ ipcop/branches/template-branch/config/arch/i486/extlinux.conf       
2009-06-17 15:14:05 UTC (rev 3076)
@@ -1,3 +1,4 @@
+SERIAL_CONSOLE
 DEFAULT vesamenu.c32
 PROMPT 0
 TIMEOUT 100
@@ -18,13 +19,13 @@
   MENU LABEL IPCop
   MENU SAVE
   KERNEL vmlinuz
-  APPEND mode=normal initrd=ipcoprd.img root=ROOT_DEV ro panic=10 
flashdisk_settings
+  APPEND mode=normal initrd=ipcoprd.img root=ROOT_DEV ro panic=10 
serial_settings flashdisk_settings
 
 LABEL noacpi
   MENU LABEL IPCop (ACPI disabled)
   MENU SAVE
   KERNEL vmlinuz
-  APPEND mode=normal initrd=ipcoprd.img root=ROOT_DEV acpi=off ro panic=10 
flashdisk_settings
+  APPEND mode=normal initrd=ipcoprd.img root=ROOT_DEV acpi=off ro panic=10 
serial_settings flashdisk_settings
 
 LABEL memtest
   MENU LABEL Memory Test
@@ -36,4 +37,4 @@
   MENU LABEL Rescue
   MENU NOSAVE
   KERNEL vmlinuz
-  APPEND mode=rescue initrd=ipcoprd.img root=ROOT_DEV ro panic=10 nodma 
flashdisk_settings
+  APPEND mode=rescue initrd=ipcoprd.img root=ROOT_DEV ro panic=10 nodma 
serial_settings flashdisk_settings

Modified: ipcop/branches/template-branch/config/arch/i486/syslinux-serial.cfg
===================================================================
--- ipcop/branches/template-branch/config/arch/i486/syslinux-serial.cfg 
2009-06-17 12:23:18 UTC (rev 3075)
+++ ipcop/branches/template-branch/config/arch/i486/syslinux-serial.cfg 
2009-06-17 15:14:05 UTC (rev 3076)
@@ -22,7 +22,7 @@
   IPAPPEND 3
 LABEL nodma
   KERNEL vmlinuz
-  APPEND mode=install initrd=instroot.img nodma console=ttyS0,38400n8 
ipcopboot=
+  APPEND mode=install initrd=instroot.img nodma console=ttyS0,38400n8 quiet 
ipcopboot=
   IPAPPEND 3
 LABEL memtest
   KERNEL memtest

Modified: ipcop/branches/template-branch/config/arch/i486/syslinux.cfg
===================================================================
--- ipcop/branches/template-branch/config/arch/i486/syslinux.cfg        
2009-06-17 12:23:18 UTC (rev 3075)
+++ ipcop/branches/template-branch/config/arch/i486/syslinux.cfg        
2009-06-17 15:14:05 UTC (rev 3076)
@@ -21,7 +21,7 @@
   IPAPPEND 3
 LABEL nodma
   KERNEL vmlinuz
-  APPEND mode=install initrd=instroot.img nodma ipcopboot=
+  APPEND mode=install initrd=instroot.img nodma quiet ipcopboot=
   IPAPPEND 3
 LABEL memtest
   KERNEL memtest

Modified: ipcop/branches/template-branch/config/install/halt
===================================================================
--- ipcop/branches/template-branch/config/install/halt  2009-06-17 12:23:18 UTC 
(rev 3075)
+++ ipcop/branches/template-branch/config/install/halt  2009-06-17 15:14:05 UTC 
(rev 3076)
@@ -9,4 +9,4 @@
 echo "Unmounting filesystems ... "
 /bin/umount -a -r
 echo "Reboot ... "
-/bin/reboot
+/bin/reboot -f

Modified: ipcop/branches/template-branch/config/install/init
===================================================================
--- ipcop/branches/template-branch/config/install/init  2009-06-17 12:23:18 UTC 
(rev 3075)
+++ ipcop/branches/template-branch/config/install/init  2009-06-17 15:14:05 UTC 
(rev 3076)
@@ -157,7 +157,11 @@
 
        # if you want to strace, uncomment strace install in lfs/initramfs
        # and probably change to exec busybox /bin/ash
-       exec busybox init
+       if [ "x${CURRENT_TTY}" == "xtty1" ]; then
+               exec busybox init
+       else
+               exec /bin/installer < /dev/console > /dev/console
+       fi
 }
 
 

Modified: ipcop/branches/template-branch/config/rootfiles/common/ncurses
===================================================================
--- ipcop/branches/template-branch/config/rootfiles/common/ncurses      
2009-06-17 12:23:18 UTC (rev 3075)
+++ ipcop/branches/template-branch/config/rootfiles/common/ncurses      
2009-06-17 15:14:05 UTC (rev 3076)
@@ -2932,10 +2932,10 @@
 usr/share/terminfo/v/vt100-w-nam
 usr/share/terminfo/v/vt100-w-nav
 usr/share/terminfo/v/vt100nam
-#usr/share/terminfo/v/vt102
-#usr/share/terminfo/v/vt102+enq
-#usr/share/terminfo/v/vt102-nsgr
-#usr/share/terminfo/v/vt102-w
+usr/share/terminfo/v/vt102
+usr/share/terminfo/v/vt102+enq
+usr/share/terminfo/v/vt102-nsgr
+usr/share/terminfo/v/vt102-w
 #usr/share/terminfo/v/vt125
 #usr/share/terminfo/v/vt131
 #usr/share/terminfo/v/vt132


Property changes on: ipcop/branches/template-branch/config/ssl/openvpn.cnf
___________________________________________________________________
Modified: svn:mergeinfo
   - 
   + /ipcop/trunk/config/ssl/openvpn.cnf:3056-3075


Property changes on: ipcop/branches/template-branch/html/cgi-bin/openvpn.cgi
___________________________________________________________________
Modified: svn:mergeinfo
   - 
   + /ipcop/trunk/html/cgi-bin/openvpn.cgi:3056-3075


Property changes on: 
ipcop/branches/template-branch/html/html/images/openvpnzip.gif
___________________________________________________________________
Modified: svn:mergeinfo
   - 
   + /ipcop/trunk/html/html/images/openvpnzip.gif:3056-3075

Modified: ipcop/branches/template-branch/html/html/themes/default/vars.tpl
===================================================================
--- ipcop/branches/template-branch/html/html/themes/default/vars.tpl    
2009-06-17 12:23:18 UTC (rev 3075)
+++ ipcop/branches/template-branch/html/html/themes/default/vars.tpl    
2009-06-17 15:14:05 UTC (rev 3076)
@@ -1,3 +1,5 @@
 [% mytheme.colourred    = '#993333' %]
 [% mytheme.table1colour = '#C0C0C0' %]
 [% mytheme.table2colour = '#F2F2F2' %]
+[% mytheme.sortup = '<img src=\'/images/triangle_up.png\' alt=\'a-z\' />' %]
+[% mytheme.sortdn = '<img src=\'/images/triangle_down.png\' alt=\'z-a\' />' %]

Modified: ipcop/branches/template-branch/lfs/Config
===================================================================
--- ipcop/branches/template-branch/lfs/Config   2009-06-17 12:23:18 UTC (rev 
3075)
+++ ipcop/branches/template-branch/lfs/Config   2009-06-17 15:14:05 UTC (rev 
3076)
@@ -43,11 +43,8 @@
 DIR_CHK     = $(LFS_BASEDIR)/cache/check
 DIR_INFO    = $(LFS_BASEDIR)/log_$(MACHINE)
 DIR_TEST    = $(LFS_BASEDIR)/test_$(MACHINE)/$(BUILDDATE)
-DIR_TMP     = /tmp
+DIR_TMP     = $(LFS_BASEDIR)/cache/tmp
 
-#KGCC = ccache /usr/bin/gcc
-KGCC = gcc
-
 ###############################################################################
 # Common Macro Definitions
 ###############################################################################

Modified: ipcop/branches/template-branch/lfs/busybox
===================================================================
--- ipcop/branches/template-branch/lfs/busybox  2009-06-17 12:23:18 UTC (rev 
3075)
+++ ipcop/branches/template-branch/lfs/busybox  2009-06-17 15:14:05 UTC (rev 
3076)
@@ -80,7 +80,8 @@
 
 $(TARGET) : $(firstword $(MAKEFILE_LIST)) $(patsubst %,$(DIR_DL)/%,$(objects)) 
$(DIR_SRC)/config/busybox/* $(DIR_PATCHES)/busybox-*
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
-       cd $(DIR_APP) && patch -Np1 -i 
$(DIR_PATCHES)/busybox-1.14.1_modprobe.patch
+       cd $(DIR_APP) && patch -Np1 -i 
$(DIR_PATCHES)/busybox-1.14.1_modprobe.patch
+       cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/busybox-1.14.1-ash.patch
 
        cd $(DIR_APP) && cp -f $(DIR_SRC)/config/busybox/busybox.config .config
 

Modified: ipcop/branches/template-branch/lfs/initramfs
===================================================================
--- ipcop/branches/template-branch/lfs/initramfs        2009-06-17 12:23:18 UTC 
(rev 3075)
+++ ipcop/branches/template-branch/lfs/initramfs        2009-06-17 15:14:05 UTC 
(rev 3076)
@@ -101,6 +101,7 @@
        mkdir -p                                                
$(INITRAMFS_DIR)/usr/lib
        mkdir -p                                                
$(INITRAMFS_DIR)/usr/share/locale
        mkdir -p                                                
$(INITRAMFS_DIR)/usr/share/terminfo/l
+       mkdir -p                                                
$(INITRAMFS_DIR)/usr/share/terminfo/v
        mkdir -p                                                
$(INITRAMFS_DIR)/usr/share/udhcpc
        mkdir -p                                                
$(INITRAMFS_DIR)/var/run
        ln -sf bin                                              
$(INITRAMFS_DIR)/sbin
@@ -212,6 +213,7 @@
        chmod 755                                               
$(INITRAMFS_DIR)/init
        chmod 755                                               
$(INITRAMFS_DIR)/etc/halt
        cp -f /usr/share/terminfo/l/linux                       
$(INITRAMFS_DIR)/usr/share/terminfo/l
+       cp -f /usr/share/terminfo/v/vt102                       
$(INITRAMFS_DIR)/usr/share/terminfo/v
 
        # Delete the mini-initramfs init
        rm -f $(INITRAMFS_DIR)/etc/init-mini-initramfs

Modified: ipcop/branches/template-branch/make.sh
===================================================================
--- ipcop/branches/template-branch/make.sh      2009-06-17 12:23:18 UTC (rev 
3075)
+++ ipcop/branches/template-branch/make.sh      2009-06-17 15:14:05 UTC (rev 
3076)
@@ -2267,6 +2267,8 @@
                ${SUDO} ${RM} /${TOOLS_DIR}
        fi
 
+       rm -rf ${BASEDIR}/cache/tmp/*
+
        beautify message DONE
        ;;
 dist)

Modified: ipcop/branches/template-branch/src/installer/arch_defs.h
===================================================================
--- ipcop/branches/template-branch/src/installer/arch_defs.h    2009-06-17 
12:23:18 UTC (rev 3075)
+++ ipcop/branches/template-branch/src/installer/arch_defs.h    2009-06-17 
15:14:05 UTC (rev 3076)
@@ -81,6 +81,8 @@
     harddisk,                   /* possible installation target */
     flash,                      /* target */
     network,                    /* bootable (PXE), sources available (http/ftp 
server) and restore (http/ftp server) */
+    console,                    /* console: standard */
+    serial,                     /* console: serial */
     specialmodule = 100,        /* for module list only */
     unknown,
 } supported_media_t;
@@ -89,6 +91,7 @@
 extern supported_media_t medium_boot;
 extern supported_media_t medium_sources;
 extern supported_media_t medium_target;
+extern supported_media_t medium_console;
 
 struct hardware_s
 {
@@ -107,6 +110,10 @@
 extern char network_source[STRING_SIZE];        /* something like 
http://ip/path */
 extern unsigned int memtotal;   /* Total memory in MB */
 
+extern unsigned int serial_console;             /* 0 = ttyS0, 1 = ttyS1, etc. 
*/
+extern unsigned int serial_bitrate;             /* 9600, 38400, etc. */
+extern char *serial_commandline;                /* ttyS0,38400n81 */
+
 /*
     Functions implemented in hardware.c and partition.c    
 */

Modified: ipcop/branches/template-branch/src/installer/installer.c
===================================================================
--- ipcop/branches/template-branch/src/installer/installer.c    2009-06-17 
12:23:18 UTC (rev 3075)
+++ ipcop/branches/template-branch/src/installer/installer.c    2009-06-17 
15:14:05 UTC (rev 3076)
@@ -52,10 +52,16 @@
 supported_media_t medium_boot = unknown;
 supported_media_t medium_sources = none;
 supported_media_t medium_target = none;
+supported_media_t medium_console = console;
 char network_source[STRING_SIZE];
 unsigned int memtotal = 0;                  /* Total memory in MB */
 struct utsname utsbuf;
 
+unsigned int serial_console = 0;
+unsigned int serial_bitrate = 9600;
+char *serial_commandline = NULL;
+
+
 /* local variables */
 static int codepath = 0;                    /* for better test, allow testing 
dhcp and manual path even on pxe boot */
 static NODEKV *kv = NULL;                   /* contains a list key=value pairs 
from boot parameters */
@@ -746,7 +752,7 @@
     FILE *handle;
     char line[STRING_SIZE_LARGE];       //general purpose buffer
     int restore_success = SUCCESS;
-    int flag_filelogging = 0;
+    int rc;
 
     /* read the parameters from the kernel cmdline */
     if (!(handle = fopen("/proc/cmdline", "r"))) {
@@ -766,12 +772,19 @@
             exit(0);
         }
         fstderr = freopen("/dev/tty3", "w+", stderr);
+        medium_console = console;
     }
     else {
         /* Special console, do not use tty2/tty3 but temporary files. */
         flog = fopen("/tmp/flog", "w");
         fstderr = freopen("/tmp/fstderr", "w", stderr);
-        flag_filelogging = 1;
+        medium_console = serial;
+        serial_commandline = strdup(find_kv(kv, "console"));
+
+        /* serial_commandline is of format ttyS0,38400n81 */
+        /* TODO: make some better test */
+        serial_console = serial_commandline[4] - '0';
+        serial_bitrate = atoi(serial_commandline+6);
     }
 
     /* Small information about these consoles. */
@@ -914,7 +927,12 @@
     newtDrawRootText(18, 0, get_title());
     newtPushHelpLine(ipcop_gettext("TR_HELPLINE"));
     snprintf(line, STRING_SIZE_LARGE, ipcop_gettext("TR_WELCOME"), NAME);
-    newtWinMessage(get_title(), ipcop_gettext("TR_OK"), line);
+    rc = newtWinChoice(get_title(),
+                       ipcop_gettext("TR_OK"), ipcop_gettext("TR_CANCEL"),
+                       line);
+    if (rc == 2) {
+        goto EXIT;
+    }
 
     // find nics cdrom harddisk & floppies
     scan_hardware(1, nopcmcia, nousb, noscsi);
@@ -975,6 +993,16 @@
 
     write_lang_configs();
 
+    /* Some tidbits for serial console */
+    if (medium_console == serial) {
+        snprintf(line, STRING_SIZE, "echo \"ttyS%u\" >> 
/harddisk/etc/securetty", serial_console);
+        system(line);
+
+        snprintf(line, STRING_SIZE, "echo \"7:2345:respawn:/sbin/agetty -I 
'\033(K' ttyS%u %u vt102\" >> /harddisk/etc/inittab",
+            serial_console, serial_bitrate);
+        system(line);
+    }
+
     /* Offer restore here, if no restore -> launch setup later */
     restore_success = handlerestore();
 
@@ -1013,7 +1041,7 @@
 
         /* Run setup to configure remaining bits & pieces */
         snprintf(command, STRING_SIZE, "/bin/chroot /harddisk 
/usr/local/sbin/setup --install %s", 
-            flag_filelogging ? "--filelogging" : "");
+            (medium_console == serial) ? "--serial" : "");
         if (system(command))
             printf("Unable to run setup.\n");
 

Modified: ipcop/branches/template-branch/src/installer/keymap.c
===================================================================
--- ipcop/branches/template-branch/src/installer/keymap.c       2009-06-17 
12:23:18 UTC (rev 3075)
+++ ipcop/branches/template-branch/src/installer/keymap.c       2009-06-17 
15:14:05 UTC (rev 3076)
@@ -32,6 +32,7 @@
 #include <string.h>
 #include "common.h"
 #include "common_newt.h"
+#include "arch_defs.h"
 
 
 #define MAX_FILENAMES 5000
@@ -98,9 +99,11 @@
             choice = c;
     }
 
-    rc = newtWinMenu(gettext("TR_KEYBOARD_MAPPING"), 
gettext("TR_KEYBOARD_MAPPING_LONG"), 50, 5, 5, 6, displaynames,
+    /* In case of serial console we can skip this question, and simply use our 
default */
+    if (! (flag_installer && (medium_console == serial))) {
+        rc = newtWinMenu(gettext("TR_KEYBOARD_MAPPING"), 
gettext("TR_KEYBOARD_MAPPING_LONG"), 50, 5, 5, 6, displaynames,
                      &choice, gettext("TR_OK"), (flag_installer) ? 
gettext("TR_SKIP") : gettext("TR_GO_BACK"), NULL);
-
+    }
     strcpy(keymap, filenames[choice]);
 
     if (rc != 2) {

Modified: ipcop/branches/template-branch/src/installer/partition.c
===================================================================
--- ipcop/branches/template-branch/src/installer/partition.c    2009-06-17 
12:23:18 UTC (rev 3075)
+++ ipcop/branches/template-branch/src/installer/partition.c    2009-06-17 
15:14:05 UTC (rev 3076)
@@ -668,6 +668,18 @@
         mysystem(command);
     }
 
+    if (medium_console == serial) {
+        snprintf(command, STRING_SIZE, "/bin/sed -i -e 
's+SERIAL_CONSOLE+SERIAL %u %u+' /harddisk/boot/extlinux.conf", 
+                serial_console, serial_bitrate);
+        mysystem(command);
+        snprintf(command, STRING_SIZE, "/bin/sed -i -e 
's+serial_settings+console=%s+' /harddisk/boot/extlinux.conf", 
+                serial_commandline);
+        mysystem(command);
+    }
+    else {
+        mysystem("/bin/sed -i -e 's+SERIAL_CONSOLE++' 
/harddisk/boot/extlinux.conf");
+        mysystem("/bin/sed -i -e 's+serial_settings++' 
/harddisk/boot/extlinux.conf");
+    }
     if (medium_target == flash) {
         /* Add nodma, maybe others. */
         mysystem("/bin/sed -i -e 's+flashdisk_settings+nodma+' 
/harddisk/boot/extlinux.conf");

Modified: ipcop/branches/template-branch/src/installer/setup.c
===================================================================
--- ipcop/branches/template-branch/src/installer/setup.c        2009-06-17 
12:23:18 UTC (rev 3075)
+++ ipcop/branches/template-branch/src/installer/setup.c        2009-06-17 
15:14:05 UTC (rev 3076)
@@ -39,6 +39,7 @@
 
 NODEKV *kv = NULL;              // contains a list key=value pairs
 int flag_installer = 0;
+supported_media_t medium_console = console;
 char selected_locale[STRING_SIZE];
 struct utsname utsbuf;
 
@@ -62,12 +63,12 @@
         if (!strcmp(argv[i], "--install")) {
             flag_installer = 1;
         }
-        if (!strcmp(argv[i], "--filelogging")) {
-            flag_filelogging = 1;
+        if (!strcmp(argv[i], "--serial")) {
+            medium_console = serial;
         }
     }
 
-    if (flag_filelogging) {
+    if (medium_console == serial) {
         flog = fopen("/tmp/flog", "w");
         fstderr = freopen("/tmp/fstderr", "w", stderr);
     }


Property changes on: ipcop/branches/template-branch/src/libs/multilines.pl
___________________________________________________________________
Modified: svn:mergeinfo
   - /ipcop/trunk/src/libs/multilines.pl:3001-3055
   + /ipcop/trunk/src/libs/multilines.pl:3001-3075

Copied: ipcop/branches/template-branch/src/patches/busybox-1.14.1-ash.patch 
(from rev 3075, ipcop/trunk/src/patches/busybox-1.14.1-ash.patch)
===================================================================
--- ipcop/branches/template-branch/src/patches/busybox-1.14.1-ash.patch         
                (rev 0)
+++ ipcop/branches/template-branch/src/patches/busybox-1.14.1-ash.patch 
2009-06-17 15:14:05 UTC (rev 3076)
@@ -0,0 +1,13 @@
+diff -urpN busybox-1.14.1/shell/ash.c busybox-1.14.1-ash/shell/ash.c
+--- busybox-1.14.1/shell/ash.c 2009-05-27 18:00:23.000000000 +0200
++++ busybox-1.14.1-ash/shell/ash.c     2009-06-14 19:44:24.000000000 +0200
+@@ -11909,7 +11909,8 @@ find_dot_file(char *name)
+                        */
+                       return fullname;
+               }
+-              stunalloc(fullname);
++              if (fullname != name)
++                      stunalloc(fullname);
+       }
+ 
+       /* not found in the PATH */

Modified: 
ipcop/branches/template-branch/src/patches/busybox-1.14.1_modprobe.patch
===================================================================
--- ipcop/branches/template-branch/src/patches/busybox-1.14.1_modprobe.patch    
2009-06-17 12:23:18 UTC (rev 3075)
+++ ipcop/branches/template-branch/src/patches/busybox-1.14.1_modprobe.patch    
2009-06-17 15:14:05 UTC (rev 3076)
@@ -1,58 +1,113 @@
-diff --git a/modutils/modprobe.c b/modutils/modprobe.c
-index 0339ebb..41b63da 100644
---- a/modutils/modprobe.c
-+++ b/modutils/modprobe.c
-@@ -52,8 +52,9 @@ struct globals {
-       llist_t *probes; /* MEs of module(s) requested on cmdline */
-       char *cmdline_mopts; /* module options from cmdline */
-       int num_unresolved_deps;
--      /* bool. "Did we have 'symbol:FOO' requested on cmdline?" */
--      smallint need_symbols;
-+      /* 1 "Did we have 'symbol:FOO' requested on cmdline?"
-+       * 2 modprobe status */
-+      smallint modprobe_flags;
- };
- #define G (*(struct globals*)&bb_common_bufsiz1)
- #define INIT_G() do { } while (0)
-@@ -123,7 +124,7 @@ static void add_probe(const char *name)
-       if (ENABLE_FEATURE_MODUTILS_SYMBOLS
-        && strncmp(m->modname, "symbol:", 7) == 0
-       ) {
--              G.need_symbols = 1;
-+              G.modprobe_flags |= 1;
+diff -Nur busybox-1.14.1/modutils/modprobe-small.c 
busybox-1.14.2/modutils/modprobe-small.c
+--- busybox-1.14.1/modutils/modprobe-small.c   2009-05-27 18:00:23.000000000 
+0200
++++ busybox-1.14.2/modutils/modprobe-small.c   2009-06-16 23:13:53.000000000 
+0200
+@@ -656,7 +656,7 @@
+       [-b basedirectory] [forced_version]
+ depmod [-n -e -v -q -r -u] [-F kernelsyms] module1.ko module2.ko ...
+ If no arguments (except options) are given, "depmod -a" is assumed.
+-depmod will output a dependancy list suitable for the modprobe utility.
++depmod will output a dependency list suitable for the modprobe utility.
+ Options:
+     -a, --all           Probe all modules
+     -A, --quick         Only does the work if there's a new module
+diff -Nur busybox-1.14.1/modutils/modprobe.c busybox-1.14.2/modutils/modprobe.c
+--- busybox-1.14.1/modutils/modprobe.c 2009-05-27 18:01:37.000000000 +0200
++++ busybox-1.14.2/modutils/modprobe.c 2009-06-16 22:16:33.000000000 +0200
+@@ -8,12 +8,17 @@
+  * Licensed under GPLv2 or later, see file LICENSE in this tarball for 
details.
+  */
+ 
++/* Note that unlike older versions of modules.dep/depmod (busybox and m-i-t),
++ * we expect the full dependency list to be specified in modules.dep.  Older
++ * versions would only export the direct dependency list.
++ */
++
+ #include "libbb.h"
+ #include "modutils.h"
+ #include <sys/utsname.h>
+ #include <fnmatch.h>
+ 
+-//#define DBG(...) bb_error_msg(__VA_ARGS__)
++//#define DBG(fmt, ...) bb_error_msg("%s: " fmt, __func__, ## __VA_ARGS__)
+ #define DBG(...) ((void)0)
+ 
+ #define MODULE_FLAG_LOADED            0x0001
+@@ -116,6 +121,7 @@
+               return;
        }
- }
  
-@@ -203,6 +204,7 @@ static int read_config(const char *path)
++      DBG("queuing %s", name);
+       m->probed_name = name;
+       m->flags |= MODULE_FLAG_NEED_DEPS;
+       llist_add_to_end(&G.probes, m);
+@@ -134,7 +140,7 @@
+ {
+       char *tokens[3];
+       parser_t *p;
+-        struct module_entry *m;
++      struct module_entry *m;
+       int rc = TRUE;
+ 
+       if (bb_basename(filename)[0] == '.')
+@@ -203,11 +209,13 @@
                                config_file_action, NULL, NULL, 1);
  }
  
 +/* Return a value >=0 or -ENOENT if module not found in modules.dep */
  static int do_modprobe(struct module_entry *m)
  {
-       struct module_entry *m2;
-@@ -224,7 +226,9 @@ static int do_modprobe(struct module_entry *m)
+-      struct module_entry *m2;
++      struct module_entry *m2 = m2; /* for compiler */
+       char *fn, *options;
+-      int rc = -1;
++      int rc, first;
++      llist_t *l;
+ 
+       if (!(m->flags & MODULE_FLAG_FOUND_IN_MODDEP)) {
+               DBG("skipping %s, not found in modules.dep", m->modname);
+@@ -218,13 +226,25 @@
+       if (!(option_mask32 & MODPROBE_OPT_REMOVE))
+               m->deps = llist_rev(m->deps);
+ 
++      for (l = m->deps; l != NULL; l = l->link)
++              DBG("dep: %s", l->data);
++
++      first = 1;
+       rc = 0;
+       while (m->deps && rc == 0) {
+               fn = llist_pop(&m->deps);
                m2 = get_or_add_modentry(fn);
                if (option_mask32 & MODPROBE_OPT_REMOVE) {
-                       if (bb_delete_module(m->modname, O_EXCL) != 0)
+-                      if (bb_delete_module(m->modname, O_EXCL) != 0)
 -                              rc = errno;
-+                              /* silence with module already unloaded */
-+                              if (errno != ENOENT)
-+                                      rc = errno;
++                      if (m2->flags & MODULE_FLAG_LOADED) {
++                              if (bb_delete_module(m2->modname, O_EXCL) != 0) 
{
++                                      if (first)
++                                              rc = errno;
++                              } else {
++                                      m2->flags &= ~MODULE_FLAG_LOADED;
++                              }
++                      }
++                      /* do not error out if *deps* fail to unload */
++                      first = 0;
                } else if (!(m2->flags & MODULE_FLAG_LOADED)) {
                        options = m2->options;
                        m2->options = NULL;
-@@ -242,7 +246,8 @@ static int do_modprobe(struct module_entry *m)
+@@ -242,11 +262,10 @@
                free(fn);
        }
  
 -//FIXME: what if rc < 0?
-+      /* On 2.6 kernel, rc is alway >=0 (0 or errno).
-+       * On 2.4 kernel, that's EXIT_SUCCESS or EXIT_ERROR */
-       if (rc > 0 && !(option_mask32 & INSMOD_OPT_SILENT)) {
+-      if (rc > 0 && !(option_mask32 & INSMOD_OPT_SILENT)) {
++      if (rc && !(option_mask32 & INSMOD_OPT_SILENT)) {
                bb_error_msg("failed to %sload module %s: %s",
                        (option_mask32 & MODPROBE_OPT_REMOVE) ? "un" : "",
-@@ -260,7 +265,7 @@ static void load_modules_dep(void)
+-                      m->probed_name ? m->probed_name : m->modname,
++                      m2->probed_name ? m2->probed_name : m2->modname,
+                       moderror(rc)
+               );
+       }
+@@ -260,7 +279,7 @@
        char *colon, *tokens[2];
        parser_t *p;
  
@@ -61,16 +116,47 @@
         * even if the full module name is given. Returning error here
         * was making us later confuse user with this message:
         * "module /full/path/to/existing/file/module.ko not found".
-@@ -358,7 +363,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
+@@ -294,7 +313,8 @@
+                       llist_add_to(&m->deps, xstrdup(tokens[0]));
+                       if (tokens[1])
+                               string_to_llist(tokens[1], &m->deps, " ");
+-              }
++              } else
++                      DBG("skipping dep line");
+       }
+       config_close(p);
+ }
+@@ -303,7 +323,7 @@
+ int modprobe_main(int argc UNUSED_PARAM, char **argv)
+ {
+       struct utsname uts;
+-      int rc;
++      int rc = 0;
+       unsigned opt;
+       struct module_entry *me;
  
-       read_config("/etc/modprobe.conf");
-       read_config("/etc/modprobe.d");
--      if (ENABLE_FEATURE_MODUTILS_SYMBOLS && G.need_symbols)
-+      if (ENABLE_FEATURE_MODUTILS_SYMBOLS && G.modprobe_flags & 1)
-               read_config("modules.symbols");
-       load_modules_dep();
-       if (ENABLE_FEATURE_MODUTILS_ALIAS && G.num_unresolved_deps) {
-@@ -375,10 +380,12 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
+@@ -344,10 +364,12 @@
+       if (opt & (MODPROBE_OPT_INSERT_ALL | MODPROBE_OPT_REMOVE)) {
+               /* Each argument is a module name */
+               do {
++                      DBG("adding module %s", *argv);
+                       add_probe(*argv++);
+               } while (*argv);
+       } else {
+               /* First argument is module name, rest are parameters */
++              DBG("probing just module %s", *argv);
+               add_probe(argv[0]);
+               G.cmdline_mopts = parse_cmdline_module_options(argv);
+       }
+@@ -368,6 +390,7 @@
+ 
+       while ((me = llist_pop(&G.probes)) != NULL) {
+               if (me->realnames == NULL) {
++                      DBG("probing by module name");
+                       /* This is not an alias. Literal names are blacklisted
+                        * only if '-b' is given.
+                        */
+@@ -375,7 +398,7 @@
                         || !(me->flags & MODULE_FLAG_BLACKLISTED)
                        ) {
                                rc = do_modprobe(me);
@@ -79,12 +165,7 @@
                                if (rc < 0 && !(opt & INSMOD_OPT_SILENT))
                                        bb_error_msg("module %s not found",
                                                     me->probed_name);
-+                              if (rc != 0)
-+                                      G.modprobe_flags |= 2;
-                       }
-               } else {
-                       /* Probe all realnames */
-@@ -388,13 +395,17 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
+@@ -388,13 +411,19 @@
  
                                DBG("probing %s by realname %s", me->modname, 
realname);
                                m2 = get_or_add_modentry(realname);
@@ -95,8 +176,10 @@
 +                               && (!(m2->flags & MODULE_FLAG_LOADED)
 +                                      || opt & MODPROBE_OPT_REMOVE )
 +                              ) {
-+                                      if (do_modprobe(m2))
-+                                              G.modprobe_flags |= 2;
++                                      rc=do_modprobe(m2);
++                                      if (rc < 0 && !(opt & 
INSMOD_OPT_SILENT))
++                                              bb_error_msg("module %s alias 
error",
++                                                           me->modname);
 +                              }
                                free(realname);
                        } while (me->realnames != NULL);
@@ -104,5 +187,17 @@
        }
  
 -      return EXIT_SUCCESS;
-+      return (G.modprobe_flags & 2) == 2;
++      return (rc != 0);
  }
+diff -Nur busybox-1.14.1/modutils/modutils.c busybox-1.14.2/modutils/modutils.c
+--- busybox-1.14.1/modutils/modutils.c 2009-05-27 18:00:23.000000000 +0200
++++ busybox-1.14.2/modutils/modutils.c 2009-06-16 23:13:53.000000000 +0200
+@@ -57,7 +57,7 @@
+       from = bb_get_last_path_component_nostrip(filename);
+       for (i = 0; i < (MODULE_NAME_LEN-1) && from[i] != '\0' && from[i] != 
'.'; i++)
+               modname[i] = (from[i] == '-') ? '_' : from[i];
+-      modname[i] = 0;
++      modname[i] = '\0';
+ 
+       return modname;
+ }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to