[arch-releng] [PATCH 03/12] [archiso] Misc style cleanups

Gerardo Exequiel Pozzi vmlinuz386 at yahoo.com.ar
Wed Feb 22 22:30:42 EST 2012


* Add #!/bin/bash to install hooks and fixed vimlines.
* Removed empty variables.
* Reorder variables, adjust brace/parens in functions.
* Removed things implemented in base hook (/tmp, /etc/fstab).

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
---
 archiso/archiso_shutdown           |    2 +-
 archiso/install/archiso            |   16 +++++-----------
 archiso/install/archiso_loop_mnt   |   15 +++++----------
 archiso/install/archiso_pxe_common |   19 ++++++++-----------
 archiso/install/archiso_pxe_http   |   13 +++++--------
 archiso/install/archiso_pxe_nbd    |   14 ++++++--------
 archiso/install/archiso_pxe_nfs    |    6 ++++--
 archiso/install/archiso_shutdown   |    9 +++++++--
 8 files changed, 41 insertions(+), 53 deletions(-)

diff --git a/archiso/archiso_shutdown b/archiso/archiso_shutdown
index de1197e..26220a6 100644
--- a/archiso/archiso_shutdown
+++ b/archiso/archiso_shutdown
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/ash
 
 # /oldroot depends on things inside /oldroot/run/archiso...
 mkdir /oldrun
diff --git a/archiso/install/archiso b/archiso/install/archiso
index 25eccea..878839b 100644
--- a/archiso/install/archiso
+++ b/archiso/install/archiso
@@ -1,9 +1,8 @@
-build ()
-{
-    MODULES="cdrom loop dm-snapshot"
+#!/bin/bash
 
-    BINARIES=""
-    FILES=""
+build() {
+    MODULES="cdrom loop dm-snapshot"
+    SCRIPT="archiso"
 
     add_binary /lib/udev/cdrom_id
     add_binary blockdev
@@ -15,11 +14,6 @@ build ()
     add_file /lib/udev/rules.d/10-dm.rules
     add_file /lib/udev/rules.d/95-dm-notify.rules
     add_file /lib/initcpio/udev/11-dm-initramfs.rules /lib/udev/rules.d/11-dm-initramfs.rules
-
-    # Add an empty fstab to avoid mount warning when -o remount is used (this should go to install/base)
-    : > "$BUILDROOT/etc/fstab"
-
-    SCRIPT="archiso"
 }
 
-# vim:ft=sh:ts=4:sw=4:et:
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/archiso/install/archiso_loop_mnt b/archiso/install/archiso_loop_mnt
index 886cbb8..4141043 100644
--- a/archiso/install/archiso_loop_mnt
+++ b/archiso/install/archiso_loop_mnt
@@ -1,18 +1,13 @@
-# vim: set ft=sh:
-
-build ()
-{
-    MODULES=""
-
-    BINARIES=""
-    FILES=""
+#!/bin/bash
 
+build() {
     SCRIPT="archiso_loop_mnt"
 }
 
-help ()
-{
+help() {
 cat<<HELPEOF
   This hook loads the necessary modules for boot via loop device.
 HELPEOF
 }
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/archiso/install/archiso_pxe_common b/archiso/install/archiso_pxe_common
index ce54f7a..b37e5a1 100644
--- a/archiso/install/archiso_pxe_common
+++ b/archiso/install/archiso_pxe_common
@@ -1,33 +1,30 @@
-# vim: set ft=sh:
+#!/bin/bash
 
-build ()
-{
+build() {
     MODULES="${MODULES} $(comm -2 -3 <(checked_modules "/drivers/net/" | sort) \
                                      <(find $MODULEDIR/kernel/drivers/net/{irda,phy,wimax,wireless} \
                                             -name '*.ko*' \
                                             -exec bash -c 'printf "%s\n" "${@%%.ko*}" | sed "s at .*/@@;s at -@_@" | sort' _ {} +) \
                                      | grep -v -e 'ppp_' -e 'plip' -e 'pppoe')"
-    BINARIES=""
-    FILES=""
     SCRIPT="archiso_pxe_common"
 
-    # Add here for now, but this should go to "install/base".
-    add_dir /tmp
-    add_dir /etc
 
-    add_binary "/lib/initcpio/ipconfig" "/bin/ipconfig"
+    add_binary /lib/initcpio/ipconfig /bin/ipconfig
 
     # Add hosts support files+dns
     add_symlink /lib/libnss_files.so.2 $(readlink /lib/libnss_files.so.2)
     add_binary $(readlink -f /lib/libnss_files.so.2)
     add_symlink /lib/libnss_dns.so.2 $(readlink /lib/libnss_dns.so.2)
     add_binary $(readlink -f /lib/libnss_dns.so.2)
+
+    add_dir /etc
     echo "hosts: files dns" > $BUILDROOT/etc/nsswitch.conf
 }
 
-help ()
-{
+help() {
 cat<<HELPEOF
   This hook loads the necessary modules for boot via PXE.
 HELPEOF
 }
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/archiso/install/archiso_pxe_http b/archiso/install/archiso_pxe_http
index 38a8ee5..9e2ff65 100644
--- a/archiso/install/archiso_pxe_http
+++ b/archiso/install/archiso_pxe_http
@@ -1,18 +1,15 @@
-# vim: set ft=sh:
+#!/bin/bash
 
-build ()
-{
-    MODULES=""
-    BINARIES=""
-    FILES=""
+build() {
     SCRIPT="archiso_pxe_http"
 
     add_binary curl
 }
 
-help ()
-{
+help() {
 cat<<HELPEOF
   This hook loads the necessary modules for boot via PXE and HTTP.
 HELPEOF
 }
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/archiso/install/archiso_pxe_nbd b/archiso/install/archiso_pxe_nbd
index 747e5b9..0784e2c 100644
--- a/archiso/install/archiso_pxe_nbd
+++ b/archiso/install/archiso_pxe_nbd
@@ -1,20 +1,18 @@
-# vim: set ft=sh:
+#!/bin/bash
 
-build ()
-{
+build() {
     MODULES="nbd"
-    BINARIES=""
-    FILES=""
     SCRIPT="archiso_pxe_nbd"
 
     add_binary nbd-client
 
-    add_file "/lib/initcpio/archiso_pxe_nbd" "/archiso_pxe_nbd"
+    add_file /lib/initcpio/archiso_pxe_nbd /archiso_pxe_nbd
 }
 
-help ()
-{
+help() {
 cat<<HELPEOF
   This hook loads the necessary modules for boot via PXE and NBD.
 HELPEOF
 }
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/archiso/install/archiso_pxe_nfs b/archiso/install/archiso_pxe_nfs
index 52be9f3..f7b6f5d 100644
--- a/archiso/install/archiso_pxe_nfs
+++ b/archiso/install/archiso_pxe_nfs
@@ -1,10 +1,10 @@
-# vim: set ft=sh:
+#!/bin/bash
 
 build() {
     MODULES="nfs"
     SCRIPT="archiso_pxe_nfs"
 
-    add_binary "/lib/initcpio/nfsmount" "/bin/nfsmount"
+    add_binary /lib/initcpio/nfsmount /bin/nfsmount
 }
 
 help() {
@@ -12,3 +12,5 @@ help() {
   This hook loads the necessary modules for boot via PXE and NFS.
 HELPEOF
 }
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/archiso/install/archiso_shutdown b/archiso/install/archiso_shutdown
index 49dfc8c..7ef3137 100644
--- a/archiso/install/archiso_shutdown
+++ b/archiso/install/archiso_shutdown
@@ -1,9 +1,12 @@
+#!/bin/bash
+
 build() {
     SCRIPT="archiso_shutdown"
-    add_binary /lib/initcpio/archiso_shutdown /shutdown
+
+    add_file /lib/initcpio/archiso_shutdown /shutdown
 }
 
-help () {
+help() {
     cat <<HELPEOF
 This hook will create a shutdown initramfs in /run/initramfs
 that we can pivot to on shutdown in order to unmount / and
@@ -11,3 +14,5 @@ and others mount points, dm-snapshot devices and loopback devices.
 Mostly usefull for dm-snapshot persistent.
 HELPEOF
 }
+
+# vim: set ft=sh ts=4 sw=4 et:
-- 
1.7.9.1



More information about the arch-releng mailing list