Changeset 1922 in MondoRescue for branches/2.2.6


Ignore:
Timestamp:
Apr 17, 2008, 12:32:36 PM (16 years ago)
Author:
Bruno Cornec
Message:
  • MakeModuleLoadingScript (mindi), MyInsmod, InsertEssentialModules (init) removed
  • Simplification of modules handling when not using udev, which makes code cleaner and more common with the udev code.
  • Usage of modprobe systematically.
  • Do not mess with modules.conf anymore. Just use what is in deplist.txt
Location:
branches/2.2.6
Files:
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.6/mindi/deplist.txt

    r1902 r1922  
    2525
    2626#-------------------------------- ESSENTIAL -----------------------------------
    27 fstab raidtab modules.conf conf.modules mondorestore modules.conf.local
     27fstab raidtab
     28/usr/sbin/mondorestore
    2829/etc/mdadm/mdadm.conf /etc/mdadm.conf
    2930/sbin/ldconfig
     
    3334bzip2 bunzip2 lzop
    3435ctrlaltdel
    35 # Do not remove as they need to be aligned with the kernel
    36 insmod lsmod
     36# Everything needed to handle modules correctly
     37insmod lsmod /sbin/modprobe
     38/etc/modprobe.d /etc/modprobe.conf /etc/modules.conf /etc/conf.modules /etc/modules.conf.local
     39
    3740hosts host.conf resolv.conf hosts.allow hosts.deny nsswitch.conf
    3841klogd sysklogd
     
    5962# gdb valgrind /usr/lib/valgrind
    6063
    61 #----------------- For all you LVM users out there, much love -----------------
    62 LVMFILES:
    63 lvmiopversion lvchange lvcreate lvdisplay lvextend lvmchange lvmcreate_initrd lvmdiskscan lvmsadc lvmsar lvreduce lvremove lvrename lvscan pvchange pvcreate pvdata pvdisplay pvmove pvscan vgcfgbackup vgcfgrestore vgchange vgck vgcreate vgdisplay vgexport vgextend vgimport vgmerge vgmknodes vgreduce vgremove vgrename vgscan vgsplit liblvm lvm lvm-10 /etc/lvm/lvm.conf
    64 #------------------------------------------------------------------------------
    6564#
    6665# Proliant extended support if available
     
    6867conrep cpqacuxe hponcfg
    6968lshw
     69#----------------- For all you LVM users out there, much love -----------------
     70LVMFILES:
     71lvmiopversion lvchange lvcreate lvdisplay lvextend lvmchange lvmcreate_initrd lvmdiskscan lvmsadc lvmsar lvreduce lvremove lvrename lvscan pvchange pvcreate pvdata pvdisplay pvmove pvscan vgcfgbackup vgcfgrestore vgchange vgck vgcreate vgdisplay vgexport vgextend vgimport vgmerge vgmknodes vgreduce vgremove vgrename vgscan vgsplit liblvm lvm lvm-10 /etc/lvm/lvm.conf
     72#------------------------------------------------------------------------------
  • branches/2.2.6/mindi/mindi

    r1919 r1922  
    10691069
    10701070
    1071 MakeModuleLoadingScript() {
    1072     local module fname params modpath kver outerloop i modpaths kver searchpath list_to_echo j
    1073     tmpmodprobe_flag=$1
    1074     outfile=$2
    1075     > $outfile || Die "Cannot create empty $outfile"
    1076     echo -en "#\041/bin/sh\n\n" >> $outfile
    1077     echo "echo -en \"Loading your modules...\"" >> $outfile
    1078     if [ "$YOUR_KERNEL_SUCKS" ] ; then
    1079         kver=$FAILSAFE_KVER
    1080         cd $MINDI_TMP
    1081         searchpath=lib/modules/$kver
    1082     else
    1083 ###
    1084 ### Sq-Modification ... Use kernelname for module search path if specified
    1085 ###
    1086         #kver=`uname -r`
    1087         if [ "${kernelname}" != "" ]
    1088         then
    1089             kver=${kernelname}
    1090         else
    1091             kver=`uname -r`
    1092         fi
    1093 ###
    1094 ### Sq-Modification end
    1095 ###
    1096         searchpath=/lib/modules/$kver
    1097     fi
    1098    
    1099     echo -en "for outerloop in 1 2 3 4 5 ; do\necho -en \".\"\n" >> $outfile
    1100     list_to_echo="$MODULES"
    1101     # Remove unwanted modules from list
    1102     for i in $DENY_MODS; do
    1103         list_to_echo=`echo ${list_to_echo} | tr ' ' '\n' | grep -Ev "^${i}$" | tr '\n' ' '`
    1104         EXTRA_MODS=`echo ${EXTRA_MODS} | tr ' ' '\n' | grep -Ev "^${i}$" | tr '\n' ' '`
    1105     done
    1106 
    1107     # Make temporary modprobe.conf file if we are told so
    1108     if [ "$tmpmodprobe_flag" = "Y" ] ; then
    1109         infile="$MINDI_TMP/modprobe.conf.mindi"
    1110         find /etc/modprobe.d -maxdepth 1 -name "*" -xtype f -print0 | xargs -0 cat > $infile
    1111     else
    1112         infile="/etc/modules.conf"
    1113     fi
    1114 
    1115     for module in $list_to_echo $EXTRA_MODS ; do
    1116         params=`sed -n "s/^options \\+$module \\+//p" $infile`
    1117         modpaths=`FindSpecificModuleInPath $searchpath $module`
    1118         for i in $modpaths ; do
    1119             echo "MyInsmod $i $params > /dev/null 2> /dev/null" \
    1120                 | tr '.' '#' \
    1121                 | sed s/#o#gz/#o/ \
    1122                 | sed s/#o#gz/#o/ \
    1123                 | sed s/#ko#gz/#ko/ \
    1124                 | sed s/#ko#gz/#ko/ \
    1125                 | tr '#' '.' >> $outfile
    1126             echo -en "$i added to module list.\n" >> $LOGFILE
    1127         done
    1128     done
    1129     echo -en "done\n" >> $outfile
    1130     echo "echo \"Done.\"" >> $outfile
    1131     chmod +x $outfile
    1132     cd /
    1133     # Remove temporary modprobe.conf file if we have created one
    1134     if [ "$tmpmodprobe_flag" = "Y" ] ; then
    1135         rm -f $infile
    1136     fi
    1137 }
    1138 
    1139 
    11401071MakeMountlist() {
    11411072    local scratchdir mountlist all_partitions current_partition \
     
    25552486    cd $old_pwd
    25562487    echo -en "..."
    2557     MakeModuleLoadingScript $TMPMODPROBE_FLAG $mountpoint/sbin/insert-all-my-modules
    2558     echo -en "..."
    25592488    old_pwd=`pwd`
    25602489    if [ "$YOUR_KERNEL_SUCKS" ] ; then
     
    27222651echo "-----------------------------" >> $LOGFILE
    27232652
    2724 if [ -e "/etc/conf.modules" ] && [ ! -e "/etc/modules.conf" ] ; then
    2725     LogIt "WARNING - Ancient distro detected." 1
    2726     ln -sf /etc/conf.modules /etc/modules.conf
    2727 fi
    27282653[ -e "/sbin/mkdosfs" ] && [ ! -e "/sbin/mkfs.vfat" ] && ln -sf /sbin/mkdosfs /sbin/mkfs.vfat
    27292654
     
    27602685
    27612686[ "`uname -r | grep "2.4.[0-6]" | grep -v "2.4.[0-9][0-9]"`" != "" ] &&  echo "WARNING! Your kernel may have buggy loopfs code. Consider upgrading to 2.4.7"
    2762 # If we have a 2.6 kernel, the system uses module-init-tools which means that we
    2763 # may have the modprobe configuration spread out across multiple files in
    2764 # directory /etc/modprobe.d. If this is the case we concatenate these files into
    2765 # a temporary file for further processing. Otherwise we continue in the standard
    2766 # way. Note further that in case /etc/modprobe.d exists, we use it and ignore
    2767 # /etc/modprobe.conf which is exactly what module-init-tools does. The temporary
    2768 # modprobe.conf file is created in MakeModuleLoadingScript. AL041128.
    2769 if [ -d "/etc/modprobe.d" ] && [ "`uname -r | cut -c1-3`" = "2.6" ] ; then
    2770     TMPMODPROBE_FLAG="Y"
    2771 else
    2772     TMPMODPROBE_FLAG="N"
    2773     [ -e "/etc/modprobe.conf" ] && [ ! -e "/etc/modules.conf" ] && ln -sf /etc/modprobe.conf /etc/modules.conf
    2774     [ ! -e "/etc/modules.conf" ] && Die "/etc/modules.conf not found; you may have to create a softlink from /etc/conf.modules to /etc/modules.conf; of course, all good distros use modules.conf anyway..."
    2775 fi
    27762687
    27772688# Update the PATH variable if incomplete
  • branches/2.2.6/mindi/rootfs/sbin/init

    r1910 r1922  
    7979    openvt 7 /bin/sh /sbin/wait-for-petris
    8080    openvt 8 /usr/bin/tail -f $LOGFILE
     81    # May avoid shell error messages
     82    chmod 666 /dev/tty* /dev/console
    8183}
    8284
     
    162164    fi
    163165    echo "Activating a potential USB Storage device"
    164     if [ -f usb-storage.ko ] || [ -f usb-storage.ko.gz ]; then
    165         if [ -e "/tmp/USE-UDEV" ] ; then
    166             modprobe -q usb-storage
    167         else
    168             insmod usb-storage.ko*
    169         fi
    170     fi
     166    modprobe -q usb-storage
    171167    for i in 1 2 3 4 5 6 7 8 9 10 ; do
    172168        sleep 1
     
    199195HowMuchFreeSpaceOnRamdisk() {
    200196   df -m -P | grep /dev/ram | head -n1 | tr -s '\t' ' ' | cut -d' ' -f4
    201 }
    202 
    203 
    204 
    205 InsertEssentialModules() {
    206 #   Load the VIA IDE module first thing if it exists (requires ide-core).
    207 #   This is to ensure that DMA is working for VIA chipsets with 2.6 kernels.
    208     for module in /ide-core.ko* /via82cxxx.ko*; do
    209         [ -f "$module" ] && MyInsmod $module > /dev/null 2> /dev/null
    210     done
    211 #   Then load the remaining modules in normal (i.e. arbitrary) order.
    212     for j in 1 2 3 4 5 ; do
    213         for i in `ls /*.*o* 2> /dev/null` ; do
    214             [ -f "$i" ] && MyInsmod $i > /dev/null 2> /dev/null
    215         done
    216     done
    217197}
    218198
     
    314294    fi
    315295    create_dev_makedev
    316     # May avoid shell error messages
    317     chmod 644 /dev/tty*
    318296    if [ -x /sbin/udevsettle ]; then
    319297        /sbin/udevsettle
     
    389367    return
    390368fi
    391 if [ -e "/tmp/USE-UDEV" ] ; then
    392     if [ -f uhcd_hci.ko ] || [ -f uhcd_hci.ko.gz ]; then
    393         modprobe -q uhcd_hci
    394     fi
    395     if [ -f usbhid.ko ] || [ -f usbhid.ko.gz ]; then
    396         modprobe -q usbhid
    397     fi
    398 else
    399     if [ -f uhcd_hci.ko ]; then
    400         insmod uhcd_hci.ko
    401     fi
    402     if [ -f usbhid.ko ]; then
    403         insmod usbcore.ko
    404         insmod usbhid.ko
    405     fi
    406 fi
     369modprobe -q uhcd_hci
     370modprobe -q usbhid
    407371}
    408372
     
    413377        LogIt "Scanning LVM's..." 1
    414378        if which lvm ; then
    415             MyInsmod dm-mod
    416             MyInsmod dm_mod
     379            modprobe -q dm-mod
     380            modprobe -q dm_mod
    417381            lvm vgscan --mknodes
    418382        else
     
    566530ModprobeAllModules() {
    567531
    568     for m in `find /lib/modules -name '*.ko*'`; do
     532    for m in `find /lib/modules -name '*\.ko*' -o -name '*\.o*'`; do
    569533        j=`basename $m | sed 's/\.ko.*$//'`
     534        j=`basename $m | sed 's/\.o.*$//'`
    570535        echo "$DENY_MODS" | grep -q "$j "
    571536        if [ $? -eq 0 ]; then
     
    584549    PKLVL=`cut -f1 /proc/sys/kernel/printk`
    585550    echo 0 > /proc/sys/kernel/printk
    586     if [ ! -e "/tmp/USE-UDEV" ] ; then
    587         echo "Inserting modules ..."
    588         insert-all-my-modules >> $LOGFILE 2>> $LOGFILE
    589         for i in $FORCE_MODS; do
    590             MyInsmod $i
    591         done
    592     else
    593         ModprobeAllModules
    594     fi
     551    ModprobeAllModules
    595552    echo $PKLVL > /proc/sys/kernel/printk
    596553}
     
    654611PKLVL=`cut -f1 /proc/sys/kernel/printk`
    655612echo 0 > /proc/sys/kernel/printk
    656 if [ ! -e "/tmp/USE-UDEV" ] ; then
    657     InsertEssentialModules
    658 else
    659     ModprobeAllModules
    660 fi
     613ModprobeAllModules
    661614echo $PKLVL > /proc/sys/kernel/printk
    662615
  • branches/2.2.6/mondo/src/common/libmondo-tools.c

    r1919 r1922  
    11/* libmondo-tools.c                                  misc tools
    22   $Id$
    3 .
    4 
    5 
    6 06/28
    7 - abort if RAID partitions found but /etc/raidtab not found
    8 
    9 06/25
    10 - don't insist on ms-sys; recommend it
    11 - don't fatal_error if can't open log file
    12 
    13 06/14
    14 - call mindi -V before calling mindi --makemountlist
    15 
    16 04/09
    17 - lots of malloc'd char*'s instead of char[]'s in post_param_config'n
    18 
    19 04/02
    20 - better sanity-checking, re: /etc/modules.conf
    21 
    22 02/15
    23 - abort if Windows dir but no ms-sys or parted
    24 
    25 02/08
    26 - missing ramdisk/initrd support is nonfatal now (but stupid)
    27 
    28 01/16
    29 - added g_kernel_version and get_kernel_version()
    30 
    31 01/08/2004
    32 - fixed /boot mounter thingy
    33 
    34 11/14/2003
    35 - if <50MB free in /root, softlink /root/images/mindi to
    36   /home/root/images/mindi as a workaround
    37 
    38 10/23
    39 - streaming backups now generate 4MB sets; CDs, 8MB sets
    40 
    41 10/21
    42 - better at finding your /boot in order to mount it, if nec.
    43 - link /etc/modules.conf to /etc/conf.modules if former
    44   is missing but latter is not
    45 - changed "/mnt/cdrom" to MNT_CDROM
    46 - changed "/mnt/floppy" to MNT_FLOPPY
    47 
    48 10/13
    49 - added stop_magicdev_if_necessary()
    50 - added restart_magicdev_if_necessary()
    51 
    52 10/02
    53 - don't eject if bkpinfo->please_dont_eject is TRUE
    54 
    55 09/28
    56 - fixed segfault in mount_..._necessary
    57 
    58 09/26
    59 - ask for cmp (or create workaround if possible)
    60 
    61 09/25
    62 - add DVD support
    63 
    64 09/24
    65 - don't overwrite existing media-dev value in bkpinfo IF it's
    66   a tape device AND it's already populated by /dev/{something}
    67   ...This helps w/ weird tape drives
    68 
    69 09/23
    70 - malloc/free global strings in new subroutines - malloc_libmondo_global_strings()
    71   and free_libmondo_global_strings() - which are in libmondo-tools.c
    72 
    73 09/18
    74 - added stop_autofs_if_necessary() and restart_autofs_if_necessary()
    75 
    76 09/13
    77 - added log_debug_msg()
    78 - turned log_it() into a macro
    79 
    80 09/10
    81 - reduced PPCFG_RAMDISK to 150m (was 200m)
    82 - max set size is now 8MB (was 6)
    83 - added 'buffer' to requisite tools
    84 
    85 08/29
    86 - typical set size is now 5MB
    87    
    88 07/22
    89 - increased PPCFG* to 200m
    90 
    91 05/07
    92 - changed grep -m1 to grep | head -n1 for Debian users
    93 - pre_param_...() also mkdir -p /mnt/cdrom, just in case
    94 
    95 05/05
    96 - cleaner logging of call to dd if=<tape> of=/dev/null
    97 - added Joshua Oreman's FreeBSD patches
    98 
    99 05/04
    100 - added Herman Kuster's multi-level bkp patch
    101 
    102 05/02
    103 - log_it() --- "Message repeated N times" (if it was)
    104 
    105 04/24
    106 - added lots of assert()'s and log_OS_error()'s
    107 - reset_bkpinfop() --- reset all media_size[] array
    108 - increased tmpfs ramdisk to size=100m
    109 
    110 04/22
    111 - post_param_configuration() --- store iso-dev and isodir
    112 
    113 04/05
    114 - re-enable tmpfs ramdisk/mountpt _but_ make sure size=80m
    115 - in post_param_configuration(), use cdrecord in preference
    116   to dvdrecord now
    117 
    118 03/27
    119 - disabled tmpfs ramdisk/mountpt
    120 
    121 01/02/2003
    122 - bkpinfo->makefilelist = TRUE
    123 
    124 12/10/2002
    125 - added g_loglevel
    126 - fixed minor bug in clean_up_KDE_desktop_if_necessary()
    127 - log versions of newt, slang, ncurses
    128 - isodir defaults to / if disaster recovery
    129 
    130 11/28
    131 - unmount all CD devices at start
    132 - added clean_up_KDE_desktop_if_necessary()
    133 
    134 11/20
    135 - don't use lilo.conf.anaconda; abort instead
    136 - mount/unmount /boot partition for Gentoo 1.2 users
    137 
    138 11/13
    139 - call mindi --makemountlist as part of testing sanity of distro
    140 
    141 11/08
    142 - added a couple of chmod 700's (one for scratchdir, one for tmpdir)
    143   to post_param_configuration()
    144 
    145 10/01 - 10/31
    146 - added checking of / and /root's free space to some_basic_sanity_checks()
    147 - moved some subroutines here from common/libmondo-archive
    148 
    149 09/01 - 09/30
    150 - don't write log_it()'s string to stdout, even if text mode
    151 - tell user the kernel is bad if it has no ramdisk support but allow
    152   it if they want to use the failsafe kernel for booting
    153 - run_program_and_log_output() now takes boolean operator to specify
    154   whether it will log its activities in the event of _success_
    155 - if mkfs.vfat not found but mkfs.msdos found then create a softlink
    156   from the former to the latter
    157 
    158 08/01 - 08/31
    159 - if /etc/lilo.conf not found not /etc/lilo.conf.anaconda found
    160   then create a softlink from the former to the latter, to work
    161   around RH7.3's b0rken LILO support
    162 - handle unknown media size
    163 
    164 07/27
    165 - created
    1663*/
    1674
     
    1100937 * - make sure afio, cdrecord, mkisofs, bzip2, awk, md5sum, strings, mindi, and buffer exist
    1101938 * - make sure CD-ROM is unmounted
    1102  * - make sure /etc/modules.conf exists
    1103939 * - make sure user's mountlist is OK by running <tt>mindi --makemountlist</tt>
    1104940 *
     
    12111047        }
    12121048    }
    1213 #ifndef __FreeBSD__
    1214     if (!does_file_exist("/etc/modules.conf")) {
    1215         if (does_file_exist("/etc/conf.modules")) {
    1216             log_it("Linking /etc/modules.conf to /etc/conf.modules");
    1217             run_program_and_log_output
    1218                 ("ln -sf /etc/conf.modules /etc/modules.conf", 5);
    1219         } else if (does_file_exist("/etc/modprobe.d")) {
    1220             log_it
    1221                 ("Directory /etc/modprobe.d found. mindi will use its contents.");
    1222         } else if (does_file_exist("/etc/modprobe.conf")) {
    1223             log_it("Linking /etc/modules.conf to /etc/modprobe.conf");
    1224             run_program_and_log_output
    1225                 ("ln -sf /etc/modprobe.conf /etc/modules.conf", 5);
    1226         } else {
    1227             retval++;
    1228             log_to_screen
    1229                 ("Please find out what happened to /etc/modules.conf");
    1230         }
    1231     }
    1232 #endif
    12331049
    12341050    run_program_and_log_output("cat /etc/fstab", 5);
Note: See TracChangeset for help on using the changeset viewer.