2 ===================================================================
3 --- mod-usbkbd.sh (wersja 0)
4 +++ mod-usbkbd.sh (wersja 12376)
7 +SATA_RCSID='$Revision$ $Date$'
9 +# geninitrd mod: usbkbd
11 +# setup geninitrd module
16 +find_modules_usbkbd() {
17 + debug "Finding USB keyboard modules"
19 + if [ "$(echo /sys/class/input/input*)" = "/sys/class/input/input*" ]; then
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)
33 + if [ -n "$module" ]; then
34 + debug "Found USB Keyboard: $(cat $i/name)"
35 + modules="$modules $module"
40 + if [ -n "$modules" ]; then
42 + for m in $(find_modules_by_class "0c03"); do
46 + for m in $modules; do
52 ===================================================================
53 --- geninitrd (wersja 12345)
54 +++ geninitrd (kopia robocza)
56 [ "$FIRMWAREDIR" != "$firmware" ] && inst_d /lib/firmware/$FIRMWAREDIR
57 inst /lib/firmware/$firmware /lib/firmware/$firmware
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."
65 warn "/proc filesystem not mounted, may cause wrong results or failure."
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
71 while [ $# -gt 0 ]; do
74 find_module "$FBMODULE"
77 +# autodetect USB keyboards
80 # allow forcing loading SCSI and/or IDE modules
81 # XXX: where ADDSCSI cames from? drop?
82 if is_yes "$ADDSCSI"; then
84 ===================================================================
85 --- mod-luks.sh (wersja 12345)
86 +++ mod-luks.sh (kopia robocza)
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
94 if [ -n "$key" -a "x$key" != "xnone" ]; then
95 if test -e "$key" ; then
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
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
110 + done < /proc/partitions
113 + if [ -e "\$luksdev" ]; then
114 crypt_status=\$(cryptsetup status '$dst')
115 if [ "\${crypt_status%%is inactive.}" != "\$crypt_status" ]; then
117 - cryptsetup ${keyfile:+-d $keyfile} luksOpen '$src' '$dst' <&1
118 + cryptsetup ${keyfile:+-d $keyfile} luksOpen "\$luksdev" '$dst' <&1
123 ===================================================================
124 --- functions (wersja 12345)
125 +++ functions (kopia robocza)
128 printf "/dev/mapper/%s" $(dm_name "$node")
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"
137 + pcimap="/lib/modules/$kernel/modules.pcimap"
139 + lspci=$(find_tool /sbin/lspci)
140 + if [ ! -x "$lspci" ]; then
141 + warn "Failed to execute lspci. Is pciutils package installed?"
144 + # no pcimap, nothing to lookup from
145 + if [ ! -f "$pcimap" ]; then
149 + if [ -z "$lspci" ]; then
153 + set -- $($lspci -n | awk -vclass=$req_class '$2 == class":" {split($3, p, ":"); printf("0x0000%s 0x0000%s\n", p[1], p[2])}')
155 + req_class="0x${req_class}00"
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
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
174 ===================================================================
175 --- Makefile (wersja 12345)
176 +++ Makefile (kopia robocza)
178 # when making release, make sure you do it as RELEASE document describes
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
186 ===================================================================
187 --- mod-sata.sh (wersja 12345)
188 +++ mod-sata.sh (kopia robocza)
190 # setup geninitrd module
193 - lspci=$(find_tool /sbin/lspci)
195 - pcimap="/lib/modules/$kernel/modules.pcimap"
197 - if [ ! -x "$lspci" ]; then
198 - warn "Failed to execute lspci. Is pciutils package installed?"
202 -# private until only mod-sata uses the function
203 -find_modules_by_class() {
206 - # no pcimap, nothing to lookup from
207 - if [ ! -f "$pcimap" ]; then
211 - if [ -z "$lspci" ]; then
215 - set -- $($lspci -n | awk -vclass=$req_class '$2 == class":" {split($3, p, ":"); printf("0x0000%s 0x0000%s\n", p[1], p[2])}')
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
220 - [ "$(($req_class & $class_mask))" = "$(($class))" ] || continue
222 - [ "$1" = "$vendor" ] || continue
223 - # match device, allow PCI_ANY_ID
224 - [ "$2" = "$device" -o $device = $PCI_ANY_ID ] || continue
230 find_modules_sata() {
231 debug "Finding SATA modules (class=0x0106)"