summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile10
-rw-r--r--functions6
-rwxr-xr-xmkinitcpio15
3 files changed, 15 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 66e2d8d..b77e088 100644
--- a/Makefile
+++ b/Makefile
@@ -19,11 +19,11 @@ all: doc
install: all
$(foreach dir,${DIRS},install -dm755 ${DESTDIR}${dir};)
- sed -e 's|CONFIG="mkinitcpio.conf"|CONFIG="/etc/mkinitcpio.conf"|g' \
- -e 's|FUNCTIONS="functions"|FUNCTIONS="/lib/initcpio/functions"|g' \
- -e 's|HOOKDIR="hooks"|HOOKDIR="/lib/initcpio/hooks"|g' \
- -e 's|INSTDIR="install"|INSTDIR="/lib/initcpio/install"|g' \
- -e 's|PRESETDIR="mkinitcpio.d"|PRESETDIR="/etc/mkinitcpio.d"|g' \
+ sed -e 's|^CONFIG=.*|CONFIG=/etc/mkinitcpio.conf|' \
+ -e 's|^FUNCTIONS=.*|FUNCTIONS=/lib/initcpio/functions|' \
+ -e 's|^HOOKDIR=.*|HOOKDIR=/lib/initcpio/hooks|' \
+ -e 's|^INSTDIR=.*|INSTDIR=/lib/initcpio/install|' \
+ -e 's|^PRESETDIR=.*|PRESETDIR=/etc/mkinitcpio.d|' \
< mkinitcpio > ${DESTDIR}/sbin/mkinitcpio
sed "s|%VERSION%|${VERSION}|g" < lsinitcpio > ${DESTDIR}/bin/lsinitcpio
diff --git a/functions b/functions
index bd80eb2..a4f6c0c 100644
--- a/functions
+++ b/functions
@@ -188,8 +188,8 @@ add_module() {
local module path fw dep deps
module=${1%.ko*}
- #skip expensive stuff if this module has already been added
- in_array $module ${ADDED_MODULES[@]} && return
+ # skip expensive stuff if this module has already been added
+ in_array "${module//-/_}" "${ADDED_MODULES[@]}" && return
path=$(kmodinfo -0F filename "$module")
if [[ $path ]]; then
@@ -206,7 +206,7 @@ add_module() {
add_module "$dep"
done
- ADDED_MODULES+=("$module")
+ ADDED_MODULES+=("${module//-/_}")
add_file "$path" || return
else
error "module '$module' not found"
diff --git a/mkinitcpio b/mkinitcpio
index 8d7e371..6db23e9 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -118,9 +118,8 @@ while getopts ':c:k:sb:g:p:m:nvH:LMhS:' arg; do
cleanup
exit 0 ;;
L) msg "Available hooks"
- for h in ${INSTDIR}/*; do
- echo " ${h##*/}"
- done
+ cd "$INSTDIR" >/dev/null
+ printf ' %s\n' * | column -c$(tput cols)
cleanup
exit 0 ;;
M) SHOW_AUTOMODS=1 ;;
@@ -128,7 +127,7 @@ while getopts ':c:k:sb:g:p:m:nvH:LMhS:' arg; do
:) echo "${OPTARG} requires a value..."; usage ;;
esac
done
-shift $((${OPTIND} - 1))
+shift $((OPTIND - 1))
if [[ -t 2 ]] && (( COLOR )); then
# prefer terminal safe colored and bold text when tput is supported
@@ -245,7 +244,7 @@ if (( SHOW_AUTOMODS )); then
exit 0
fi
-if [ -z "${GENIMG}" ]; then
+if [[ -z $GENIMG ]]; then
msg "Starting dry run: %s" "$KERNELVERSION"
else
msg "Starting build: %s" "$KERNELVERSION"
@@ -260,7 +259,7 @@ for hook in ${HOOKS}; do
# Deprecation check
# A hook is considered deprecated if it is a symlink
# within $INSTDIR.
- if [ -h "${INSTDIR}/${hook}" ]; then
+ if [[ -h "${INSTDIR}/${hook}" ]]; then
newhook="$(readlink -ne "${INSTDIR}/${hook}")"
if [ -n "${newhook}" -a "${INSTDIR}/$(get_basename ${newhook})" -ef "${newhook}" ]; then
newhook="$(get_basename ${newhook})"
@@ -292,9 +291,9 @@ fi
declare -i status=0
declare -a pipesave
-if [ -n "${GENIMG}" ]; then
+if [[ "${GENIMG}" ]]; then
msg "Creating $COMPRESSION initcpio image: %s" "$GENIMG"
- [ ${COMPRESSION} = "xz" ] && COMPRESSION_OPTIONS="${COMPRESSION_OPTIONS} --check=crc32"
+ [[ "$COMPRESSION" = xz ]] && COMPRESSION_OPTIONS+=" --check=crc32"
pushd "$TMPDIR/root" >/dev/null
find . -print0 | bsdcpio -0oH newc | $COMPRESSION $COMPRESSION_OPTIONS > "$IMGPATH"