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"
# false positive
# shellcheck disable=1090
. "${_dir}/${hook}/${hook}"
for _file in init init.late; do for _file in init init.late; do
[ -f "${_dir}/${hook}/${hook}.${_file}" ] || continue [ -f "${_dir}/${hook}/${hook}.${_file}" ] || continue
print "copying ${hook}.${_file}"
copy_file "${_dir}/${hook}/${hook}.${_file}" \ copy_file "${_dir}/${hook}/${hook}.${_file}" \
"/usr/share/tinyramfs/hooks/${hook##*/}" 644 0 "/usr/share/tinyramfs/hooks/${hook##*/}" 644 0
done done
break
done || panic "could not run $hook hook"
} }
copy_modules() copy_modules()