Skip to content
Browse files

general builder code standardized/cleanup

  • Loading branch information...
1 parent c417876 commit 49078e247b8e8e7aacf2ff4fde6e321bc10ba7d5 @falconindy committed May 4, 2011
Showing with 139 additions and 103 deletions.
  1. +4 −2 builders/ata
  2. +3 −2 builders/autodetect
  3. +3 −2 builders/base
  4. +4 −2 builders/btrfs
  5. +14 −12 builders/consolefont
  6. +10 −12 builders/dmesg
  7. +6 −4 builders/dsdt
  8. +2 −0 builders/filesystems
  9. +2 −1 builders/firewire
  10. +2 −1 builders/fw
  11. +4 −2 builders/ide
  12. +14 −10 builders/keymap
  13. +4 −2 builders/lvm2
  14. +4 −2 builders/mdadm
  15. +15 −13 builders/memdisk
  16. +10 −10 builders/net
  17. +5 −3 builders/pcmcia
  18. +9 −10 builders/resume
  19. +4 −2 builders/scsi
  20. +4 −3 builders/ubase
  21. +4 −2 builders/udev
  22. +4 −2 builders/usb
  23. +3 −2 builders/usbinput
  24. +3 −2 builders/v86d
  25. +1 −0 geninit
  26. +1 −0 geninit.api
View
6 builders/ata
@@ -5,8 +5,10 @@ build() {
}
helpmsg() {
- cat<<EOF
+ cat<<HELPEOF
This hook loads the necessary modules for an ata root device. It covers PATA
as well as SATA.
-EOF
+HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
5 builders/autodetect
@@ -28,10 +28,11 @@ build() {
}
helpmsg() {
- cat <<EOF
+ cat<<HELPEOF
This hook autodetects needed modules for the initramfs. This hook should be
placed after base in order to best take advantage of it. Any hooks placed
prior to this hook will be installed in full.
-EOF
+HELPEOF
}
+# vim: set et ts=2 sw=2:
View
5 builders/base
@@ -26,9 +26,10 @@ build() {
}
helpmsg() {
- cat<<EOF
+ cat<<HELPEOF
This hook provides a crucial base layout for the initramfs. Do not remove
skip this unless you know exactly what you are doing.
-EOF
+HELPEOF
}
+# vim: set et ts=2 sw=2:
View
6 builders/btrfs
@@ -7,7 +7,9 @@ build() {
}
helpmsg() {
- cat <<EOF
+ cat<<HELPEOF
This hook supports multi device btrfs volumes.
-EOF
+HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
26 builders/consolefont
@@ -5,27 +5,29 @@ build() {
eval "$(grep "^CONSOLEFONT=" /etc/rc.conf)"
if [[ -z $CONSOLEFONT ]]; then
- err "no appropriate file found for consolefont"
+ error "no appropriate file found for consolefont"
return 0
fi
- if [ -e /usr/share/kbd/consolefonts/$CONSOLEFONT.psfu.gz ]; then
+ if [[ -f /usr/share/kbd/consolefonts/$CONSOLEFONT.psfu.gz ]]; then
CONSOLEFONT_FILE_GZ="/usr/share/kbd/consolefonts/$CONSOLEFONT.psfu.gz"
- CONSOLEFONT_FILE="$(mktemp ${TMPDIR}/consolefont.psfu.XXXXXX)"
- zcat ${CONSOLEFONT_FILE_GZ} > ${CONSOLEFONT_FILE}
+ CONSOLEFONT_FILE="$(mktemp "$tmpdir/consolefont.psfu.XXXXXX")"
+ gzip -cd "$CONSOLEFONT_FILE_GZ" > "$CONSOLEFONT_FILE"
add_file ${CONSOLEFONT_FILE} /consolefont.psfu
- elif [ -e /usr/share/kbd/consolefonts/$CONSOLEFONT.psf.gz ]; then
+ elif [[ -f /usr/share/kbd/consolefonts/$CONSOLEFONT.psf.gz ]]; then
CONSOLEFONT_FILE_GZ="/usr/share/kbd/consolefonts/$CONSOLEFONT.psf.gz"
- CONSOLEFONT_FILE="$(mktemp ${TMPDIR}/consolefont.psf.XXXXXX)"
- zcat ${CONSOLEFONT_FILE_GZ} > ${CONSOLEFONT_FILE}
- add_file ${CONSOLEFONT_FILE} /consolefont.psf
+ CONSOLEFONT_FILE="$(mktemp "$tmpdir/consolefont.psf.XXXXXX")"
+ gzip -cd "$CONSOLEFONT_FILE_GZ" > "$CONSOLEFONT_FILE"
+ add_file "$CONSOLEFONT_FILE" /consolefont.psf
else
- echo "consolefont: Font file does not exist or does not end with .psf.gz or .psfu.gz."
+ error "consolefont: Font file does not exist or does not end with .psf.gz or .psfu.gz."
fi
}
helpmsg() {
- cat<<EOF
- This hook loads consolefont specified in rc.conf during early userspace.
-EOF
+ cat<<HELPEOF
+ This hook loads the CONSOLEFONT specified in rc.conf during early userspace.
+HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
22 builders/dmesg
@@ -1,17 +1,15 @@
-# vim: set ft=sh:
+#!/bin/bash
+
build() {
- MODULES=""
- BINARIES=""
- FILES=""
- SCRIPT="dmesg"
+ use_hookscript
}
-help ()
-{
-cat<<HELPEOF
- This hook lowers the console log level to 3.
- It is useful when the user has to interact
- with the boot process during early userspace
- (like when entering a passphrase).
+helpmsg() {
+ cat<<HELPEOF
+ This hook lowers the console log level to 3. It is useful when the user has
+ to interact with the boot process during early userspace (like when entering
+ a passphrase).
HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
10 builders/dsdt
@@ -1,12 +1,14 @@
-# vim: set ft=sh:
+#!/bin/bash
build() {
- add_file "/lib/initcpio/custom.dsdt" "DSDT.aml"
+ add_file "/lib/initcpio/custom.dsdt" "/DSDT.aml"
}
helpmsg() {
- cat<<EOF
+ cat<<HELPEOF
This hook loads a custom acpi dsdt file during boot. Place your custom dsdt
file for inclusion in: /usr/share/geninit/custom.dsdt
-EOF
+HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
2 builders/filesystems
@@ -10,3 +10,5 @@ helpmsg() {
This hook adds filesystems modules to the image.
HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
3 builders/firewire
@@ -1,4 +1,4 @@
-# vim: set ft=sh:
+#!/bin/bash
build() {
add_driver_classes drivers/firewire
@@ -14,3 +14,4 @@ helpmsg() {
HELPEOF
}
+# vim: set et ts=2 sw=2:
View
3 builders/fw
@@ -1,4 +1,4 @@
-# vim: set ft=sh:
+#!/bin/bash
build() {
add_driver_classes drivers/firewire
@@ -14,3 +14,4 @@ helpmsg() {
HELPEOF
}
+# vim: set et ts=2 sw=2:
View
6 builders/ide
@@ -5,8 +5,10 @@ build() {
}
helpmsg() {
- cat<<EOF
+ cat<<HELPEOF
This hook loads the necessary modules for a legacy ide root device. Chances
are high that you can use the ata hook instead of this.
-EOF
+HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
24 builders/keymap
@@ -1,26 +1,30 @@
#!/bin/bash
build() {
+ local keymapfile utf8file
+
use_hookscript
eval "$(grep -E "^(LOCALE|KEYMAP)=" /etc/rc.conf)"
if [[ $KEYMAP ]]; then
- KEYMAP_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)"
- UTF8_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)"
+ keymapfile="$(mktemp "$tmpdir/keymap.XXXXXX")"
+ utf8file="$(mktemp "$tmpdir/keymap.XXXXXX")"
if [[ $LOCALE =~ utf ]]; then
- echo "UTF8='yes'" > $UTF8_FILE
- /bin/loadkeys -q -u $KEYMAP -b > $KEYMAP_FILE
+ echo "UTF8='yes'" > "$utf8file"
+ /bin/loadkeys -q -u $KEYMAP -b > "$keymapfile"
else
- echo "UTF8='no'" > $UTF8_FILE
- /bin/loadkeys -q $KEYMAP -b > $KEYMAP_FILE
+ echo "UTF8='no'" > "$utf8file"
+ /bin/loadkeys -q $KEYMAP -b > "$keymapfile"
fi
- add_file "@$KEYMAP_FILE" /keymap.bin
- add_file "@$UTF8_FILE" /keymap.utf8
+ add_file "@$keymapfile" /keymap.bin
+ add_file "@$utf8file" /keymap.utf8
fi
}
helpmsg() {
- cat<<EOF
+ cat<<HELPEOF
This hook loads keymap(s) specified in rc.conf during early userspace.
-EOF
+HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
6 builders/lvm2
@@ -17,7 +17,9 @@ build() {
}
helpmsg() {
- cat<<EOF
+ cat<<HELPEOF
This hook loads the necessary modules for an lvm2 root device.
-EOF
+HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
6 builders/mdadm
@@ -9,8 +9,10 @@ build() {
}
helpmsg() {
- cat<<EOF
+ cat<<HELPEOF
This hook loads the necessary modules for an mdadm root device. Arrays are
assembled at runtime via udev.
-EOF
+HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
28 builders/memdisk
@@ -1,19 +1,21 @@
-# vim:set ft=sh:
+#!/bin/bash
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
-}
+ use_hookscript
+
+ add_module phram
+ add_module mtdblock
-help ()
-{
-cat <<HELPEOF
- This hook detects a virtual disk created by the memdisk
- tool (http://syslinux.zytor.com/wiki/index.php/MEMDISK).
+ add_binary /usr/bin/memdiskfind
- It requires memdiskfind from syslinux 4.00 or newer.
+ add_file /lib/initcpio/udev/01-memdisk.rules /lib/udev/rules.d/01-memdisk.rules
+}
+
+helpmsg() {
+ cat<<HELPEOF
+ This hook detects a virtual disk created by the memdisk tool
+ (http://syslinux.zytor.com/wiki/index.php/MEMDISK).
HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
20 builders/net
@@ -1,19 +1,17 @@
-# vim: set ft=sh:
+#!/bin/bash
build() {
- MODULES="nfs $(checked_modules "/drivers/net/") "
+ use_hookscript
- BINARIES=""
- FILES=""
- SCRIPT="net"
+ add_module nfs
+ add_driver_classes drivers/net
- add_binary "/lib/initcpio/ipconfig" "/bin/ipconfig"
- add_binary "/lib/initcpio/nfsmount" "/bin/nfsmount"
+ add_binary "/lib/initcpio/ipconfig" "/bin/ipconfig"
+ add_binary "/lib/initcpio/nfsmount" "/bin/nfsmount"
}
-help ()
-{
-cat<<HELPEOF
+helpmsg() {
+ 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.
@@ -106,3 +104,5 @@ cat<<HELPEOF
to boot from a nfs root by autoconfiguration.
HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
8 builders/pcmcia
@@ -1,4 +1,4 @@
-# vim: set ft=sh:
+#!/bin/bash
build() {
add_driver_classes drivers/pcmcia drivers/ide/legacy && add_module sd_mod
@@ -10,7 +10,9 @@ build() {
}
helpmsg() {
- cat<<EOF
+ cat<<HELPEOF
This hook provides the necessary modules for a pcmcia root device.
-EOF
+HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
19 builders/resume
@@ -1,15 +1,14 @@
-# vim:set ft=sh:
+#!/bin/bash
+
build() {
- MODULES=""
- BINARIES=""
- FILES=""
- SCRIPT="resume"
+ use_hookscript
}
-help ()
-{
-cat<<HELPEOF
- This hook initializes support for resuming from Disk.
- Supports swsusp and suspend2.
+helpmsg() {
+ cat<<HELPEOF
+ This hook initializes support for resuming from disk. Supports swsusp and
+ suspend2.
HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
6 builders/scsi
@@ -7,7 +7,9 @@ build() {
}
helpmsg() {
- cat<<EOF
+ cat<<HELPEOF
This hook loads the necessary modules for an scsi root device.
-EOF
+HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
7 builders/ubase
@@ -1,3 +1,4 @@
+#!/bin/bash
# an absolutely bare bones setup. no busybox, no udev. you MUST declare all
# needed modules in your config's MODULES array.
#
@@ -17,10 +18,10 @@ build() {
add_binary /sbin/modprobe
}
-help() {
- cat <<HELPEOF
+helpmsg() {
+ cat<<HELPEOF
This hook sets up very little.
HELPEOF
}
-# vim: set et sw=2 ft=sh:
+# vim: set et ts=2 sw=2:
View
6 builders/udev
@@ -23,9 +23,11 @@ build() {
}
helpmsg() {
- cat <<EOF
+ 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.
-EOF
+HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
6 builders/usb
@@ -10,7 +10,9 @@ build() {
}
helpmsg() {
- cat<<EOF
+ cat<<HELPEOF
This hook loads the necessary modules for an usb root device.
-EOF
+HELPEOF
}
+
+# vim: set et ts=2 sw=2:
View
5 builders/usbinput
@@ -5,10 +5,11 @@ build() {
}
helpmsg() {
- cat<<EOF
+ 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.
-EOF
+HELPEOF
}
+# vim: set et ts=2 sw=2:
View
5 builders/v86d
@@ -6,8 +6,9 @@ build() {
}
helpmsg() {
- cat<<EOF
+ cat<<HELPEOF
This hook includes support for v86d, the userspace helper for uvesafb.
-EOF
+HELPEOF
}
+# vim: set et ts=2 sw=2:
View
1 geninit
@@ -506,3 +506,4 @@ fi
cleanup $?
+# vim: set et sw=2 ft=sh:
View
1 geninit.api
@@ -216,3 +216,4 @@ add_driver_classes() { # {{{
return $(( ! ret ))
} # }}}
+# vim: set et sw=2 ft=sh:

0 comments on commit 49078e2

Please sign in to comment.
Something went wrong with that request. Please try again.