[arch-commits] Commit in hwdetect/repos/extra-any (4 files)
Tobias Powalowski
tpowa at nymeria.archlinux.org
Mon Oct 7 20:46:55 UTC 2013
Date: Monday, October 7, 2013 @ 22:46:54
Author: tpowa
Revision: 196176
archrelease: copy trunk to extra-any
Added:
hwdetect/repos/extra-any/PKGBUILD
(from rev 196175, hwdetect/trunk/PKGBUILD)
hwdetect/repos/extra-any/hwdetect
(from rev 196175, hwdetect/trunk/hwdetect)
Deleted:
hwdetect/repos/extra-any/PKGBUILD
hwdetect/repos/extra-any/hwdetect
----------+
PKGBUILD | 38 +--
hwdetect | 738 +++++++++++++++++++++++++++++++------------------------------
2 files changed, 404 insertions(+), 372 deletions(-)
Deleted: PKGBUILD
===================================================================
--- PKGBUILD 2013-10-07 20:46:43 UTC (rev 196175)
+++ PKGBUILD 2013-10-07 20:46:54 UTC (rev 196176)
@@ -1,19 +0,0 @@
-# $Id$
-# Maintainer: Tobias Powalowski <tpowa at archlinux.org>
-pkgname=hwdetect
-pkgver=2013.08
-pkgrel=2
-pkgdesc="Hardware detection script with loading modules and mkinitcpio.conf / rc.conf support"
-arch=(any)
-license=('GPL')
-depends=('sh' 'awk' 'grep' 'coreutils' 'sed' 'e2fsprogs')
-optdepends=('cryptsetup: for encrypt mkinitcpio config support'
- 'dmraid: for dmraid mkinitcpio config support'
- 'lvm2: for lvm2 mkinitcpio config support'
- 'mdadm: for raid mkinitcpio config support')
-source=(hwdetect)
-
-package() {
- install -D -m 755 "${srcdir}/hwdetect" "${pkgdir}/usr/bin/hwdetect"
-}
-md5sums=('1ffabf5db0f3b98336045a5ba1580454')
Copied: hwdetect/repos/extra-any/PKGBUILD (from rev 196175, hwdetect/trunk/PKGBUILD)
===================================================================
--- PKGBUILD (rev 0)
+++ PKGBUILD 2013-10-07 20:46:54 UTC (rev 196176)
@@ -0,0 +1,19 @@
+# $Id$
+# Maintainer: Tobias Powalowski <tpowa at archlinux.org>
+pkgname=hwdetect
+pkgver=2013.10
+pkgrel=1
+pkgdesc="Hardware detection script with loading modules and mkinitcpio.conf / rc.conf support"
+arch=(any)
+license=('GPL')
+depends=('sh' 'awk' 'grep' 'coreutils' 'sed' 'e2fsprogs')
+optdepends=('cryptsetup: for encrypt mkinitcpio config support'
+ 'dmraid: for dmraid mkinitcpio config support'
+ 'lvm2: for lvm2 mkinitcpio config support'
+ 'mdadm: for raid mkinitcpio config support')
+source=(hwdetect)
+
+package() {
+ install -D -m 755 "${srcdir}/hwdetect" "${pkgdir}/usr/bin/hwdetect"
+}
+md5sums=('f17349465e2d5b2133d78d621988b31e')
Deleted: hwdetect
===================================================================
--- hwdetect 2013-10-07 20:46:43 UTC (rev 196175)
+++ hwdetect 2013-10-07 20:46:54 UTC (rev 196176)
@@ -1,353 +0,0 @@
-#! /bin/sh
-# Autodetection script for scanning /sys for hardware
-# for Archlinux by Tobias Powalowski <tpowa at archlinux.org>
-usage () {
- echo "$0 [options]"
- echo ""
- echo " This is a tool that detects/lists modules that are exported by /sys"
- echo ""
- echo " Options:"
- echo " --kernel_version= use kernel version (no autodetect)"
- echo " --kernel_directory= use kernel module directory (no autodetect)"
- echo " --load-modules load all detected modules"
- echo " --unload-modules unload all detected modules"
- echo " --show-modules show all detected modules"
- echo " --show-modules-order shows load order of detected modules"
- echo " --show-agp show AGP modules"
- echo " --show-acpi show ACPI modules"
- echo " --show-block show BLOCK DEVICE modules"
- echo " --show-net show NETWORK modules"
- echo " --show-drm show DRM modules"
- echo " --show-input show INPUT modules"
- echo " --show-irda show IRDA modules"
- echo " --show-isdn show ISDN modules"
- echo " --show-pcmcia show PCMCIA modules"
- echo " --show-sound show SOUND modules"
- echo " --show-staging show STAGING modules"
- echo " --show-other show OTHER modules"
- echo ""
- echo " For /etc/mkinitcpio.conf use:"
- echo " --filesystem add filesystems to MODULES="
- echo " --hostcontroller show MODULES= for all hostcontrollers"
- echo " --ati-kms add ati kernel mode setting"
- echo " --intel-kms add intel kernel mode setting"
- echo " --nvidia-kms add nvidia kernel mode setting"
- echo ""
- echo " --rootdevice= autodetected advanced features of rootdevice"
- echo " --hooks-dir= use this directory for HOOKS check"
- echo " --advanced show autodetected advanced HOOKS"
- echo " --hooks show HOOKS="
- echo " --dmraid add dmraid to HOOKS="
- echo " --keymap add keymap to HOOKS="
- echo " --pcmcia add pcmcia to HOOKS="
- echo " --nfs add net to HOOKS="
- echo " --btrfs add btrfs to HOOKS="
- echo " --shutdown add shutdown to HOOKS="
- exit 1
-}
-
-[ "$1" = "" ] && usage
-[ "$1" = "--help" ] && usage
-[ "$1" = "-h" ] && usage
-
-# setting parameters
-PARAMETER="$(echo $*)"
-parameter() {
- while [ -n "$1" ]; do
- case $1 in
- --kernel_directory=*)
- KERNEL_DIRECTORY="$(echo $1 | awk -F= '{print $2;}')"
- ;;
- --kernel_version=*)
- KERNEL_VERSION="$(echo $1 | awk -F= '{print $2;}')"
- ;;
- --rootdevice=*)
- ROOTDEVICE="$(echo $1 | awk -F= '{print $2;}')"
- ;;
- -hooks-dir=*|--hooks-dir=*)
- HOOKS_DIR="$(echo $1 | awk -F= '{print $2;}')"
- ;;
- esac
- shift
- done
-}
-
-parameter $PARAMETER
-
-if [ "$KERNEL_VERSION" = "" ]; then
- KERNEL_VERSION="$(uname -r)"
-fi
-
-# dmraid switch
-[ "$(echo $* | grep '\-dmraid')" ] && DMRAID=1
-
-# keymap switch
-[ "$(echo $* | grep '\-keymap')" ] && KEYMAP=1
-
-# pcmcia switch
-[ "$(echo $* | grep '\-pcmcia')" ] && PCMCIA=1
-
-# nfs switch
-[ "$(echo $* | grep '\-nfs')" ] && NFS=1
-
-# btrfs switch
-[ "$(echo $* | grep '\-btrfs')" ] && BTRFS=1
-
-# shutdown switch
-[ "$(echo $* | grep '\-shutdown')" ] && SHUTDOWN=1
-
-# hooks switch
-[ "$(echo $* | grep '\-hooks')" ] && HOOKS=1
-
-ADVANCED=""
-# root device check
-if ! [ "$ROOTDEVICE" = "" ]; then
- ADVANCED="$(echo $(echo "$(lsblk -rpsno TYPE $ROOTDEVICE | grep -ve "disk" -e "part")" | tac) | sed -e 's#crypt#encrypt#g' -e 's#raid.*[0-9]#mdadm_udev#g' -e 's#lvm#lvm2#g')"
-fi
-
-: >/tmp/modules-plain
-: >/tmp/modules-stripped
-: >/tmp/modules-sorted
-: >/tmp/moduleslist
-: >/tmp/.blkid
-
-# generate blkid
-blkid -c /dev/null -s TYPE > /tmp/.blkid
-
-# find pci aliases
-aliases=$(find /sys/ -noleaf -name modalias -exec cat {} +)
-
-# generate files for the different actions
-modprobe -i -a --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends $aliases >> /tmp/modules-plain 2>/dev/null
-
-# find PNP devices like parports, soundcards etc.
-# (workaround for rtc, pcspkr, irtty-sir and analog are included)
-if [ "$(find /sys/devices -noleaf -name 'id' | grep /pnp)" ]; then
- for i in $(find /sys/devices -noleaf -name "id" | grep /pnp); do
- devid=$(cat $i | grep PNP)
- [ "$devid" ] || continue
-
- modprobe -i --set-version=$KERNEL_VERSION --show-depends pnp:d${devid} >> /tmp/modules-plain 2>/dev/null
- [ "$devid" = "PNP0800" ] && modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends pcspkr >> /tmp/modules-plain 2>/dev/null
- [ "$devid" = "PNP0510" ] && modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends irtty-sir >> /tmp/modules-plain 2>/dev/null
- [ "$devid" = "PNP0511" ] && modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends irtty-sir >> /tmp/modules-plain 2>/dev/null
- [ "$devid" = "PNPb02f" ] && modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends analog >> /tmp/modules-plain 2>/dev/null
-
- # load ppp-generic if serial ports are detected for modems
- [ "$devid" = "PNP0501" ] && modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends ppp-generic >> /tmp/modules-plain 2>/dev/null
- done
-fi
-
-# SCSI disks/cdroms/tapes/generic devices
-if [ "$(find /sys/devices -noleaf -name 'type')" ]; then
- for i in $(cat $(find /sys/devices -noleaf -name "type")); do
- case $i in (4|5) modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends sr_mod >> /tmp/modules-plain 2>/dev/null ;; esac
- case $i in (2|3|6|8|9) modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends sg >> /tmp/modules-plain 2>/dev/null ;; esac
- case $i in (0|7|14) modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends sd_mod >> /tmp/modules-plain 2>/dev/null ;; esac
- case $i in (1) modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends st >> /tmp/modules-plain 2>/dev/null ;; esac
- done
-fi
-
-# add Buslogic for vmware
-if [ "$VMWARE" = "1" ]; then
- modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends BusLogic >> /tmp/modules-plain 2>/dev/null
-fi
-
-# Parport modules
-if [ "$(grep 'parport' /tmp/modules-plain)" ]; then
- modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends lp >> /tmp/modules-plain 2>/dev/null
- modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends ppdev >> /tmp/modules-plain 2>/dev/null
-fi
-
-sort -u /tmp/modules-plain >> /tmp/modules-stripped
-
-# OTHER modules loading first for speed up!
-grep -v "scsi/" /tmp/modules-stripped | grep -v "fusion/" | grep -v "block/sx8" | grep -v "message/fusion" | \
- grep -v "block/cciss" | grep -v "block/cpqarray" | grep -v "block/DAC960" | grep -v "block/virtio" | grep -v "ata/" | \
- grep -v "net/" | grep -v "pcmcia/" | grep -v "usb/" | \
- grep -v "firewire" | grep -v "ieee1394/" | grep -v "usbhid/" | grep -v "staging/" | grep -v "wireless/" | grep -v "virtio_pci" >> /tmp/modules-sorted
-# load virtio first!
-grep "virtio_pci" /tmp/modules-stripped >> /tmp/modules-sorted
-# make a correct order for the modules, internal devices have priority!
-grep "ata/pata" /tmp/modules-stripped | grep -v "pata_acpi" >> /tmp/modules-sorted
-grep "scsi/" /tmp/modules-stripped | grep -v "sd_mod" | grep -v "sr_mod" | grep -v "/sg.ko" | grep -v "/st.ko" >> /tmp/modules-sorted
-grep "block/" /tmp/modules-stripped | grep -v "virtio_blk" | grep -v "sx8" | grep -v "nbd" | grep -v "pktcdvd" | grep -v "floppy" >> /tmp/modules-sorted
-grep "fusion/" /tmp/modules-stripped >> /tmp/modules-sorted
-grep "ata/" /tmp/modules-stripped| grep -v "pata" | grep -v "ata_generic" | grep -v "libata" >> /tmp/modules-sorted
-grep "block/" /tmp/modules-stripped | grep "sx8" >> /tmp/modules-sorted
-grep "net/" /tmp/modules-stripped | grep -v "wireless/" | grep -v "usb/" >> /tmp/modules-sorted
-grep "wireless/" /tmp/modules-stripped >> /tmp/modules-sorted
-grep "staging/" /tmp/modules-stripped >> /tmp/modules-sorted
-grep "pcmcia/" /tmp/modules-stripped >> /tmp/modules-sorted
-
-# speed up usb module loading
-grep "usb-storage" /tmp/modules-stripped >> /tmp/modules-sorted
-grep "usblp" /tmp/modules-stripped >> /tmp/modules-sorted
-grep "usbhid" /tmp/modules-stripped >> /tmp/modules-sorted
-grep "usb/" /tmp/modules-stripped | grep -v "usb-storage" | grep -v "usbhid" | grep -v "usblp" >> /tmp/modules-sorted
-grep "firewire/" /tmp/modules-stripped >> /tmp/modules-sorted
-grep "ieee1394/" /tmp/modules-stripped >> /tmp/modules-sorted
-
-# add scsi and virtio device modules at the end
-grep "virtio_blk" /tmp/modules-stripped >> /tmp/modules-sorted
-grep "sd_mod" /tmp/modules-stripped >> /tmp/modules-sorted
-grep "sr_mod" /tmp/modules-stripped >> /tmp/modules-sorted
-grep "/st.ko" /tmp/modules-stripped >> /tmp/modules-sorted
-grep "/sg.ko" /tmp/modules-stripped >> /tmp/modules-sorted
-
-
-sed -ne "s#^insmod.*/\(.*\)\.ko.*#\1#p" /tmp/modules-sorted >> /tmp/moduleslist
-
-listmods() {
- key=$1 ; shift
- ex=
- while [ "$1" ]; do
- [ "$ex" ] && ex="$ex|$1" || ex="$1"
- shift
- done
- for ln in $(grep "$key" /tmp/modules-sorted | sed 's|^insmod ||g'); do
- if [ "$ex" ]; then
- echo $ln | egrep -v "$ex" | sed -ne "s#^/.*/\(.*\)\.ko.*#\1#p"
- else
- echo $ln | sed -ne "s#^/.*/\(.*\)\.ko.*#\1#p"
- fi
- done
-}
-showlist() {
- cat=$1 ; shift
- [ $# -gt 0 ] || return
- echo -n "$cat: "
- for i in $*; do echo -n "$i "; done
- echo ""
-}
-
-showlist2() {
- cat=$1 ; shift
- [ $# -gt 0 ] || return
- echo -n "$cat="
- for i in $*; do echo -n "$i "; done
- echo ""
-}
-
-# starting different actions
-while [ -n "$*" ]; do
- case $1 in
- --load-modules)
- # load all detected pci modules
- for i in $(cat /tmp/moduleslist); do
- modprobe $i > /dev/null 2>&1
- done
- ;;
-
- --unload-modules)
- # load all detected pci modules
- for i in $(cat /tmp/moduleslist); do
- modprobe -r $i > /dev/null 2>&1
- done
- ;;
-
- --show-modules)
- showlist "AGP " $(listmods agp/)
- showlist "ACPI " $(listmods acpi/)
- showlist "BLOCK " $(listmods ata/pata pata_acpi) $(listmods ata/ata_piix) \
- $(listmods virtio/virtio_pci) $(listmods scsi/) $(listmods message/fusion/) $(listmods drivers/block/ nbd pktcdvd sx8 floppy) \
- $(listmods ata/ pata ata_generic) $(listmods drivers/block/sx8) \
- $(listmods usb/ usb/input) $(listmods firewire/) $(listmods ieee1394/)
- showlist "NET " $(listmods net/ irda/)
- showlist "DRM " $(listmods drm/)
- showlist "INPUT " $(listmods input/ pcspkr) $(listmods hid/)
- showlist "IRDA " $(listmods irda/)
- showlist "ISDN " $(listmods isdn/)
- showlist "PCMCIA " $(listmods pcmcia/)
- showlist "SOUND " $(listmods pcspkr) $(listmods sound/)
- showlist "STAGING" $(listmods staging/)
- showlist "OTHER " $(listmods modules/ agp/ acpi/ scsi/ message/fusion block/sx8 block/cciss block/cpqarray block/DAC960 block/virtio virtio/virtio_pci ata/ usb/ ieee1394 net/ isdn/ input/ irda/ pcmcia/ sound/ drm/ firewire/ hid/ staging/)
- ;;
-
- --show-modules-order)
- showlist "MODULES ORDER" $(listmods modules/)
- ;;
-
- --show-agp) showlist "AGP " $(listmods agp/) ;;
- --show-acpi) showlist "ACPI " $(listmods acpi/) ;;
- --show-block) showlist "BLOCK " $(listmods ata/pata pata_acpi) $(listmods ata/ata_piix) \
- $(listmods virtio/virtio_pci) $(listmods scsi/) $(listmods message/fusion/) $(listmods drivers/block/ nbd pktcdvd sx8 floppy) \
- $(listmods ata/ pata ata_generic) $(listmods drivers/block/sx8) \
- $(listmods usb/ usb/input) $(listmods firewire/) $(listmods ieee1394/) ;;
- --show-net) showlist "NET " $(listmods net/ irda/) ;;
- --show-input) showlist "INPUT " $(listmods input/ pcspkr) $(listmods hid/) ;;
- --show-irda) showlist "IRDA " $(listmods irda/) ;;
- --show-isdn) showlist "ISDN " $(listmods isdn/) ;;
- --show-pcmcia) showlist "PCMCIA " $(listmods pcmcia/) ;;
- --show-sound) showlist "SOUND " $(listmods pcspkr) $(listmods sound/) ;;
- --show-staging) showlist "STAGING" $(listmods staging/) ;;
- --show-drm) showlist "DRM " $(listmods drm/) ;;
- --show-other) showlist "OTHER " $(listmods .ko agp/ acpi/ scsi/ message/fusion block/sx8 block/cciss block/cpqarray block/DAC960 block/virtio virtio/virtio_pci ata/ usb/ ieee1394 net/ isdn/ input/ irda/ pcmcia/ sound/ drm/ firewire/ hid/ staging/) ;;
- --filesystem) FILESYSTEM="ext2 ext3 ext4 f2fs nilfs2 btrfs reiserfs xfs jfs vfat"
- for i in $FILESYSTEM; do
- [ "$(grep $i /tmp/.blkid)" ] && FS="$FS $i"
- done
- [ "$(echo $FS | grep btrfs)" ] && FS="$FS crc32c"
- MODULES_INITRAMFS="$MODULES_INITRAMFS $FS"
- showlist2 "MODULES" \"$MODULES_INITRAMFS\" | sed -e 's/(\ /(/g' -e 's/"\ /"/g' -e 's/\ "/"/g' -e 's/\ \ /\ /g'
- ;;
- --hostcontroller)HOSTCONTROLLER="$(listmods virtio/virtio_pci) $(listmods ata/pata pata_acpi) $(listmods scsi/ /sg.ko /st.ko scsi_mod sr_mod sd_mod) $(listmods message/fusion/) $(listmods drivers/block/ virtio_blk nbd pktcdvd sx8 floppy) $(listmods ata/ pata ata_generic) $(listmods drivers/block/sx8) $(listmods xhci-hcd) $(listmods ehci-hcd) $(listmods uhci-hcd) $(listmods ohci-hcd) $(listmods virtio_blk)"
- MODULES_INITRAMFS="$MODULES_INITRAMFS $HOSTCONTROLLER"
- showlist2 "MODULES" \"$MODULES_INITRAMFS\" | sed -e 's/(\ /(/g' -e 's/"\ /"/g' -e 's/\ "/"/g' -e 's/\ \ /\ /g'
- ;;
- --ati-kms) KMS="radeon"
- MODULES_INITRAMFS="$KMS $MODULES_INITRAMFS"
- showlist2 "MODULES" \"$MODULES_INITRAMFS\" | sed -e 's/(\ /(/g' -e 's/"\ /"/g' -e 's/\ "/"/g' -e 's/\ \ /\ /g'
- ;;
- --intel-kms) KMS="i915"
- MODULES_INITRAMFS="$KMS $MODULES_INITRAMFS"
- showlist2 "MODULES" \"$MODULES_INITRAMFS\" | sed -e 's/(\ /(/g' -e 's/"\ /"/g' -e 's/\ "/"/g' -e 's/\ \ /\ /g'
- ;;
- --nvidia-kms) KMS="nouveau"
- MODULES_INITRAMFS="$KMS $MODULES_INITRAMFS"
- showlist2 "MODULES" \"$MODULES_INITRAMFS\" | sed -e 's/(\ /(/g' -e 's/"\ /"/g' -e 's/\ "/"/g' -e 's/\ \ /\ /g'
- ;;
- --hooks)
- if [ "$HOOKS_DIR" = "" ]; then
- HOOKS_DIR="/usr/lib/initcpio/install"
- fi
- START_HOOKS="base udev keymap autodetect modconf block pcmcia net dmraid keyboard $ADVANCED btrfs filesystems fsck shutdown"
- # remove the ones that don't exist on the system
- for i in ${START_HOOKS}; do
- if ! [ -e "${HOOKS_DIR}/$i" ]; then
- START_HOOKS=$(echo $START_HOOKS | sed -e "s/${i}\ //g")
- fi
- done
- if ! [ "$KEYMAP" = "1" ]; then
- START_HOOKS=$(echo $START_HOOKS | sed -e "s/keymap//g")
- fi
- if ! [ "$DMRAID" = "1" ]; then
- START_HOOKS=$(echo $START_HOOKS | sed -e "s/dmraid//g")
- fi
- if ! [ "$PCMCIA" = "1" ]; then
- START_HOOKS=$(echo $START_HOOKS | sed -e "s/pcmcia//g")
- fi
- if ! [ "$NFS" = "1" ]; then
- START_HOOKS=$(echo $START_HOOKS | sed -e "s/net//g")
- fi
- if ! [ "$BTRFS" = "1" ]; then
- START_HOOKS=$(echo $START_HOOKS | sed -e "s/btrfs//g")
- fi
- if ! [ "$SHUTDOWN" = "1" ]; then
- START_HOOKS=$(echo $START_HOOKS | sed -e "s/shutdown//g")
- fi
- echo "HOOKS=\"$START_HOOKS\"" | sed -e 's/"\ /"/g' -e 's/\ "/"/g' -e 's/\ \ /\ /g'
- ;;
- --advanced) echo "$ADVANCED"
- ;;
- esac
- shift
-done
-
-# cleanup
-rm /tmp/modules-plain
-rm /tmp/modules-sorted
-rm /tmp/modules-stripped
-rm /tmp/moduleslist
-
-# vim: set ts=2 sw=2 noet:
Copied: hwdetect/repos/extra-any/hwdetect (from rev 196175, hwdetect/trunk/hwdetect)
===================================================================
--- hwdetect (rev 0)
+++ hwdetect 2013-10-07 20:46:54 UTC (rev 196176)
@@ -0,0 +1,385 @@
+#! /bin/sh
+# Autodetection script for scanning /sys for hardware
+# for Archlinux by Tobias Powalowski <tpowa at archlinux.org>
+usage () {
+ echo "$0 [options]"
+ echo ""
+ echo " This is a tool that detects/lists modules that are exported by /sys"
+ echo ""
+ echo " Options:"
+ echo " --kernel_version= use kernel version (no autodetect)"
+ echo " --kernel_directory= use kernel module directory (no autodetect)"
+ echo " --load-modules load all detected modules"
+ echo " --unload-modules unload all detected modules"
+ echo " --show-modules show all detected modules"
+ echo " --show-modules-order shows load order of detected modules"
+ echo " --show-agp show AGP modules"
+ echo " --show-acpi show ACPI modules"
+ echo " --show-block show BLOCK DEVICE modules"
+ echo " --show-cdrom show CDROM modules"
+ echo " --show-cpufreq show CPUFREQ modules"
+ echo " --show-crypto show CRYPTO modules"
+ echo " --show-drm show DRM modules"
+ echo " --show-hwmon show HWMON modules"
+ echo " --show-i2c show I2C modules"
+ echo " --show-input show INPUT modules"
+ echo " --show-irda show IRDA modules"
+ echo " --show-isdn show ISDN modules"
+ echo " --show-kvm show KVM modules"
+ echo " --show-media show MEDIA modules"
+ echo " --show-net show NETWORK modules"
+ echo " --show-parport show PARPORT modules"
+ echo " --show-pcmcia show PCMCIA modules"
+ echo " --show-sound show SOUND modules"
+ echo " --show-staging show STAGING modules"
+ echo " --show-tpm show TPM modules"
+ echo " --show-watchdog show WATCHDOG modules"
+ echo " --show-other show OTHER modules"
+ echo ""
+ echo " For /etc/mkinitcpio.conf use:"
+ echo " --filesystem add filesystems to MODULES="
+ echo " --hostcontroller show MODULES= for all hostcontrollers"
+ echo " --ati-kms add ati kernel mode setting"
+ echo " --intel-kms add intel kernel mode setting"
+ echo " --nvidia-kms add nvidia kernel mode setting"
+ echo ""
+ echo " --rootdevice= autodetected advanced features of rootdevice"
+ echo " --hooks-dir= use this directory for HOOKS check"
+ echo " --advanced show autodetected advanced HOOKS"
+ echo " --hooks show HOOKS="
+ echo " --dmraid add dmraid to HOOKS="
+ echo " --keymap add keymap to HOOKS="
+ echo " --pcmcia add pcmcia to HOOKS="
+ echo " --nfs add net to HOOKS="
+ echo " --btrfs add btrfs to HOOKS="
+ echo " --shutdown add shutdown to HOOKS="
+ exit 1
+}
+
+[ "$1" = "" ] && usage
+[ "$1" = "--help" ] && usage
+[ "$1" = "-h" ] && usage
+
+# setting parameters
+PARAMETER="$(echo $*)"
+parameter() {
+ while [ -n "$1" ]; do
+ case $1 in
+ --kernel_directory=*)
+ KERNEL_DIRECTORY="$(echo $1 | awk -F= '{print $2;}')"
+ ;;
+ --kernel_version=*)
+ KERNEL_VERSION="$(echo $1 | awk -F= '{print $2;}')"
+ ;;
+ --rootdevice=*)
+ ROOTDEVICE="$(echo $1 | awk -F= '{print $2;}')"
+ ;;
+ -hooks-dir=*|--hooks-dir=*)
+ HOOKS_DIR="$(echo $1 | awk -F= '{print $2;}')"
+ ;;
+ esac
+ shift
+ done
+}
+
+parameter $PARAMETER
+
+if [ "$KERNEL_VERSION" = "" ]; then
+ KERNEL_VERSION="$(uname -r)"
+fi
+
+# dmraid switch
+[ "$(echo $* | grep '\-dmraid')" ] && DMRAID=1
+
+# keymap switch
+[ "$(echo $* | grep '\-keymap')" ] && KEYMAP=1
+
+# pcmcia switch
+[ "$(echo $* | grep '\-pcmcia')" ] && PCMCIA=1
+
+# nfs switch
+[ "$(echo $* | grep '\-nfs')" ] && NFS=1
+
+# btrfs switch
+[ "$(echo $* | grep '\-btrfs')" ] && BTRFS=1
+
+# shutdown switch
+[ "$(echo $* | grep '\-shutdown')" ] && SHUTDOWN=1
+
+# hooks switch
+[ "$(echo $* | grep '\-hooks')" ] && HOOKS=1
+
+ADVANCED=""
+# root device check
+if ! [ "$ROOTDEVICE" = "" ]; then
+ ADVANCED="$(echo $(echo "$(lsblk -rpsno TYPE $ROOTDEVICE | grep -ve "disk" -e "part")" | tac) | sed -e 's#crypt#encrypt#g' -e 's#raid.*[0-9]#mdadm_udev#g' -e 's#lvm#lvm2#g')"
+fi
+
+: >/tmp/modules-plain
+: >/tmp/modules-stripped
+: >/tmp/modules-sorted
+: >/tmp/moduleslist
+: >/tmp/.blkid
+
+# generate blkid
+blkid -c /dev/null -s TYPE > /tmp/.blkid
+
+# find pci aliases
+aliases=$(find /sys/ -noleaf -name modalias -exec cat {} +)
+
+# generate files for the different actions
+modprobe -i -a --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends $aliases >> /tmp/modules-plain 2>/dev/null
+
+# find PNP devices like parports, soundcards etc.
+# (workaround for rtc, pcspkr, irtty-sir and analog are included)
+if [ "$(find /sys/devices -noleaf -name 'id' | grep /pnp)" ]; then
+ for i in $(find /sys/devices -noleaf -name "id" | grep /pnp); do
+ devid=$(cat $i | grep PNP)
+ [ "$devid" ] || continue
+
+ modprobe -i --set-version=$KERNEL_VERSION --show-depends pnp:d${devid} >> /tmp/modules-plain 2>/dev/null
+ [ "$devid" = "PNP0800" ] && modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends pcspkr >> /tmp/modules-plain 2>/dev/null
+ [ "$devid" = "PNP0510" ] && modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends irtty-sir >> /tmp/modules-plain 2>/dev/null
+ [ "$devid" = "PNP0511" ] && modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends irtty-sir >> /tmp/modules-plain 2>/dev/null
+ [ "$devid" = "PNPb02f" ] && modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends analog >> /tmp/modules-plain 2>/dev/null
+
+ # load ppp-generic if serial ports are detected for modems
+ [ "$devid" = "PNP0501" ] && modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends ppp-generic >> /tmp/modules-plain 2>/dev/null
+ done
+fi
+
+# SCSI disks/cdroms/tapes/generic devices
+if [ "$(find /sys/devices -noleaf -name 'type')" ]; then
+ for i in $(cat $(find /sys/devices -noleaf -name "type")); do
+ case $i in (4|5) modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends sr_mod >> /tmp/modules-plain 2>/dev/null ;; esac
+ case $i in (2|3|6|8|9) modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends sg >> /tmp/modules-plain 2>/dev/null ;; esac
+ case $i in (0|7|14) modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends sd_mod >> /tmp/modules-plain 2>/dev/null ;; esac
+ case $i in (1) modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends st >> /tmp/modules-plain 2>/dev/null ;; esac
+ done
+fi
+
+# add Buslogic for vmware
+if [ "$VMWARE" = "1" ]; then
+ modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends BusLogic >> /tmp/modules-plain 2>/dev/null
+fi
+
+# Parport modules
+if [ "$(grep 'parport' /tmp/modules-plain)" ]; then
+ modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends lp >> /tmp/modules-plain 2>/dev/null
+ modprobe -i --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends ppdev >> /tmp/modules-plain 2>/dev/null
+fi
+
+sort -u /tmp/modules-plain >> /tmp/modules-stripped
+
+# OTHER modules loading first for speed up!
+grep -v "scsi/" /tmp/modules-stripped | grep -v "fusion/" | grep -v "block/sx8" | grep -v "message/fusion" | \
+ grep -v "block/cciss" | grep -v "block/cpqarray" | grep -v "block/DAC960" | grep -v "block/virtio" | grep -v "ata/" | \
+ grep -v "net/" | grep -v "pcmcia/" | grep -v "usb/" | \
+ grep -v "firewire" | grep -v "ieee1394/" | grep -v "usbhid/" | grep -v "staging/" | grep -v "wireless/" | grep -v "virtio_pci" >> /tmp/modules-sorted
+# load virtio first!
+grep "virtio_pci" /tmp/modules-stripped >> /tmp/modules-sorted
+# make a correct order for the modules, internal devices have priority!
+grep "ata/pata" /tmp/modules-stripped | grep -v "pata_acpi" >> /tmp/modules-sorted
+grep "scsi/" /tmp/modules-stripped | grep -v "sd_mod" | grep -v "sr_mod" | grep -v "/sg.ko" | grep -v "/st.ko" >> /tmp/modules-sorted
+grep "block/" /tmp/modules-stripped | grep -v "virtio_blk" | grep -v "sx8" | grep -v "nbd" | grep -v "pktcdvd" | grep -v "floppy" >> /tmp/modules-sorted
+grep "fusion/" /tmp/modules-stripped >> /tmp/modules-sorted
+grep "ata/" /tmp/modules-stripped| grep -v "pata" | grep -v "ata_generic" | grep -v "libata" >> /tmp/modules-sorted
+grep "block/" /tmp/modules-stripped | grep "sx8" >> /tmp/modules-sorted
+grep "net/" /tmp/modules-stripped | grep -v "wireless/" | grep -v "usb/" >> /tmp/modules-sorted
+grep "wireless/" /tmp/modules-stripped >> /tmp/modules-sorted
+grep "staging/" /tmp/modules-stripped >> /tmp/modules-sorted
+grep "pcmcia/" /tmp/modules-stripped >> /tmp/modules-sorted
+
+# speed up usb module loading
+grep "usb-storage" /tmp/modules-stripped >> /tmp/modules-sorted
+grep "usblp" /tmp/modules-stripped >> /tmp/modules-sorted
+grep "usbhid" /tmp/modules-stripped >> /tmp/modules-sorted
+grep "usb/" /tmp/modules-stripped | grep -v "usb-storage" | grep -v "usbhid" | grep -v "usblp" >> /tmp/modules-sorted
+grep "firewire/" /tmp/modules-stripped >> /tmp/modules-sorted
+grep "ieee1394/" /tmp/modules-stripped >> /tmp/modules-sorted
+
+# add scsi and virtio device modules at the end
+grep "virtio_blk" /tmp/modules-stripped >> /tmp/modules-sorted
+grep "sd_mod" /tmp/modules-stripped >> /tmp/modules-sorted
+grep "sr_mod" /tmp/modules-stripped >> /tmp/modules-sorted
+grep "/st.ko" /tmp/modules-stripped >> /tmp/modules-sorted
+grep "/sg.ko" /tmp/modules-stripped >> /tmp/modules-sorted
+
+
+sed -ne "s#^insmod.*/\(.*\)\.ko.*#\1#p" /tmp/modules-sorted >> /tmp/moduleslist
+
+listmods() {
+ key=$1 ; shift
+ ex=
+ while [ "$1" ]; do
+ [ "$ex" ] && ex="$ex|$1" || ex="$1"
+ shift
+ done
+ for ln in $(grep "$key" /tmp/modules-sorted | sed 's|^insmod ||g'); do
+ if [ "$ex" ]; then
+ echo $ln | egrep -v "$ex" | sed -ne "s#^/.*/\(.*\)\.ko.*#\1#p"
+ else
+ echo $ln | sed -ne "s#^/.*/\(.*\)\.ko.*#\1#p"
+ fi
+ done
+}
+showlist() {
+ cat=$1 ; shift
+ [ $# -gt 0 ] || return
+ echo -n "$cat: "
+ for i in $*; do echo -n "$i "; done
+ echo ""
+}
+
+showlist2() {
+ cat=$1 ; shift
+ [ $# -gt 0 ] || return
+ echo -n "$cat="
+ for i in $*; do echo -n "$i "; done
+ echo ""
+}
+
+# starting different actions
+while [ -n "$*" ]; do
+ case $1 in
+ --load-modules)
+ # load all detected pci modules
+ for i in $(cat /tmp/moduleslist); do
+ modprobe $i > /dev/null 2>&1
+ done
+ ;;
+
+ --unload-modules)
+ # load all detected pci modules
+ for i in $(cat /tmp/moduleslist); do
+ modprobe -r $i > /dev/null 2>&1
+ done
+ ;;
+
+ --show-modules)
+ showlist "AGP " $(listmods agp/)
+ showlist "ACPI " $(listmods acpi/)
+ showlist "BLOCK " $(listmods ata/pata pata_acpi) $(listmods ata/ata_piix) \
+ $(listmods virtio/virtio_pci) $(listmods scsi/) $(listmods message/fusion/) $(listmods drivers/block/ nbd pktcdvd sx8 floppy) \
+ $(listmods ata/ pata ata_generic) $(listmods drivers/block/sx8) \
+ $(listmods usb/ usb/input) $(listmods firewire/) $(listmods ieee1394/)
+ showlist "CDROM " $(listmods cdrom/)
+ showlist "CPUFREQ " $(listmods cpufreq/)
+ showlist "CRYPTO " $(listmods crypto/)
+ showlist "DRM " $(listmods drm/)
+ showlist "HWMON " $(listmods hwmon/)
+ showlist "I2C " $(listmods i2c/)
+ showlist "INPUT " $(listmods input/ pcspkr) $(listmods hid/)
+ showlist "IRDA " $(listmods irda/)
+ showlist "ISDN " $(listmods isdn/)
+ showlist "KVM " $(listmods kvm/)
+ showlist "MEDIA " $(listmods media/)
+ showlist "NET " $(listmods net/ irda/)
+ showlist "PARPORT " $(listmods parport/)
+ showlist "PCMCIA " $(listmods pcmcia/)
+ showlist "SOUND " $(listmods pcspkr) $(listmods sound/)
+ showlist "STAGING " $(listmods staging/)
+ showlist "TPM " $(listmods tpm/)
+ showlist "WATCHDOG" $(listmods watchdog/)
+ showlist "OTHER " $(listmods modules/ agp/ acpi/ scsi/ message/fusion block/sx8 block/cciss block/cpqarray block/DAC960 block/virtio virtio/virtio_pci ata/ \
+ usb/ ieee1394 cdrom/ cpufreq/ crypto/ net/ hwmon/ i2c/ isdn/ input/ irda/ kvm/ media/ parport/ pcmcia/ sound/ tpm/ drm/ firewire/ hid/ staging/ watchdog/)
+ ;;
+
+ --show-modules-order)
+ showlist "MODULES ORDER" $(listmods modules/)
+ ;;
+
+ --show-agp) showlist "AGP " $(listmods agp/) ;;
+ --show-acpi) showlist "ACPI " $(listmods acpi/) ;;
+ --show-block) showlist "BLOCK " $(listmods ata/pata pata_acpi) $(listmods ata/ata_piix) \
+ $(listmods virtio/virtio_pci) $(listmods scsi/) $(listmods message/fusion/) $(listmods drivers/block/ nbd pktcdvd sx8 floppy) \
+ $(listmods ata/ pata ata_generic) $(listmods drivers/block/sx8) \
+ $(listmods usb/ usb/input) $(listmods firewire/) $(listmods ieee1394/) ;;
+ --show-cdrom) showlist "CDROM " $(listmods cdrom/) ;;
+ --show-cpufreq) showlist "CPUFREQ " $(listmods cpufreq/) ;;
+ --show-crypto) showlist "CRYPTO " $(listmods crypto/) ;;
+ --show-drm) showlist "DRM " $(listmods drm/) ;;
+ --show-hwmon) showlist "HWMON " $(listmods hwmon/) ;;
+ --show-input) showlist "INPUT " $(listmods input/ pcspkr) $(listmods hid/) ;;
+ --show-i2c) showlist "I2C " $(listmods i2c/) ;;
+ --show-irda) showlist "IRDA " $(listmods irda/) ;;
+ --show-isdn) showlist "ISDN " $(listmods isdn/) ;;
+ --show-kvm) showlist "KVM " $(listmods kvm/) ;;
+ --show-media) showlist "MEDIA " $(listmods media/) ;;
+ --show-net) showlist "NET " $(listmods net/ irda/) ;;
+ --show-parport) showlist "PARPORT " $(listmods parport/) ;;
+ --show-pcmcia) showlist "PCMCIA " $(listmods pcmcia/) ;;
+ --show-sound) showlist "SOUND " $(listmods pcspkr) $(listmods sound/) ;;
+ --show-staging) showlist "STAGING " $(listmods staging/) ;;
+ --show-tpm) showlist "TPM " $(listmods tpm/) ;;
+ --show-watchdog) showlist "WATCHDOG" $(listmods watchdog/) ;;
+ --show-other) showlist "OTHER " $(listmods .ko agp/ acpi/ scsi/ message/fusion block/sx8 block/cciss block/cpqarray block/DAC960 block/virtio virtio/virtio_pci ata/ \
+ usb/ ieee1394 cdrom/ cpufreq/ crypto/ net/ hwmon/ i2c/ isdn/ input/ irda/ kvm/ media/ parport/ pcmcia/ sound/ tpm/ drm/ firewire/ hid/ staging/ watchdog/) ;;
+ --filesystem) FILESYSTEM="ext2 ext3 ext4 f2fs nilfs2 btrfs reiserfs xfs jfs vfat"
+ for i in $FILESYSTEM; do
+ [ "$(grep $i /tmp/.blkid)" ] && FS="$FS $i"
+ done
+ [ "$(echo $FS | grep btrfs)" ] && FS="$FS crc32c"
+ MODULES_INITRAMFS="$MODULES_INITRAMFS $FS"
+ showlist2 "MODULES" \"$MODULES_INITRAMFS\" | sed -e 's/(\ /(/g' -e 's/"\ /"/g' -e 's/\ "/"/g' -e 's/\ \ /\ /g'
+ ;;
+ --hostcontroller)HOSTCONTROLLER="$(listmods virtio/virtio_pci) $(listmods ata/pata pata_acpi) $(listmods scsi/ /sg.ko /st.ko scsi_mod sr_mod sd_mod) $(listmods message/fusion/) $(listmods drivers/block/ virtio_blk nbd pktcdvd sx8 floppy) $(listmods ata/ pata ata_generic) $(listmods drivers/block/sx8) $(listmods xhci-hcd) $(listmods ehci-hcd) $(listmods uhci-hcd) $(listmods ohci-hcd) $(listmods virtio_blk)"
+ MODULES_INITRAMFS="$MODULES_INITRAMFS $HOSTCONTROLLER"
+ showlist2 "MODULES" \"$MODULES_INITRAMFS\" | sed -e 's/(\ /(/g' -e 's/"\ /"/g' -e 's/\ "/"/g' -e 's/\ \ /\ /g'
+ ;;
+ --ati-kms) KMS="radeon"
+ MODULES_INITRAMFS="$KMS $MODULES_INITRAMFS"
+ showlist2 "MODULES" \"$MODULES_INITRAMFS\" | sed -e 's/(\ /(/g' -e 's/"\ /"/g' -e 's/\ "/"/g' -e 's/\ \ /\ /g'
+ ;;
+ --intel-kms) KMS="i915"
+ MODULES_INITRAMFS="$KMS $MODULES_INITRAMFS"
+ showlist2 "MODULES" \"$MODULES_INITRAMFS\" | sed -e 's/(\ /(/g' -e 's/"\ /"/g' -e 's/\ "/"/g' -e 's/\ \ /\ /g'
+ ;;
+ --nvidia-kms) KMS="nouveau"
+ MODULES_INITRAMFS="$KMS $MODULES_INITRAMFS"
+ showlist2 "MODULES" \"$MODULES_INITRAMFS\" | sed -e 's/(\ /(/g' -e 's/"\ /"/g' -e 's/\ "/"/g' -e 's/\ \ /\ /g'
+ ;;
+ --hooks)
+ if [ "$HOOKS_DIR" = "" ]; then
+ HOOKS_DIR="/usr/lib/initcpio/install"
+ fi
+ START_HOOKS="base udev keymap autodetect modconf block pcmcia net dmraid keyboard $ADVANCED btrfs filesystems fsck shutdown"
+ # remove the ones that don't exist on the system
+ for i in ${START_HOOKS}; do
+ if ! [ -e "${HOOKS_DIR}/$i" ]; then
+ START_HOOKS=$(echo $START_HOOKS | sed -e "s/${i}\ //g")
+ fi
+ done
+ if ! [ "$KEYMAP" = "1" ]; then
+ START_HOOKS=$(echo $START_HOOKS | sed -e "s/keymap//g")
+ fi
+ if ! [ "$DMRAID" = "1" ]; then
+ START_HOOKS=$(echo $START_HOOKS | sed -e "s/dmraid//g")
+ fi
+ if ! [ "$PCMCIA" = "1" ]; then
+ START_HOOKS=$(echo $START_HOOKS | sed -e "s/pcmcia//g")
+ fi
+ if ! [ "$NFS" = "1" ]; then
+ START_HOOKS=$(echo $START_HOOKS | sed -e "s/net//g")
+ fi
+ if ! [ "$BTRFS" = "1" ]; then
+ START_HOOKS=$(echo $START_HOOKS | sed -e "s/btrfs//g")
+ fi
+ if ! [ "$SHUTDOWN" = "1" ]; then
+ START_HOOKS=$(echo $START_HOOKS | sed -e "s/shutdown//g")
+ fi
+ echo "HOOKS=\"$START_HOOKS\"" | sed -e 's/"\ /"/g' -e 's/\ "/"/g' -e 's/\ \ /\ /g'
+ ;;
+ --advanced) echo "$ADVANCED"
+ ;;
+ esac
+ shift
+done
+
+# cleanup
+rm /tmp/modules-plain
+rm /tmp/modules-sorted
+rm /tmp/modules-stripped
+rm /tmp/moduleslist
+
+# vim: set ts=2 sw=2 noet:
More information about the arch-commits
mailing list