cleanup copy_hook

This commit is contained in:
illiliti 2020-09-06 16:46:46 +03:00
parent 0de5103945
commit fbbeecf193

View File

@ -235,22 +235,24 @@ copy_hook()
{ {
hook="$1" hook="$1"
# false positive
# shellcheck disable=1090
for _dir in "$hksdir" /etc/tinyramfs/hooks "${srcdir}/hooks"; do for _dir in "$hksdir" /etc/tinyramfs/hooks "${srcdir}/hooks"; do
[ -f "${_dir}/${hook}/${hook}" ] || ! continue [ -f "${_dir}/${hook}/${hook}" ] || ! continue
done || panic "could not find $hook hook"
print "running $hook hook"; . "${_dir}/${hook}/${hook}" print "running $hook hook"
for _file in init init.late; do # false positive
[ -f "${_dir}/${hook}/${hook}.${_file}" ] || continue # shellcheck disable=1090
. "${_dir}/${hook}/${hook}"
copy_file "${_dir}/${hook}/${hook}.${_file}" \ for _file in init init.late; do
"/usr/share/tinyramfs/hooks/${hook##*/}" 644 0 [ -f "${_dir}/${hook}/${hook}.${_file}" ] || continue
done
break print "copying ${hook}.${_file}"
done || panic "could not run $hook hook"
copy_file "${_dir}/${hook}/${hook}.${_file}" \
"/usr/share/tinyramfs/hooks/${hook##*/}" 644 0
done
} }
copy_modules() copy_modules()