summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-07-11 04:44:04 +0200
committerDave Reisner <dreisner@archlinux.org>2011-09-27 12:18:04 +0200
commit1ce14002289b676c54729e9d9dfaa7f6fd58024b (patch)
tree91e887e78f744c81e09e14e37cdd1863b27ef369 /install
parent1793ad71472d85912dd258cc6730e20a46dbbb17 (diff)
downloadmkinitcpio-1ce14002289b676c54729e9d9dfaa7f6fd58024b.tar.gz
mkinitcpio-1ce14002289b676c54729e9d9dfaa7f6fd58024b.tar.xz
cleanup and bashify install hooks
No logical code changes -- this is purely a syntactical cleanup and standardization across the build hooks along with ensuring that help messages are wrapped to 80 columns or less. All hooks get the same treatment, adhering to the following style: #!/bin/bash build() { COMMANDS } help() { cat <<HELPEOF This is a help message. HELPEOF } # vim: set ft=sh ts=4 sw=4 et: Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'install')
-rw-r--r--install/btrfs15
-rw-r--r--install/dsdt21
-rw-r--r--install/filesystems2
-rw-r--r--install/fw29
-rw-r--r--install/ide30
-rw-r--r--install/keymap2
-rw-r--r--install/memdisk19
-rw-r--r--install/net195
-rw-r--r--install/pata2
-rw-r--r--install/pcmcia28
-rw-r--r--install/resume19
-rw-r--r--install/sata2
-rw-r--r--install/scsi2
-rw-r--r--install/sleep27
-rw-r--r--install/udev33
-rw-r--r--install/usb30
-rw-r--r--install/usbinput30
17 files changed, 220 insertions, 266 deletions
diff --git a/install/btrfs b/install/btrfs
index c156bb0..60e6f5c 100644
--- a/install/btrfs
+++ b/install/btrfs
@@ -1,16 +1,15 @@
-# vim:set ft=sh:
+#!/bin/bash
-build()
-{
+build() {
MODULES="$(all_modules btrfs)"
BINARIES="/sbin/btrfs"
SCRIPT="btrfs"
}
-help ()
-{
-cat <<HELPEOF
- This hook is needed to support Btrfs volumes spread
- over multiple devices.
+help() {
+ cat <<HELPEOF
+This hook is needed to support Btrfs volumes spread over multiple devices.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/dsdt b/install/dsdt
index f1345d0..b38c66c 100644
--- a/install/dsdt
+++ b/install/dsdt
@@ -1,19 +1,14 @@
-# vim: set ft=sh:
+#!/bin/bash
-build()
-{
- MODULES=""
- BINARIES=""
- FILES=""
- SCRIPT=""
+build() {
add_file "/lib/initcpio/custom.dsdt" "DSDT.aml"
}
-help ()
-{
-cat<<HELPEOF
- This hook loads a custom acpi dsdt file during boot.
- Place your custom dsdt file for inclusion here:
- /lib/initcpio/custom.dsdt
+help() {
+ cat <<HELPEOF
+This hook loads a custom acpi dsdt file during boot. Place your custom dsdt
+file for inclusion here: /lib/initcpio/custom.dsdt
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/filesystems b/install/filesystems
index 64227bc..9230b94 100644
--- a/install/filesystems
+++ b/install/filesystems
@@ -9,7 +9,7 @@ build() {
}
help() {
- cat<<HELPEOF
+ cat <<HELPEOF
This hook adds filesystems modules to the image. If you would like to minimize
the modules installed in the image, add the autodetect hook too.
HELPEOF
diff --git a/install/fw b/install/fw
index 7d7f06f..94e70d1 100644
--- a/install/fw
+++ b/install/fw
@@ -1,24 +1,17 @@
-# vim: set ft=sh:
+#!/bin/bash
-build()
-{
- MODULES=" $(checked_modules "/drivers/firewire/") "
+build() {
+ MODULES=$(checked_modules "/drivers/firewire/")
- MODULES=$(echo ${MODULES}) #trim whitespace
- if [ -n "${MODULES}" ]; then
- MODULES="${MODULES} firewire-sbp2 sd_mod sr_mod"
- fi
- BINARIES=""
- FILES=""
- SCRIPT=""
+ [[ $MODULES ]] && MODULES+=" firewire-sbp2 sd_mod sr_mod"
}
-help ()
-{
-cat<<HELPEOF
- This hook loads the necessary modules for a firewire root device.
- Detection will take place at runtime. To minimize the modules
- in the image, add the autodetect hook too.
+help() {
+ cat <<HELPEOF
+This hook loads the necessary modules for a firewire root device. Detection
+will take place at runtime. To minimize the modules in the image, add the
+autodetect hook too.
HELPEOF
}
-
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/ide b/install/ide
index fa0da51..9443dd3 100644
--- a/install/ide
+++ b/install/ide
@@ -1,25 +1,17 @@
-# vim: set ft=sh:
+#!/bin/bash
-build()
-{
- MODULES=" $(checked_modules "/ide/" | grep -v "legacy") ";
+build() {
+ MODULES="$(checked_modules "/ide/" | grep -v "legacy")"
- MODULES=$(echo ${MODULES}) #trim whitespace
- if [ -n "${MODULES}" ]; then
- MODULES="${MODULES} ide-gd_mod"
- fi
-
- BINARIES=""
- FILES=""
- SCRIPT=""
+ [[ $MODULES ]] && MODULES+=" ide-gd_mod"
}
-help ()
-{
-cat<<HELPEOF
- This hook loads the necessary modules for an ide root device,
- using the old ide subsystem.
- Detection will take place at runtime. To minimize the modules
- in the image, add the autodetect hook too.
+help() {
+ cat <<HELPEOF
+This hook loads the necessary modules for an ide root device, using the old ide
+subsystem. Detection will take place at runtime. To minimize the modules in
+the image, add the autodetect hook too.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/keymap b/install/keymap
index 2880f15..1c53c4a 100644
--- a/install/keymap
+++ b/install/keymap
@@ -18,7 +18,7 @@ build() {
}
help() {
- cat<<HELPEOF
+ cat <<HELPEOF
This hook loads keymap(s) specified in rc.conf during early userspace.
HELPEOF
}
diff --git a/install/memdisk b/install/memdisk
index 69c996f..ec698fc 100644
--- a/install/memdisk
+++ b/install/memdisk
@@ -1,20 +1,19 @@
-# vim:set ft=sh:
+#!/bin/bash
-build()
-{
+build() {
MODULES="phram mtdblock"
BINARIES="/usr/bin/memdiskfind"
- FILES=""
SCRIPT="memdisk"
add_file /lib/initcpio/udev/01-memdisk.rules /lib/udev/rules.d/01-memdisk.rules
}
-help ()
-{
-cat <<HELPEOF
- This hook detects a virtual disk created by the memdisk
- tool (http://syslinux.zytor.com/wiki/index.php/MEMDISK).
+help() {
+ cat <<HELPEOF
+This hook detects a virtual disk created by the memdisk tool
+(http://syslinux.zytor.com/wiki/index.php/MEMDISK).
- It requires memdiskfind from syslinux 4.00 or newer.
+It requires memdiskfind from syslinux 4.00 or newer.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/net b/install/net
index 2c816ba..88d0c97 100644
--- a/install/net
+++ b/install/net
@@ -1,109 +1,106 @@
-# vim: set ft=sh:
+#!/bin/bash
-build()
-{
+build() {
MODULES="nfs $(checked_modules "/drivers/net/") "
-
- BINARIES=""
- FILES=""
SCRIPT="net"
add_binary "/lib/initcpio/ipconfig" "/bin/ipconfig"
add_binary "/lib/initcpio/nfsmount" "/bin/nfsmount"
}
-help ()
-{
-cat<<HELPEOF
- This hook loads the necessary modules for a network device.
- Detection will take place at runtime. To minimize the modules
- in the image, add the autodetect hook too.
- For pcmcia net devices please use pcmcia hook too.
-
- Kernel Parameters:
- An interface spec can be either short form, which is just the name of
- an interface (eth0 or whatever), or long form. The long form consists
- of up to seven elements, separated by colons:
-
- ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
- nfsaddrs= is an alias to ip= and can be used too.
-
- <client-ip> IP address of the client. If empty, the address will
- either be determined by RARP/BOOTP/DHCP. What protocol
- is used de- pends on the <autoconf> parameter. If this
- parameter is not empty, autoconf will be used.
-
- <server-ip> IP address of the NFS server. If RARP is used to
- determine the client address and this parameter is NOT
- empty only replies from the specified server are
- accepted. To use different RARP and NFS server,
- specify your RARP server here (or leave it blank), and
- specify your NFS server in the 'nfsroot' parameter
- (see above). If this entry is blank the address of the
- server is used which answered the RARP/BOOTP/DHCP
- request.
-
- <gw-ip> IP address of a gateway if the server is on a different
- subnet. If this entry is empty no gateway is used and the
- server is assumed to be on the local network, unless a
- value has been received by BOOTP/DHCP.
-
- <netmask> Netmask for local network interface. If this is empty,
- the netmask is derived from the client IP address assuming
- classful addressing, unless overridden in BOOTP/DHCP reply.
-
- <hostname> Name of the client. If empty, the client IP address is
- used in ASCII notation, or the value received by
- BOOTP/DHCP.
-
- <device> Name of network device to use. If this is empty, all
- devices are used for RARP/BOOTP/DHCP requests, and the
- first one we receive a reply on is configured. If you
- have only one device, you can safely leave this blank.
-
- <autoconf> Method to use for autoconfiguration. If this is either
- 'rarp', 'bootp', or 'dhcp' the specified protocol is
- used. If the value is 'both', 'all' or empty, all
- protocols are used. 'off', 'static' or 'none' means
- no autoconfiguration.
- Examples:
- ip=127.0.0.1:::::lo:none --> Enable the loopback interface.
- ip=192.168.1.1:::::eth2:none --> Enable static eth2 interface.
- ip=:::::eth0:dhcp --> Enable dhcp protcol for eth0 configuration.
-
- nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
-
- If the 'nfsroot' parameter is NOT given on the command line, the default
- "/tftpboot/%s" will be used.
-
- <server-ip> Specifies the IP address of the NFS server. If this field
- is not given, the default address as determined by the
- 'ip' variable (see below) is used. One use of this
- parameter is for example to allow using different servers
- for RARP and NFS. Usually you can leave this blank.
-
- <root-dir> Name of the directory on the server to mount as root. If
- there is a "%s" token in the string, the token will be
- replaced by the ASCII-representation of the client's IP
- address.
-
- <nfs-options> Standard NFS options. All options are separated by commas.
- If the options field is not given, the following defaults
- will be used:
- port = as given by server portmap daemon
- rsize = 1024
- wsize = 1024
- timeo = 7
- retrans = 3
- acregmin = 3
- acregmax = 60
- acdirmin = 30
- acdirmax = 60
- flags = hard, nointr, noposix, cto, ac
-
- root=/dev/nfs
-
- If you don't use nfsroot= parameter you need to set root=/dev/nfs
- to boot from a nfs root by autoconfiguration.
+help() {
+ cat <<HELPEOF
+This hook loads the necessary modules for a network device.
+Detection will take place at runtime. To minimize the modules
+in the image, add the autodetect hook too.
+For pcmcia net devices please use pcmcia hook too.
+
+Kernel Parameters:
+An interface spec can be either short form, which is just the name of
+an interface (eth0 or whatever), or long form. The long form consists
+of up to seven elements, separated by colons:
+
+ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
+nfsaddrs= is an alias to ip= and can be used too.
+
+<client-ip> IP address of the client. If empty, the address will
+ either be determined by RARP/BOOTP/DHCP. What protocol
+ is used de- pends on the <autoconf> parameter. If this
+ parameter is not empty, autoconf will be used.
+
+<server-ip> IP address of the NFS server. If RARP is used to
+ determine the client address and this parameter is NOT
+ empty only replies from the specified server are
+ accepted. To use different RARP and NFS server,
+ specify your RARP server here (or leave it blank), and
+ specify your NFS server in the 'nfsroot' parameter
+ (see above). If this entry is blank the address of the
+ server is used which answered the RARP/BOOTP/DHCP
+ request.
+
+<gw-ip> IP address of a gateway if the server is on a different
+ subnet. If this entry is empty no gateway is used and the
+ server is assumed to be on the local network, unless a
+ value has been received by BOOTP/DHCP.
+
+<netmask> Netmask for local network interface. If this is empty,
+ the netmask is derived from the client IP address assuming
+ classful addressing, unless overridden in BOOTP/DHCP reply.
+
+<hostname> Name of the client. If empty, the client IP address is
+ used in ASCII notation, or the value received by
+ BOOTP/DHCP.
+
+<device> Name of network device to use. If this is empty, all
+ devices are used for RARP/BOOTP/DHCP requests, and the
+ first one we receive a reply on is configured. If you
+ have only one device, you can safely leave this blank.
+
+<autoconf> Method to use for autoconfiguration. If this is either
+ 'rarp', 'bootp', or 'dhcp' the specified protocol is
+ used. If the value is 'both', 'all' or empty, all
+ protocols are used. 'off', 'static' or 'none' means
+ no autoconfiguration.
+Examples:
+ip=127.0.0.1:::::lo:none --> Enable the loopback interface.
+ip=192.168.1.1:::::eth2:none --> Enable static eth2 interface.
+ip=:::::eth0:dhcp --> Enable dhcp protcol for eth0 configuration.
+
+nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
+
+If the 'nfsroot' parameter is NOT given on the command line, the default
+"/tftpboot/%s" will be used.
+
+<server-ip> Specifies the IP address of the NFS server. If this field
+ is not given, the default address as determined by the
+ 'ip' variable (see below) is used. One use of this
+ parameter is for example to allow using different servers
+ for RARP and NFS. Usually you can leave this blank.
+
+<root-dir> Name of the directory on the server to mount as root. If
+ there is a "%s" token in the string, the token will be
+ replaced by the ASCII-representation of the client's IP
+ address.
+
+<nfs-options> Standard NFS options. All options are separated by commas.
+ If the options field is not given, the following defaults
+ will be used:
+ port = as given by server portmap daemon
+ rsize = 1024
+ wsize = 1024
+ timeo = 7
+ retrans = 3
+ acregmin = 3
+ acregmax = 60
+ acdirmin = 30
+ acdirmax = 60
+ flags = hard, nointr, noposix, cto, ac
+
+root=/dev/nfs
+
+If you don't use nfsroot= parameter you need to set root=/dev/nfs
+to boot from a nfs root by autoconfiguration.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/pata b/install/pata
index 75a75c1..c51356e 100644
--- a/install/pata
+++ b/install/pata
@@ -9,7 +9,7 @@ build() {
}
help() {
- cat<<HELPEOF
+ cat <<HELPEOF
This hook loads the necessary modules for a pata (ide) root device, using the
new libata subsystem. Detection will take place at runtime. To minimize the
modules in the image, add the autodetect hook too.
diff --git a/install/pcmcia b/install/pcmcia
index 7930d83..b390497 100644
--- a/install/pcmcia
+++ b/install/pcmcia
@@ -1,25 +1,23 @@
-# vim: set ft=sh:
+#!/bin/bash
-build()
-{
+build() {
+ FILES="/etc/pcmcia/config.opts"
MODULES=" $(checked_modules '/drivers/pcmcia/' | grep -ve 'sound' -e 'net') $(checked_modules '/ide/legacy')"
- MODULES=$(echo ${MODULES}) #trim whitespace
- if [ -n "${MODULES}" ]; then
- MODULES="${MODULES} sd_mod"
+
+ if [[ $MODULES ]]; then
+ MODULES+=" sd_mod"
fi
- BINARIES=""
- FILES="/etc/pcmcia/config.opts"
- SCRIPT=""
add_binary "/lib/udev/pcmcia-socket-startup"
add_binary "/lib/udev/pcmcia-check-broken-cis"
add_file "/lib/udev/rules.d/60-pcmcia.rules"
}
-help ()
-{
-cat<<HELPEOF
- This hook loads the necessary modules for a pcmcia root device.
- Detection will take place at runtime. To minimize the modules
- in the image, add the autodetect hook too.
+help() {
+ cat <<HELPEOF
+This hook loads the necessary modules for a pcmcia root device. Detection will
+take place at runtime. To minimize the modules in the image, add the autodetect
+hook too.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/resume b/install/resume
index dcf6442..d261aad 100644
--- a/install/resume
+++ b/install/resume
@@ -1,17 +1,14 @@
-# vim:set ft=sh:
+#!/bin/bash
-build()
-{
- MODULES=""
- BINARIES=""
- FILES=""
+build() {
SCRIPT="resume"
}
-help ()
-{
-cat<<HELPEOF
- This hook initializes support for resuming from Disk.
- Supports swsusp and suspend2.
+help() {
+ cat <<HELPEOF
+This hook initializes support for resuming from Disk. Supports swsusp and
+suspend2.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/sata b/install/sata
index 1b39d5f..39fe805 100644
--- a/install/sata
+++ b/install/sata
@@ -10,7 +10,7 @@ build() {
}
help() {
- cat<<HELPEOF
+ cat <<HELPEOF
This hook loads the necessary modules for an sata root device. Detection will
take place at runtime. To minimize the modules in the image, add the autodetect
hook too.
diff --git a/install/scsi b/install/scsi
index 2641255..fa9e5d9 100644
--- a/install/scsi
+++ b/install/scsi
@@ -10,7 +10,7 @@ build(){
}
help() {
- cat<<HELPEOF
+ cat <<HELPEOF
This hook loads the necessary modules for an scsi root device. Detection will
take place at runtime. To minimize the modules in the image, add the autodetect
hook too.
diff --git a/install/sleep b/install/sleep
index c7a8902..b81e1ca 100644
--- a/install/sleep
+++ b/install/sleep
@@ -1,22 +1,17 @@
-# vim:set ft=sh:
+#!/bin/bash
-build()
-{
- MODULES=""
- BINARIES=""
- FILES=""
+build() {
SCRIPT="sleep"
}
-help ()
-{
-cat <<HELPEOF
- This hook causes the init process to interrupt
- for a fixed time interval. The time in seconds
- can be specified in the sleeptime= command line
- parameter. The default is 5 seconds.
- If a sleepdevice= parameter is specified, sleep
- until the given device node is available, polling
- at one second intervals until sleeptime is reached.
+help() {
+ cat <<HELPEOF
+This hook causes the init process to interrupt for a fixed time interval. The
+time in seconds can be specified in the sleeptime= command line parameter. The
+default is 5 seconds. If a sleepdevice= parameter is specified, sleep until the
+given device node is available, polling at one second intervals until sleeptime
+is reached.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/udev b/install/udev
index 74c9b5e..6d0804b 100644
--- a/install/udev
+++ b/install/udev
@@ -1,27 +1,26 @@
-# vim:set ft=sh:
+#!/bin/bash
-build()
-{
- MODULES=""
- BINARIES=""
- FILES=" /etc/udev/udev.conf"
+build() {
+ FILES="/etc/udev/udev.conf"
SCRIPT="udev"
+
add_binary /sbin/udevd
add_binary /sbin/udevadm
- for rules in 50-firmware.rules 50-udev-default.rules 60-persistent-storage.rules 80-drivers.rules; do
- add_file /lib/udev/rules.d/${rules}
+
+ for rules in 50-{firmware,udev-default}.rules 60-persistent-storage.rules 80-drivers.rules; do
+ add_file "/lib/udev/rules.d/$rules"
done
- for tool in firmware ata_id path_id scsi_id usb_id; do
- add_file /lib/udev/${tool}
+ for tool in firmware {ata,path,scsi,usb}_id; do
+ add_file "/lib/udev/$tool"
done
}
-help ()
-{
-cat <<HELPEOF
- This hook will use udev to create your root device node
- and detect the needed modules for your root device. It
- is also required for firmware loading in initramfs.
- It is recommended to use this hook.
+help() {
+ cat <<HELPEOF
+This hook will use udev to create your root device node and detect the needed
+modules for your root device. It is also required for firmware loading in
+initramfs. It is recommended to use this hook.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/usb b/install/usb
index db2d08e..61020ab 100644
--- a/install/usb
+++ b/install/usb
@@ -1,24 +1,20 @@
-# vim: set ft=sh:
+#!/bin/bash
-build()
-{
- MODULES=" $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd")"
+build() {
+ MODULES="$(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd")"
- MODULES=$(echo ${MODULES}) #trim whitespace
- if [ -n "${MODULES}" ]; then
- MODULES="${MODULES} usb_storage sd_mod sr_mod"
- MODULES="${MODULES} $(checked_modules "drivers/usb/storage/ums-*")"
+ if [[ $MODULES ]]; then
+ MODULES+=" usb_storage sd_mod sr_mod"
+ MODULES+=" $(checked_modules "drivers/usb/storage/ums-*")"
fi
- BINARIES=""
- FILES=""
- SCRIPT=""
}
-help ()
-{
-cat<<HELPEOF
- This hook loads the necessary modules for an usb root device.
- Detection will take place at runtime. To minimize the modules
- in the image, add the autodetect hook too.
+help() {
+ cat <<HELPEOF
+This hook loads the necessary modules for an usb root device. Detection will
+take place at runtime. To minimize the modules in the image, add the autodetect
+hook too.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/usbinput b/install/usbinput
index e4bf27e..aa4e1a6 100644
--- a/install/usbinput
+++ b/install/usbinput
@@ -1,24 +1,18 @@
-# vim: set ft=sh:
+#!/bin/bash
-build()
-{
- MODULES=" $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd") "
- MODULES=" $(echo ${MODULES}) $(all_modules "/hid/hid-") "
+build() {
+ MODULES=" $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd")"
+ MODULES+=" $(all_modules "/hid/hid-")"
- MODULES=$(echo ${MODULES}) #trim whitespace
- if [ -n "${MODULES}" ]; then
- MODULES="${MODULES} usbhid"
- fi
- BINARIES=""
- FILES=""
- SCRIPT=""
+ [[ $MODULES ]] && MODULES+=" usbhid"
}
-help ()
-{
-cat<<HELPEOF
- This hook loads the necessary modules for an usb input device.
- Detection will take place at runtime. To minimize the modules
- in the image, add the autodetect hook too.
+help() {
+ cat <<HELPEOF
+This hook loads the necessary modules for an usb input device. Detection
+will take place at runtime. To minimize the modules in the image, add the
+autodetect hook too.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et: