]> git.pld-linux.org Git - packages/geninitrd.git/blob - geninitrd-svn.patch
- changes from trunk; rel 1.1 for now (testing purposes)
[packages/geninitrd.git] / geninitrd-svn.patch
1 Index: mod-usbkbd.sh
2 ===================================================================
3 --- mod-usbkbd.sh       (wersja 0)
4 +++ mod-usbkbd.sh       (wersja 12376)
5 @@ -0,0 +1,45 @@
6 +#!/bin/sh
7 +SATA_RCSID='$Revision$ $Date$'
8 +
9 +# geninitrd mod: usbkbd
10 +
11 +# setup geninitrd module
12 +# @access      public
13 +setup_mod_usbkbd() {
14 +}
15 +
16 +find_modules_usbkbd() {
17 +       debug "Finding USB keyboard modules"
18 +
19 +       if [ "$(echo /sys/class/input/input*)" = "/sys/class/input/input*" ]; then
20 +               return
21 +       fi
22 +
23 +       local modules
24 +
25 +       for i in /sys/class/input/input*; do
26 +               [ ! -f $i/device/bInterfaceClass -o ! -f $i/device/bInterfaceProtocol ] && continue
27 +               bInterfaceClass=$(cat $i/device/bInterfaceClass)
28 +               bInterfaceProtocol=$(cat $i/device/bInterfaceProtocol)
29 +               if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" ]; then
30 +                       module=$(readlink $i/device/driver/module)
31 +                       module=$(basename $module)
32 +
33 +                       if [ -n "$module" ]; then
34 +                               debug "Found USB Keyboard: $(cat $i/name)"
35 +                               modules="$modules $module"
36 +                       fi
37 +               fi
38 +       done
39 +
40 +       if [ -n "$modules" ]; then
41 +               # usb controllers
42 +               for m in $(find_modules_by_class "0c03"); do
43 +                       find_module $m
44 +               done
45 +
46 +               for m in $modules; do
47 +                       find_module $m
48 +               done
49 +       fi
50 +}
51 Index: geninitrd
52 ===================================================================
53 --- geninitrd   (wersja 12345)
54 +++ geninitrd   (kopia robocza)
55 @@ -613,7 +613,7 @@
56                         [ "$FIRMWAREDIR" != "$firmware" ] && inst_d /lib/firmware/$FIRMWAREDIR
57                         inst /lib/firmware/$firmware /lib/firmware/$firmware
58                 else
59 -                       die "firmware file /lib/firmware/$firmware nor /lib/firmware/$kernel/$firmware found."
60 +                       warn "Possible missing firmware file /lib/firmware/$firmware or /lib/firmware/$kernel/$firmware for module $module."
61                 fi
62         done
63  
64 @@ -915,7 +915,7 @@
65         warn "/proc filesystem not mounted, may cause wrong results or failure."
66  fi
67  
68 -geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi
69 +geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd
70  
71  while [ $# -gt 0 ]; do
72         case $1 in
73 @@ -1157,6 +1157,9 @@
74         find_module "$FBMODULE"
75  fi
76  
77 +# autodetect USB keyboards
78 +find_modules_usbkbd
79 +
80  # allow forcing loading SCSI and/or IDE modules
81  # XXX: where ADDSCSI cames from? drop?
82  if is_yes "$ADDSCSI"; then
83 Index: mod-luks.sh
84 ===================================================================
85 --- mod-luks.sh (wersja 12345)
86 +++ mod-luks.sh (kopia robocza)
87 @@ -119,7 +119,7 @@
88  
89         while read dst src key opt; do
90                 [ -z "$dst" -o "${dst#\#}" != "$dst" ] && continue
91 -               [ "$src" != "$LUKSDEV" ] && continue
92 +               [ "$src" != "$LUKSDEV" ] && [ "$(readlink -f $src)" != "$LUKSDEV" ] && continue
93  
94                 if [ -n "$key" -a "x$key" != "xnone" ]; then
95                         if test -e "$key" ; then
96 @@ -155,11 +155,23 @@
97                         # cryptsetup can be called twice and in case on crypt on lvm only second
98                         # will succeed because there will be no src device in first cryptsetup call
99                         # this can be called multiple times, before lvm and after lvm.
100 -                       if [ -e "$src" ]; then
101 +                       luksdev='$src'
102 +                       if [ \${luksdev##/dev/disk/by-uuid/} != \${luksdev} ]; then
103 +                               src_uuid=\${luksdev##/dev/disk/by-uuid/}
104 +                               while read x y z name; do
105 +                                       found_uuid=\$(cryptsetup luksUUID /dev/\${name} 2>/dev/null)
106 +                                       if [ "\$found_uuid" = "\$src_uuid" ]; then
107 +                                               luksdev=/dev/\$name
108 +                                               break
109 +                                       fi
110 +                               done < /proc/partitions
111 +                       fi
112 +
113 +                       if [ -e "\$luksdev" ]; then
114                                 crypt_status=\$(cryptsetup status '$dst')
115                                 if [ "\${crypt_status%%is inactive.}" != "\$crypt_status" ]; then
116                                         # is inactive
117 -                                       cryptsetup ${keyfile:+-d $keyfile} luksOpen '$src' '$dst' <&1
118 +                                       cryptsetup ${keyfile:+-d $keyfile} luksOpen "\$luksdev" '$dst' <&1
119                                 fi
120                         fi
121  
122 Index: functions
123 ===================================================================
124 --- functions   (wersja 12345)
125 +++ functions   (kopia robocza)
126 @@ -166,3 +166,46 @@
127         local node="$1"
128         printf "/dev/mapper/%s" $(dm_name "$node")
129  }
130 +
131 +# find modules by class eg
132 +# find_modules_by_class 0106 - finds modules for SATA devices in the system
133 +# find_modules_by_class 0c03 - finds modules for USB controllers
134 +find_modules_by_class() {
135 +       local req_class="$1"
136 +
137 +       pcimap="/lib/modules/$kernel/modules.pcimap"
138 +
139 +       lspci=$(find_tool /sbin/lspci)
140 +       if [ ! -x "$lspci" ]; then
141 +               warn "Failed to execute lspci. Is pciutils package installed?"
142 +       fi
143 +
144 +       # no pcimap, nothing to lookup from
145 +       if [ ! -f "$pcimap" ]; then
146 +               return
147 +       fi
148 +
149 +       if [ -z "$lspci" ]; then
150 +               return
151 +       fi
152 +
153 +       set -- $($lspci -n | awk -vclass=$req_class '$2 == class":" {split($3, p, ":"); printf("0x0000%s 0x0000%s\n", p[1], p[2])}')
154 +
155 +       req_class="0x${req_class}00"
156 +
157 +       local PCI_ANY_ID=0xffffffff pci_module vendor device subvendor subdevice class class_mask driver_data
158 +       while read pci_module vendor device subvendor subdevice class class_mask driver_data; do
159 +               # ignore program interface (last two digits) - we want any
160 +               class_mask=$(($class_mask & 0xffffff00))
161 +               # some devices (like hcd) have very specific class
162 +               class=$(($class & $class_mask))
163 +               [ "$(($req_class & $class_mask))" = "$class" ] || continue
164 +               # match vendor
165 +               [ "$1" = "$vendor" -o "$vendor" = "$PCI_ANY_ID" ] || continue
166 +               # match device, allow PCI_ANY_ID
167 +               [ "$2" = "$device" -o "$device" = "$PCI_ANY_ID" ] || continue
168 +
169 +               echo "$pci_module"
170 +       done < $pcimap
171 +}
172 +
173 Index: Makefile
174 ===================================================================
175 --- Makefile    (wersja 12345)
176 +++ Makefile    (kopia robocza)
177 @@ -1,6 +1,6 @@
178  # when making release, make sure you do it as RELEASE document describes
179  VERSION                := 12345
180 -MODS           := ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi
181 +MODS           := ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd
182  FILES_MODS  := $(MODS:%=mod-%.sh)
183  FILES_ADDON := extract-ikconfig
184  FILES          := Makefile geninitrd.sysconfig geninitrd functions $(FILES_MODS) $(FILES_ADDON) geninitrd.8 geninitrd.8.xml ChangeLog
185 Index: mod-sata.sh
186 ===================================================================
187 --- mod-sata.sh (wersja 12345)
188 +++ mod-sata.sh (kopia robocza)
189 @@ -6,43 +6,8 @@
190  # setup geninitrd module
191  # @access      public
192  setup_mod_sata() {
193 -       lspci=$(find_tool /sbin/lspci)
194 -
195 -       pcimap="/lib/modules/$kernel/modules.pcimap"
196 -
197 -       if [ ! -x "$lspci" ]; then
198 -               warn "Failed to execute lspci. Is pciutils package installed?"
199 -       fi
200  }
201  
202 -# private until only mod-sata uses the function
203 -find_modules_by_class() {
204 -       local req_class=$1
205 -
206 -       # no pcimap, nothing to lookup from
207 -       if [ ! -f "$pcimap" ]; then
208 -               return
209 -       fi
210 -
211 -       if [ -z "$lspci" ]; then
212 -               return
213 -       fi
214 -
215 -       set -- $($lspci -n | awk -vclass=$req_class '$2 == class":" {split($3, p, ":"); printf("0x0000%s 0x0000%s\n", p[1], p[2])}')
216 -
217 -       local PCI_ANY_ID=0x0000ffff pci_module vendor device subvendor subdevice class class_mask driver_data
218 -       while read pci_module vendor device subvendor subdevice class class_mask driver_data; do
219 -               # match class
220 -               [ "$(($req_class & $class_mask))" = "$(($class))" ] || continue
221 -               # match vendor
222 -               [ "$1" = "$vendor" ] || continue
223 -               # match device, allow PCI_ANY_ID
224 -               [ "$2" = "$device" -o $device = $PCI_ANY_ID ] || continue
225 -
226 -               echo "$pci_module"
227 -       done < $pcimap
228 -}
229 -
230  find_modules_sata() {
231         debug "Finding SATA modules (class=0x0106)"
232  
This page took 0.061051 seconds and 3 git commands to generate.