summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functions28
-rw-r--r--install/autodetect3
-rwxr-xr-xmkinitcpio8
3 files changed, 20 insertions, 19 deletions
diff --git a/functions b/functions
index a06434c..96d5fe2 100644
--- a/functions
+++ b/functions
@@ -79,8 +79,8 @@ add_dir ()
{
#skip root directory and "." for relative directories... i.e. /foo/bar/./blah
if [ -n "${1}" -a "${1}" != "/" -a "${1}" != "." ]; then
- if ! grep "dir ${1} " "${FILELIST}" 2>&1 > /dev/null; then
- add_dir $(dirname "${1}")
+ if ! grep -q "dir ${1} " "${FILELIST}"; then
+ add_dir $(get_dirname "${1}")
msg " adding dir ${1}"
echo "dir ${1} 755 0 0" >> "${FILELIST}"
fi
@@ -93,8 +93,8 @@ add_device ()
if [ $# -ge 4 ]; then
local perms
perms="${5:-644}"
- if ! grep "nod ${1}" "${FILELIST}" 2>&1 > /dev/null; then
- add_dir $(dirname "${1}")
+ if ! grep -q "nod ${1}" "${FILELIST}"; then
+ add_dir $(get_dirname "${1}")
msg " adding node ${1}"
echo "nod ${1} ${perms} 0 0 ${2} ${3} ${4}" >> "${FILELIST}"
fi
@@ -111,9 +111,9 @@ add_symlink ()
if [ -h ${1} ]; then
fil="${1##$BASEDIR}"
dest="${2##$BASEDIR}"
- add_dir $(dirname "${dest}")
- add_dir $(dirname "${fil}")
- if ! grep "slink ${fil} " "${FILELIST}" 2>&1 > /dev/null; then
+ add_dir $(get_dirname "${dest}")
+ add_dir $(get_dirname "${fil}")
+ if ! grep -q "slink ${fil} " "${FILELIST}"; then
msg " adding link ${fil} -> ${dest}"
echo "slink ${fil} ${dest} $(stat -c '%a' ${1}) 0 0" >> "${FILELIST}"
fi
@@ -123,9 +123,9 @@ add_symlink ()
add_symlink2 ()
{
- add_dir $(dirname ${1})
- add_dir $(dirname ${2})
- if ! grep -q "slink ${1} " "${FILELIST}" 2>&1 >/dev/null; then
+ add_dir $(get_dirname ${1})
+ add_dir $(get_dirname ${2})
+ if ! grep -q "slink ${1} " "${FILELIST}"; then
msg " adding link ${1} -> ${2}"
echo "slink ${1} ${2} 777 0 0" >> "${FILELIST}"
fi
@@ -150,9 +150,9 @@ add_file ()
fi
fi
- add_dir $(dirname "${dest}")
+ add_dir $(get_dirname "${dest}")
- if ! grep "file ${dest} " "${FILELIST}" 2>&1 > /dev/null; then
+ if ! grep -q "file ${dest} " "${FILELIST}"; then
msg " adding file ${dest}"
echo "file ${dest} ${fil} $(stat -c '%a' ${fil}) 0 0" >> "${FILELIST}"
fi
@@ -171,6 +171,7 @@ add_module ()
#find pattern - replace _ with [-_] to match either
fil="${m//_/[-_]}"
+ msg " adding module ${fil}"
found=0
for path in $(find "${MODULEDIR}" -type f -name "${fil}.ko" -or -name "${fil}.ko.gz"); do
#get needed firmware files
@@ -178,7 +179,8 @@ add_module ()
[ -f "/lib/firmware/$fw" ] && add_file "/lib/firmware/$fw"
done
#get module depends
- for mod in $(/sbin/modinfo -F depends "${path}" | tr ',' ' '); do
+ deps="$(/sbin/modinfo -F depends "${path}")"
+ for mod in ${deps//,/ }; do
if [ -n "${mod}" ]; then
add_module "${mod}"
fi
diff --git a/install/autodetect b/install/autodetect
index 5c86eb0..6b8477f 100644
--- a/install/autodetect
+++ b/install/autodetect
@@ -54,8 +54,7 @@ install ()
fi
for m in ${AUTODETECT}; do
- modname="${m%.gz}"
- modname="$(basename ${modname%.ko})"
+ modname="$(get_module_name "${m}")"
echo "${modname}" >> "${MODULE_FILE}"
done
diff --git a/mkinitcpio b/mkinitcpio
index 0865482..7ce1401 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -242,8 +242,8 @@ for hook in ${HOOKS}; do
# within $INSTDIR.
if [ -h "${INSTDIR}/${hook}" ]; then
newhook="$(readlink -ne "${INSTDIR}/${hook}")"
- if [ -n "${newhook}" -a "${INSTDIR}/$(basename ${newhook})" -ef "${newhook}" ]; then
- newhook="$(basename ${newhook})"
+ if [ -n "${newhook}" -a "${INSTDIR}/$(get_basename ${newhook})" -ef "${newhook}" ]; then
+ newhook="$(get_basename ${newhook})"
echo " -------------------------------------------------------------------"
echo " WARNING: Hook \"${hook}\" is deprecated."
echo " Replace it with \"${newhook}\" in your configuration file."
@@ -251,7 +251,7 @@ for hook in ${HOOKS}; do
hook="${newhook}"
fi
fi
- if grep "install" "${INSTDIR}/${hook}" >/dev/null 2>&1; then
+ if grep -q "install" "${INSTDIR}/${hook}"; then
. "${INSTDIR}/${hook}"
echo ":: Parsing hook [${hook}]"
install
@@ -264,7 +264,7 @@ done
if [ "${HAS_MODULES}" = "y" ]; then
echo ":: Generating module dependencies"
for mod in $(grep "file /lib/modules/${KERNELVERSION}" ${FILELIST} | cut -d' ' -f2); do
- dir=$(dirname "${mod}")
+ dir=$(get_dirname "${mod}")
mkdir -p "${TMPDIR}/${dir}"
cp "${BASEDIR}${mod}" "${TMPDIR}/${dir}/"
done