summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2011-07-03 14:11:09 +0200
committerThomas Bächler <thomas@archlinux.org>2011-07-03 14:11:09 +0200
commit179d4d5db40ec89144fbb11b0ef2e23105466890 (patch)
tree88ad0ffb4c48f422eed5661c834548aec5cac1ff
parent320ef8bdebf867f18cf475bcf46dd578c6295fd7 (diff)
parenta079f4f2b3607ae4fcfe72dba913d6589fa35f4c (diff)
downloadmkinitcpio-179d4d5db40ec89144fbb11b0ef2e23105466890.tar.gz
mkinitcpio-179d4d5db40ec89144fbb11b0ef2e23105466890.tar.xz
Merge branch 'working' of https://github.com/falconindy/mkinitcpio into working
-rw-r--r--functions5
-rw-r--r--install/base17
-rwxr-xr-xmkinitcpio7
3 files changed, 19 insertions, 10 deletions
diff --git a/functions b/functions
index ac7da7e..ffb00ec 100644
--- a/functions
+++ b/functions
@@ -46,9 +46,8 @@ in_array() {
# $1: needle
# ${@:2}: haystack
- local needle=$1; shift
- [[ -z $1 ]] && return 1 # Not Found
- local item
+ local item= needle=$1; shift
+
for item in "$@"; do
[[ $item = $needle ]] && return 0 # Found
done
diff --git a/install/base b/install/base
index 446167c..64ef39a 100644
--- a/install/base
+++ b/install/base
@@ -13,8 +13,21 @@ build() {
add_file "/lib/initcpio/init" "/init"
add_file "/etc/modprobe.d/usb-load-ehci-first.conf"
- # private API call is required here
- _add_file "/config" "$CONFIG" 644
+ # write a new config file. re-source the config as we can't guarantee the
+ # environment hasn't been modified, but subshell it so it doesn't disturb
+ # anyone else.
+ (
+ . "$CONFIG"
+
+ # sanitize of any extra whitespace
+ read -r -a modules <<< "$MODULES"
+ read -r -a hooks <<< "$HOOKS"
+
+ {
+ (( ${#modules[*]} )) && printf 'MODULES="%s"\n' "${modules[*]}"
+ (( ${#hooks[*]} )) && printf 'HOOKS="%s"\n' "${hooks[*]}"
+ } >"$BUILDROOT/config"
+ )
}
help() {
diff --git a/mkinitcpio b/mkinitcpio
index d4ebf94..289c98d 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -14,7 +14,6 @@ shopt -s extglob
# Settings
KERNELVERSION=$(uname -r)
-CARCH=$(uname -m)
FUNCTIONS=functions
CONFIG=mkinitcpio.conf
HOOKDIR=hooks
@@ -34,11 +33,9 @@ PATH=$PATH:/sbin:/usr/sbin
# GREP_OPTIONS="--color=always" will break everything
unset GREP_OPTIONS
-APPNAME=${0##*/}
-
usage() {
cat <<EOF
-usage: $APPNAME [options]
+usage: ${0##*/} [options]
Options:
-b BASEDIR Use BASEDIR. default: /
@@ -46,7 +43,7 @@ usage: $APPNAME [options]
-g IMAGE Generate a cpio image as IMAGE. default: no
-H HOOKNAME Output help for hook 'HOOKNAME'.
-h Display this message.
- -k KERNELVERSION Use KERNELVERSION. default: $(uname -r)
+ -k KERNELVERSION Use KERNELVERSION. default: $KERNELVERSION
-L List all available hooks.
-M Display modules found via autodetection.
-n Disable colorized output messages.